Skip to content

Commit

Permalink
3.6.18130.1523
Browse files Browse the repository at this point in the history
서버 서비스 예외 문자열 정리
CremaException 사용부분을 ArgumentException이나 InvalidOperationException등으로 대체중
버전 생성기 추가
디버그일때 서버와 클라이언트간의 30초 간격으로 하는 ping 작업을 하지 않도록 변경
  • Loading branch information
s2quake committed May 10, 2018
1 parent 6216b59 commit 3f714f9
Show file tree
Hide file tree
Showing 43 changed files with 463 additions and 252 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public async void SelectDataBase(string dataBaseName)
try
{
if (this.isOpened == false)
throw new CremaException(Resources.Exception_CannotSelectWithoutLoggingIn);
throw new InvalidOperationException(Resources.Exception_CannotSelectWithoutLoggingIn);

this.BeginProgress();
if (this.DataBaseName != string.Empty)
Expand Down Expand Up @@ -350,7 +350,7 @@ public async void Unload()
public async Task UnloadAsync()
{
if (this.DataBaseName == string.Empty)
throw new CremaException();
throw new InvalidOperationException();

await this.CloseDocumentsAsync(false);
this.OnUnloading(EventArgs.Empty);
Expand Down Expand Up @@ -772,7 +772,7 @@ private Task EnterDataBaseAsync(string dataBaseName)
{
var dataBase = this.cremaHost.DataBases[dataBaseName];
if (dataBase == null)
throw new CremaException(Resources.Exception_NonExistentDataBase, dataBaseName);
throw new ArgumentException(string.Format(Resources.Exception_NonExistentDataBase, dataBaseName), nameof(dataBaseName));
if (dataBase.IsLoaded == false && autoLoad == true)
{
dataBase.Load(this.authenticator);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ public void DeleteSelectedItems()

}

public void PasteFromClipboard()
{
if (Clipboard.ContainsText() == false)
return;

var gridContext = DataGridControl.GetDataGridContext(this);
var gridControl = gridContext.DataGridControl as DomainDataGridControl;

var parser = new DomainTextClipboardPaster(gridContext);
parser.Parse(ClipboardUtility.GetData());
var rowInfos = parser.DomainRows;
var domain = this.Domain;
var authenticator = domain.GetService(typeof(Authenticator)) as Authenticator;
domain.Dispatcher.Invoke(() => domain.SetRow(authenticator, rowInfos));
parser.SelectRange();
}

public override void OnApplyTemplate()
{
base.OnApplyTemplate();
Expand Down Expand Up @@ -124,6 +141,25 @@ public bool CanResetSelectedFields
}
}

public bool CanPaste
{
get
{
if (this.IsBeingEdited == true)
return false;
if (this.currentColumn == null)
return false;
if (this.currentColumn.ReadOnly == true)
return false;
if (this.ReadOnly == true)
return false;
if (Clipboard.ContainsText() == false)
return false;

return true;
}
}

protected override bool IsItemItsOwnContainerOverride(object item)
{
return item is DomainDataRow;
Expand Down Expand Up @@ -372,41 +408,7 @@ private void PasteFromClipboard_Execute(object sender, ExecutedRoutedEventArgs e
this.RequestPasteFromClipboard();
}

public bool CanPaste
{
get
{
if (this.IsBeingEdited == true)
return false;
if (this.currentColumn == null)
return false;
if (this.currentColumn.ReadOnly == true)
return false;
if (this.ReadOnly == true)
return false;
if (Clipboard.ContainsText() == false)
return false;

return true;
}
}

public void PasteFromClipboard()
{
if (Clipboard.ContainsText() == false)
return;

var gridContext = DataGridControl.GetDataGridContext(this);
var gridControl = gridContext.DataGridControl as DomainDataGridControl;

var parser = new DomainTextClipboardPaster(gridContext);
parser.Parse(ClipboardUtility.GetData());
var rowInfos = parser.DomainRows;
var domain = this.Domain;
var authenticator = domain.GetService(typeof(Authenticator)) as Authenticator;
domain.Dispatcher.Invoke(() => domain.SetRow(authenticator, rowInfos));
parser.SelectRange();
}


private void RequestPasteFromClipboard()
{
Expand Down
27 changes: 15 additions & 12 deletions client/Ntreev.Crema.Client.Framework/Controls/DomainInsertionRow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ protected override void BeginEditCore()

var props = typedList.GetItemProperties(null);


this.tableName = CremaDataTable.GetTableName(typedList.GetListName(null));
this.columnNames = CremaDataRowUtility.GetColumnNames(typedList);

Expand Down Expand Up @@ -364,19 +364,22 @@ private void Select(DomainRowInfo[] domainRows)

private void Items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.Action == NotifyCollectionChangedAction.Add)
this.Dispatcher.InvokeAsync(() =>
{
if (e.Action == NotifyCollectionChangedAction.Add)
{

}
else if (e.Action == NotifyCollectionChangedAction.Reset)
{
var gridContext = DataGridControl.GetDataGridContext(this);
this.Select(this.results);
this.results = null;
this.hasField = false;
(gridContext.Items as INotifyCollectionChanged).CollectionChanged -= Items_CollectionChanged;
this.OnInserted(EventArgs.Empty);
}
}
else if (e.Action == NotifyCollectionChangedAction.Reset)
{
var gridContext = DataGridControl.GetDataGridContext(this);
this.Select(this.results);
this.results = null;
this.hasField = false;
(gridContext.Items as INotifyCollectionChanged).CollectionChanged -= Items_CollectionChanged;
this.OnInserted(EventArgs.Empty);
}
});
}

private object[] CreateFields()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected override void StartExporter(string dataFormat)
protected override void StartDataItem(DataGridContext dataGridContext, object dataItem)
{
if (this.gridContext != null && this.gridContext != dataGridContext)
throw new CremaException(Resources.Exception_CannotSelectComplexRanges);
throw new InvalidOperationException(Resources.Exception_CannotSelectComplexRanges);
this.isFistColumn = true;
this.gridContext = dataGridContext;
}
Expand Down
36 changes: 0 additions & 36 deletions client/Ntreev.Crema.Client.Framework/TypeDescriptorUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,41 +57,5 @@ public static bool IsFlag(Authentication authentication, ITypeDescriptor descrip
throw new ArgumentNullException(nameof(descriptor));
return descriptor.TypeInfo.IsFlag;
}

//public static bool IsBeingSetup(Authentication authentication, ITypeDescriptor descriptor)
//{
// if (authentication == null)
// throw new ArgumentNullException(nameof(authentication));
// if (descriptor == null)
// throw new ArgumentNullException(nameof(descriptor));
// return descriptor.TypeState.HasFlag(TypeState.IsBeingSetup);
//}

//public static bool IsBeingSetupClient(Authentication authentication, ITypeDescriptor descriptor)
//{
// if (authentication == null)
// throw new ArgumentNullException(nameof(authentication));
// if (descriptor == null)
// throw new ArgumentNullException(nameof(descriptor));
// return descriptor.TypeState.HasFlag(TypeState.IsBeingSetup | TypeState.IsMember);
//}

//public static bool IsInherited(Authentication authentication, ITypeDescriptor descriptor)
//{
// if (authentication == null)
// throw new ArgumentNullException(nameof(authentication));
// if (descriptor == null)
// throw new ArgumentNullException(nameof(descriptor));
// return descriptor.TypeInfo.TemplatedParent != string.Empty;
//}

//public static bool IsBaseTemplate(Authentication authentication, ITypeDescriptor descriptor)
//{
// if (authentication == null)
// throw new ArgumentNullException(nameof(authentication));
// if (descriptor == null)
// throw new ArgumentNullException(nameof(descriptor));
// return descriptor.TypeAttribute.HasFlag(TypeAttribute.BaseType);
//}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected override void PrepareContainer(DataGridContext dataGridContext, object
{
try
{
listView.ApplySort(indexProp, ListSortDirection.Ascending);
this.Dispatcher.InvokeAsync(() => listView.ApplySort(indexProp, ListSortDirection.Ascending));
}
catch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected override void PrepareContainer(DataGridContext dataGridContext, object
base.PrepareContainer(dataGridContext, item);

var gridControl = dataGridContext.DataGridControl as TableSourceDataGridControl;
if(gridControl.CanInsert == false || gridControl.ReadOnly == true)
if (gridControl.CanInsert == false || gridControl.ReadOnly == true)
this.Visibility = System.Windows.Visibility.Collapsed;
}
}
Expand Down
22 changes: 12 additions & 10 deletions client/Ntreev.Crema.Services/Data/DataBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,11 @@ private void OnEnter(Authentication authentication)
}
var result = this.service.Subscribe(this.cremaHost.AuthenticationToken, base.Name);
result.Validate(authentication);
#if !DEBUG
this.timer = new Timer(30000);
this.timer.Elapsed += Timer_Elapsed;
this.timer.Start();
#endif
return result.Value;
});
this.typeContext = new TypeContext(this, metaData);
Expand Down Expand Up @@ -986,7 +988,7 @@ private void Sign<T>(Authentication authentication, ResultBase<T> result)
result.Validate(authentication);
}

