public static async Task <CremaDataSet> GetDataAsync(Authentication authentication, ITableItemDescriptor descriptor, string revision)
 {
     if (descriptor.Target is ITableItem tableItem)
     {
         return(await tableItem.GetDataSetAsync(authentication, revision));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Example #2
0
 public static async Task <LogInfo[]> GetLogAsync(Authentication authentication, ITableItemDescriptor descriptor)
 {
     if (descriptor.Target is ITableItem tableItem)
     {
         return(await tableItem.Dispatcher.InvokeAsync(() => tableItem.GetLog(authentication)));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
 public static async Task <FindResultInfo[]> FindAsync(Authentication authentication, ITableItemDescriptor descriptor, string text, FindOptions options)
 {
     if (descriptor.Target is ITableItem tableItem)
     {
         return(await tableItem.FindAsync(authentication, text, options));
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Example #4
0
        public static async Task <LogViewModel> ShowDialogAsync(Authentication authentication, ITableItemDescriptor descriptor)
        {
            if (authentication == null)
            {
                throw new ArgumentNullException(nameof(authentication));
            }
            if (descriptor == null)
            {
                throw new ArgumentNullException(nameof(descriptor));
            }

            if (descriptor.Target is ITableItem tableItem)
            {
                try
                {
                    var dialog = await tableItem.Dispatcher.InvokeAsync(() => new LogViewModel(authentication, tableItem));

                    if (dialog.ShowDialog() == true)
                    {
                        return(dialog);
                    }
                    return(null);
                }
                catch (Exception e)
                {
                    CremaLog.Error(e);
                    return(null);
                }
            }
            throw new NotImplementedException();
        }