コード例 #1
0
        public void LoadAllLogs()
        {
            List <LogStub> stubsToAdd    = new List <LogStub>();
            var            loadDirectory = this.Settings.LogFolder;

            var directory = new DirectoryInfo(loadDirectory);
            var files     = directory.GetFiles("*.timelog");

            foreach (var file in files)
            {
                var fileDateByName = file.Name.ToLower().Replace(".timelog", string.Empty).Replace('-', '/');

                DateTime logDate;
                if (!DateTime.TryParse(fileDateByName, out logDate))
                {
                    continue;
                }

                var logStub =
                    new LogStub()
                {
                    FileName = file.FullName,
                    Date     = logDate.Date,
                    Group    = GetGroupByLogDate(logDate.Date)
                };

                stubsToAdd.Add(logStub);
            }

            UIThread.Run(() =>
            {
                this.AllLogs.Clear();
                stubsToAdd.ForEach(x => this.AllLogs.Add(x));
            });
        }
コード例 #2
0
        private void ApplyTextFilters()
        {
            var list = _queried.ToList();

            Filter.RemoveNonMatches(ref list);
            UIThread.Run(() => ItemsList.SetItems(list));
        }
コード例 #3
0
ファイル: LeaseBalAdjsList.cs プロジェクト: peterson1/RentLog
        public async Task Fill(LeaseBalAdjustmentsVM windowVM)
        {
            var lse      = windowVM.Lease;
            var main     = windowVM.Main;
            var url      = BalanceAdjConverter1.VIEWS_ID;
            var conv     = new BalanceAdjConverter1(lse, main);
            var dynamics = await conv.GetViewsList(url);

            var byfAdjs = dynamics.Select(_ => conv.CastToRNT(_));
            var rows    = new List <LeaseBalAdjRow>();

            foreach (BalanceAdjustmentDTO byf in byfAdjs)
            {
                if (conv._memoTypes[byf.Id] == 1)
                {
                    continue;                               //cashier colxn?
                }
                if (byf.Remarks.Contains("Daily Rights Surcharge Memo"))
                {
                    continue;
                }
                var row = new LeaseBalAdjRow(byf, conv, main.AppArgs);
                rows.Add(row);
            }
            UIThread.Run(() => this.SetItems
                             (rows.OrderBy(_ => _.Date)));
        }
コード例 #4
0
 private void CheckQueueForGameDeletion(Queue <QueueItem> queue)
 {
     if (IsFSD && queue.Any(item => item.FileSystemItem.TitleType == TitleType.Game && GetCorrespondingScanFolder(item.FileSystemItem.Path) != null))
     {
         UIThread.Run(() => EventAggregator.GetEvent <NotifyUserMessageEvent>().Publish(new NotifyUserMessageEventArgs("GameDeletionMessage", MessageIcon.Warning)));
     }
 }
コード例 #5
0
        private OperationResult ExecuteVerification(QueueItem item)
        {
            UIThread.Run(() => TransferAction = Resx.Verifying);
            string remotePath;
            string localPath;
            var    ftp = TargetPane as FtpContentViewModel;

            if (ftp == null)
            {
                ftp = SourcePane as FtpContentViewModel;
                if (ftp == null)
                {
                    throw new ApplicationException();
                }

                localPath  = (string)item.Payload;
                remotePath = item.FileSystemItem.Path;
            }
            else
            {
                remotePath = (string)item.Payload;
                localPath  = item.FileSystemItem.Path;
            }
            var verificationResult = ftp.Verify(remotePath, localPath);

            return(new OperationResult(verificationResult));
        }
コード例 #6
0
 void Patcher_PatchInfoAdded(string message)
 {
     UIThread.Run(() =>
     {
         txtStatus.Text = message;
     });
 }
コード例 #7
0
        /// <summary>
        /// UI update method, should be called via Invoke - patcher runs in a different thread than the UI.
        /// </summary>
        /// <param name="patchFileName">the filename we're downloading</param>
        /// <param name="curDownload">current number of bytes downloaded so far</param>
        /// <param name="totalDownload">total number of bytes expected for this download</param>
        private void UpdatePatchProgress(string patchFileName, long curDownload, long totalDownload)
        {
            UIThread.Run(() =>
            {
                if (pb.Value == 0 && curDownload > 0)
                {
                    // Send a text message to the log label
                    txtStatus.Text = "Receiving " + Util.ConvertBytesToMegabytes((ulong)totalDownload).ToString("N") + "MB patch " + System.IO.Path.GetFileName(patchFileName) + "...";
                }

                // Update progress bar
                pb.Maximum = (int)totalDownload;
                pb.Value   = (int)curDownload;

                if (pb.Value > 0 && pb.Value < pb.Maximum)
                {
                    pb.Visibility = lblFilename.Visibility = System.Windows.Visibility.Visible;
                }
                else
                {
                    pb.Visibility = lblFilename.Visibility = System.Windows.Visibility.Collapsed;
                }

                if (curDownload == totalDownload)
                {
                    pb.Value = 0;
                }
            });
        }