#region IDataBase
#region IDataBase

IDataBase IDataBase.Copy(Authentication authentication, string newDataBaseName, string comment, bool force)
{
Expand Down Expand Up @@ -1021,9 +1023,9 @@ ITypeContext IDataBase.TypeContext
}
}

#endregion
#endregion

#region IServiceProvider
#region IServiceProvider

object IServiceProvider.GetService(System.Type serviceType)
{
Expand All @@ -1049,9 +1051,9 @@ object IServiceProvider.GetService(System.Type serviceType)
return this.CremaHost.GetService(serviceType);
}

#endregion
#endregion

#region IDataBaseServiceCallback
#region IDataBaseServiceCallback

void IDataBaseServiceCallback.OnServiceClosed(SignatureDate signatureDate, CloseInfo closeInfo)
{
Expand Down Expand Up @@ -1794,18 +1796,18 @@ void IDataBaseServiceCallback.OnTypeItemsLockChanged(SignatureDate signatureDate
}, nameof(IDataBaseServiceCallback.OnTypeItemsLockChanged));
}

#endregion
#endregion

#region IInfoProvider
#region IInfoProvider

IDictionary<string, object> IInfoProvider.Info => this.DataBaseInfo.ToDictionary();

#endregion
#endregion

#region IStateProvider
#region IStateProvider

