Пример #1
0
 private async void dispatcherTimerTick(object sender, EventArgs e)
 {
     await Task.Run(async() =>
     {
         var stock = await _misTwse.GetInfoAsync(_httpClientFactory.CreateClient(), "tse_2330.tw");
         await Dispatcher.BeginInvoke(() =>
         {
             TbResult.Document.Blocks.Clear();
             TbResult.AppendText(JsonSerializer.Serialize(stock,
                                                          new JsonSerializerOptions {
                 WriteIndented = true
             }));
         });
     });
 }
        private void BtnClear_Click(object sender, RoutedEventArgs e)
        {
            if (TbcalcInput.Text == "")
            {
                _NoCalcYet = true;
                number1    = 0.0f;
                number2    = 0.0f;
                TbcalcInput.Clear();
                TbcalcInput.Focus();
                TbResult.Clear();
                LblResult.Content = "";

                return;
            }
            TbcalcInput.Clear();
            _NoCalcYet = true;
        }
Пример #3
0
        private void BtFindFirst_Click(object sender, EventArgs e)
        {
            TbResult.Clear();
            List <string> roots = TbRoots.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList();

            vss = new VSSUtils(Properties.Settings.Default.BaseLocation, Environment.UserName);

            lf = new LogForm();
            VSSUtils.sender = lf.AddToLog;
            lf.Show();

            Thread th = new Thread(() =>
            {
                EnableStopButton();
                DisableSearchButtons();

                bool found = false;

                foreach (string root in roots)
                {
                    if (vss.FirstInEntireBase(root, TbFileName.Text, (int)NudDepth.Value, true, out string match))
                    {
                        TbResult.Invoke(new Action(() => TbResult.AppendText(match)));
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    MessageBox.Show("Поиск завершен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    MessageBox.Show("Файл не найден", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                lf.Invoke(new Action(() => lf.Close()));

                EnableSearchButtons();
                DisableStopButton();
            });

            th.Start();
        }
Пример #4
0
 private void OnExcuteClick(object sender, RoutedEventArgs e)
 {
     TbResult.Clear();
     Cmd.RunCmdAsync(CbCmd.Text.Trim());
 }
Пример #5
0
 private void ReadLineCallback(String line)
 {
     Dispatcher.Invoke(new Action(() => TbResult.AppendText(line + Environment.NewLine)));
 }