コード例 #8
0
        protected override async Task OnRefreshClickedAsync()
        {
            var tupl = await GetRowsAndTotal();

            Totals = tupl.Totals;
            UIThread.Run(() => Rows.SetItems(tupl.Rows));
        }
コード例 #9
0
        private void ApplyTextFilters()
        {
            var list = _cache.ToList();

            Filter.RemoveNonMatches(ref list);
            UIThread.Run(() => Rows.SetItems(list));
        }
コード例 #10
0
        internal void Fill(DateTime startDate, DateTime endDate, MainWindowVM mainWindowVM)
        {
            var rows = startDate.EachDayUpTo(endDate)
                       .OrderByDescending(_ => _)
                       .Select(_ => new DailyTransactionRow(_, mainWindowVM));

            UIThread.Run(() => this.SetItems(rows));
        }
コード例 #11
0
 private void OnGetListingDataReceived(object sender, FtpGetListingEventArgs e)
 {
     if (e.Size < 20480)
     {
         return;
     }
     UIThread.Run(() => ProgressMessage = string.Format(Resx.ChangingDirectoryDataReceived, e.Size));
 }
コード例 #12
0
        //protected override void OnRefreshClicked() => Rows.SetItems(GetBillRows());
        protected override async Task OnRefreshClickedAsync()
        {
            IEnumerable <DailyBillsRow> rows = null;
            await Task.Run(() => rows = GetBillRows());

            UIThread.Run(() => Rows.SetItems(rows));
            FirstRow = Rows.FirstOrDefault();
        }
コード例 #13
0
 private void SetItemsCount(int value)
 {
     UIThread.Run(() =>
     {
         ItemsCount    = value;
         ItemsMigrated = 0;
     });
 }
コード例 #14
0
 protected virtual void OnFileChanged()
 {
     if (ExecuteOnFileChanged)
     {
         UIThread.Run(() =>
                      ExecuteCmd.ExecuteIfItCan());
     }
 }
コード例 #15
0
 private void OnStfsContentCountDetermined(object sender, ContentCountEventArgs e)
 {
     _itemsCount = e.Count;
     UIThread.Run(() =>
     {
         IsIndetermine = false;
         ProgressValue = 0;
     });
 }
コード例 #16
0
        private async Task StartNewHandler <T>(string fileKey, string filePath)
            where T : class, IChangeBroadcastHandler
        {
            var listnr = Resolve <T>();

            listnr.SetTargetFile(fileKey, filePath);
            UIThread.Run(() => Listeners.Add(listnr));
            await listnr.CheckThenSetHandler();
        }
コード例 #17
0
 private void TimerCallback(object state)
 {
     Message  = string.Format(Resx.ShutdownDialogMessage, _innerText, _counter.Seconds);
     _counter = _counter.Subtract(new TimeSpan(0, 0, 1));
     if (_counter.Seconds == 0)
     {
         UIThread.Run(() => CloseCommand.Execute(Mode));
     }
 }
コード例 #18
0
        public void ReloadList()
        {
            UIThread.Run(() => ClearItems());
            UnexpectedsCount = 0;
            var tupl  = this.QueryBothSources();
            var items = this.AlignByIDs(tupl);

            UIThread.Run(() => SetItems(items));
            UpdateCounts();
        }
コード例 #19
0
 /// <summary>
 /// Event handler code gets called when a patch has arrived.  This is for informational purposes only.
 /// The patcher handles all necessary responses to this event internally.
 /// </summary>
 private void Patcher_OnPatchArrived(string patchFile, long fileLength)
 {
     UIThread.Run(() =>
     {
         string len       = string.Format("{0} MB", Util.ConvertBytesToMegabytes(fileLength).ToString("0.00"));
         lblFilename.Text = System.IO.Path.GetFileName(patchFile) + "(" + len + ")";
         pb.Value         = 100;
         UpdatePatchProgress(patchFile, fileLength, fileLength);
     });
 }
コード例 #20
0
 /// <summary>
 /// Event handler gets called by the patcher when the patch server tells us we're current. When this happens, we enable the "Play" button via this event handler.
 /// </summary>
 private void Patcher_OnClientIsCurrent(object sender, EventArgs e)
 {
     // Enable Play Button
     Patcher_PatchInfoAdded("Files up to date.");
     UIThread.Run(() =>
     {
         txtStatus.Text = "Launching...";
         Launch();
     });
 }
コード例 #21
0
        protected override async void OnWindowLoaded()
        {
            if (Draft.Id != 0)
            {
                return;
            }
            List <string> items = null;
            await Task.Run(() => items = AppArgs.Vouchers.GetPayees());

            UIThread.Run(() => Payees.SetItems(items));
        }