object IStateProvider.State => this.DataBaseState;

#endregion
#endregion
}
}
14 changes: 8 additions & 6 deletions client/Ntreev.Crema.Services/Data/DataBaseCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ public DataBaseCollection(CremaHost cremaHost, string address, ServiceInfo servi
}
var result = this.service.Subscribe(cremaHost.AuthenticationToken);
result.Validate();
#if !DEBUG
this.timer = new Timer(30000);
this.timer.Elapsed += Timer_Elapsed;
this.timer.Start();
#endif
return result.Value;
});

Expand Down Expand Up @@ -789,7 +791,7 @@ private void Service_Faulted(object sender, EventArgs e)
}, nameof(Service_Faulted));
}

#region IDataBaseCollectionServiceCallback
#region IDataBaseCollectionServiceCallback

void IDataBaseCollectionServiceCallback.OnServiceClosed(SignatureDate signatureDate, CloseInfo closeInfo)
{
Expand Down Expand Up @@ -1056,9 +1058,9 @@ void IDataBaseCollectionServiceCallback.OnDataBasesLockChanged(SignatureDate sig
}, nameof(IDataBaseCollectionServiceCallback.OnDataBasesLockChanged));
}

#endregion
#endregion

#region IDataBaseCollection
#region IDataBaseCollection

IDataBase IDataBaseCollection.AddNewDataBase(Authentication authentication, string dataBaseName, string comment)
{
Expand Down Expand Up @@ -1089,9 +1091,9 @@ IDataBase IDataBaseCollection.this[Guid dataBaseID]
}
}

#endregion
#endregion

#region IEnumerable
#region IEnumerable

IEnumerator<IDataBase> IEnumerable<IDataBase>.GetEnumerator()
{
Expand All @@ -1105,6 +1107,6 @@ IEnumerator IEnumerable.GetEnumerator()
return this.GetEnumerator();
}

#endregion
#endregion
}
}
Loading

0 comments on commit 3f714f9

Please sign in to comment.