コード例 #1
0
 public DesignTimeHistoryViewModel()
     : base(null)
 {
     HistoryItems.Add(new HistoryItemViewModel("Initial", HistoryItemType.InitialState));
     HistoryItems.Add(new HistoryItemViewModel("Foo", HistoryItemType.Undo));
     HistoryItems.Add(new HistoryItemViewModel("Bar", HistoryItemType.Current));
     HistoryItems.Add(new HistoryItemViewModel("Baz", HistoryItemType.Redo));
 }
コード例 #2
0
            }             // Delete

            private void AddHistoryItem(VatReturnRawData oDeletedItem)
            {
                oDeletedItem.IsDeleted = true;

                HistoryItems.Add(new HistoryItem {
                    DeleteRecordInternalID = oDeletedItem.InternalID,
                    ReasonID = (int)DeleteReasons.ManualDeleted,
                });
            }             // AddHistoryItem
コード例 #3
0
ファイル: MainWindowVM.cs プロジェクト: MoDevby/SQL-Widget
        private async void AddToHistory(string db, string query, ResultVM resultVm)
        {
            var historyItem = new HistoryItem
            {
                Date   = $"({DateTime.Now.ToShortTimeString()})",
                DBName = db,
                Query  = query
            };
            var result = await Task.Run(() => resultVm.GetResultInfo());

            historyItem.Succeeded = result.Item1;
            historyItem.RowCount  = result.Item2;

            HistoryItems.Add(historyItem);
            HistoryItems = new List <HistoryItem>(HistoryItems);
        }
コード例 #4
0
        private void LoadHistory()
        {
            if (!File.Exists(_historyFileName))
            {
                return;
            }

            var json  = File.ReadAllText(_historyFileName);
            var items = JsonConvert.DeserializeObject <List <Models.HistoryItem> >(json);

            if (items == null || !items.Any())
            {
                return;
            }

            items.ForEach(item => HistoryItems.Add(item));
        }
コード例 #5
0
 public MesDesignTimeHistoryViewModel()
     : base(null)
 {
     HistoryItems.Add(new MesHistoryItemViewModel("Initial")
     {
         ItemType = MesHistoryItemType.InitialState
     });
     HistoryItems.Add(new MesHistoryItemViewModel("Foo")
     {
         ItemType = MesHistoryItemType.Undo
     });
     HistoryItems.Add(new MesHistoryItemViewModel("Bar")
     {
         ItemType = MesHistoryItemType.Current
     });
     HistoryItems.Add(new MesHistoryItemViewModel("Baz")
     {
         ItemType = MesHistoryItemType.Redo
     });
 }
コード例 #6
0
 public void MoveVerseBindingSourceAndAddCurrentToHistory(bool isHistory = false)
 {
     if (IsGoToRunning)
     {
         return;
     }
     if (Settings.CurrentView == ViewMode.ChapterVerses)
     {
         int pos = CurrentReference.Verse?.Number - 1 ?? -1;
         if (pos != VersesBindingSource.Position)
         {
             VersesBindingSource.Position = pos;
         }
     }
     if (!isHistory)
     {
         HistoryItems.Add(CurrentReference);
     }
     UpdateHistory();
     UpdateBookmarks();
 }
コード例 #7
0
        /// <summary>
        /// Invoke a parsed command line and return the result adding both to history.
        /// </summary>
        /// <param name="args">Command line tokens</param>
        /// <returns>object representing the result</returns>
        private static object Invoke(string[] args)
        {
            var cmdKey = args[0];

            if (!Commands.ContainsKey(cmdKey))
            {
                return($"Unknown command ({cmdKey}). [{string.Join(", ", Commands.Keys)}]");
            }

            var item = new HistoryItem(args);

            try
            {
                HistoryItems.Add(item);
                var result = Commands[cmdKey](args);
                item.Result = result;
                return(result);
            }
            catch (Exception e)
            {
                item.Result = e.Message;
                return(e.Message);
            }
        }
コード例 #8
0
            }             // IsEmptyInput

            public void AddHistoryItem(VatReturnRawData oOld, VatReturnRawData oNew)
            {
                // At this point oOld and oNew have overlapping date intervals
                // and same registration # and oNew is not deleted.

                DeleteReasons    nReason;
                VatReturnRawData oDeletedItem;
                VatReturnRawData oReasonItem;

                switch (oOld.SourceType)
                {
                case VatReturnSourceType.Linked:
                    if (oNew.SourceType == VatReturnSourceType.Linked)
                    {
                        oDeletedItem = Delete(oOld);
                        oReasonItem  = oNew;
                        nReason      = DeleteReasons.LinkedUpdated;
                    }
                    else
                    {
                        oDeletedItem = oNew;
                        oReasonItem  = oOld;
                        nReason      = oNew.SourceType == VatReturnSourceType.Manual
                                                        ? DeleteReasons.ManualRejectedByLinked
                                                        : DeleteReasons.UploadedRejectedByLinked;
                    }
                    break;

                case VatReturnSourceType.Uploaded:
                    switch (oNew.SourceType)
                    {
                    case VatReturnSourceType.Linked:
                        oDeletedItem = Delete(oOld);
                        oReasonItem  = oNew;
                        nReason      = DeleteReasons.UploadedRejectedByLinked;
                        break;

                    case VatReturnSourceType.Uploaded:
                        oDeletedItem = oNew;
                        oReasonItem  = oOld;
                        nReason      = oOld.SameAs(oNew) ? DeleteReasons.UploadedEqual : DeleteReasons.UploadedNotEqual;
                        break;

                    case VatReturnSourceType.Manual:
                        oDeletedItem = oNew;
                        oReasonItem  = oOld;
                        nReason      = DeleteReasons.ManualRejectedByUploaded;
                        break;

                    default:
                        throw new StrategyAlert(this.m_oStrategy, "Non implemented VAT return source type: " + oNew.SourceType);
                    }                     // switch

                    break;

                case VatReturnSourceType.Manual:
                    oDeletedItem = Delete(oOld);
                    oReasonItem  = oNew;

                    switch (oNew.SourceType)
                    {
                    case VatReturnSourceType.Linked:
                        nReason = DeleteReasons.ManualRejectedByLinked;
                        break;

                    case VatReturnSourceType.Uploaded:
                        nReason = DeleteReasons.OverriddenByUploaded;
                        break;

                    case VatReturnSourceType.Manual:
                        nReason = DeleteReasons.ManualUpdated;
                        break;

                    default:
                        throw new StrategyAlert(this.m_oStrategy, "Non implemented VAT return source type: " + oNew.SourceType);
                    }                     // switch

                    break;

                default:
                    throw new StrategyAlert(this.m_oStrategy, "Non implemented VAT return source type: " + oNew.SourceType);
                }                 // switch

                oDeletedItem.IsDeleted = true;

                HistoryItems.Add(new HistoryItem {
                    DeleteRecordInternalID = oDeletedItem.InternalID,
                    ReasonRecordInternalID = oReasonItem.InternalID,
                    ReasonID = (int)nReason,
                });
            }             // AddHistoryItem