コード例 #22
0
 void Patcher_OnPatchApplyProgress(string patchFileName, long curProcess, long totalDiffs)
 {
     UIThread.Run(() =>
     {
         string prog      = string.Format("Applying patch: {0}/{1} differences", curProcess, totalDiffs);
         lblFilename.Text = prog;
         pb.Value         = curProcess;
         pb.Maximum       = totalDiffs;
         UpdatePatchApplyProgress(patchFileName, curProcess, totalDiffs);
     });
 }
コード例 #23
0
 protected void AsUI(Action action)
 {
     if (_win == null)
     {
         try   { action.Invoke(); }
         catch { }
     }
     else
     {
         UIThread.Run(action);
     }
 }
コード例 #24
0
 /// <summary>
 /// Event handler code gets called when a patch has arrived.  This is for informational purposes only.
 /// The patcher handles all necessary responses to this event internally.
 /// </summary>
 private void Patcher_OnPatchDownloadProgress(string patchFileName, long curDownload, long totalDownload)
 {
     rec++;
     //Log.LogMsg(string.Format(rec + " - " + "Patch progress for {0} at {1} / {2}", patchFileName, curDownload, totalDownload));
     UIThread.Run(() =>
     {
         string len       = string.Format("{0} MB", Util.ConvertBytesToMegabytes(totalDownload).ToString("0.00"));
         lblFilename.Text = System.IO.Path.GetFileName(patchFileName) + "(" + len + ")";
         pb.Value         = curDownload;
         UpdatePatchProgress(patchFileName, curDownload, totalDownload);
     });
 }
コード例 #25
0
ファイル: PostAndCloseVM.cs プロジェクト: peterson1/RentLog
        private async Task VisualizePostAndClose()
        {
            Main.StartBeingBusy("Posting and Closing ...");
            RunPostAndClose();
            await Task.Delay(1000 * 10);//artificial delay to give time for GoogleDrive to catch up

            UIThread.Run(() => MessageBox.Show(
                             $"Successfully posted collections for {Main.Date:d-MMM-yyyy}{L.F}"
                             + $"The next market day [{Main.Date.AddDays(1):d-MMM-yyyy}] is now open for encoding.",
                             "   Operation Successful", MessageBoxButton.OK, MessageBoxImage.Information));

            Main.CloseWindow();
        }
コード例 #26
0
 public ChadderSource(int instanceId = 0)
 {
     InstanceId = instanceId;
     Urls       = new ChadderUrls();
     db         = new ChadderDatabase(this);
     Session    = new ChadderRequest();
     KeyFactory = new ECDSASimpleFactory();
     Connection = new ChadderConnection(Urls.Domain);
     Connection.OnRequestUpdate += () => UIThread.Run(async() =>
     {
         await RequestUpdates();
     });
 }
コード例 #27
0
        public static async Task GetDifferences <T>(this ConverterRowBase <T> row) where T : class, IDocumentDTO
        {
            row.StartBeingBusy("Getting row differences ...");
            row.ErrorText = null;
            await Task.Delay(1);

            var diffs = await row.QueryThenCompare();

            UIThread.Run(() => row.DiffRows.SetItems(diffs));
            row.UpdateCounts();
            row.ShowFirstDiff();
            row.StopBeingBusy();
        }
コード例 #28
0
 protected override bool ValidateDirectory(FileSystemItem item, FileOperation action)
 {
     if (item.Type == ItemType.Directory &&
         new Regex(string.Format(ProfileFilePattern, item.Name)).IsMatch(item.Path))
     {
         if (action == FileOperation.Copy)
         {
             UIThread.Run(() => EventAggregator.GetEvent <NotifyUserMessageEvent>().Publish(new NotifyUserMessageEventArgs("LockedProfileCopyMessage", MessageIcon.Warning)));
         }
         return(false);
     }
     return(base.ValidateDirectory(item, action));
 }
コード例 #29
0
        public async Task WaitForApproval()
        {
            SubmitForApproval();

            _main.StartBeingBusy("Submitting collections for review ...");
            await Task.Delay(1000 * 4);//artificial delay for web sync to upload changes

            UIThread.Run(() => MessageBox.Show(
                             $"Successfully submitted collections for review.",
                             "   Operation Successful", MessageBoxButton.OK, MessageBoxImage.Information));

            StartBeingBusy("Waiting for Supervisor to Post & Close the market day..."
                           + L.F + "Please keep this window open.");
        }
コード例 #30
0
 void Patcher_PatchNotesArrived(string notes)
 {
     UIThread.Run(() =>
     {
         if (txtNotes.Text.Length == 0)
         {
             txtNotes.AppendText(notes);
         }
         else
         {
             txtNotes.AppendText("\r\n\r\n" + notes);
         }
     });
 }