Esempio n. 1
0
        public void Invoke_Test00()
        {
            var  service = new DispatcherService();
            bool val1    = false;

            service.Invoke(() => val1 = true);
            Assert.IsTrue(val1);
        }
Esempio n. 2
0
 // 프로그레스 바 리셋
 private void resetProgressBar()
 {
     DispatcherService.Invoke((System.Action)(() =>
     {
         runButton.Background = Brushes.LightGray;
         runButton.Foreground = Brushes.Black;
     }));
 }
Esempio n. 3
0
 public void get4()
 {
     DispatcherService.Invoke((System.Action)(() =>
     {
         D_Data_Main.Clear();
         for (int i = 0; i < D_Data.Count(); i++)
         {
             D_Data_Main.Add(D_Data[i]);
         }
     }));
 }
Esempio n. 4
0
 public void get3()
 {
     DispatcherService.Invoke((System.Action)(() =>
     {
         L_Data3_Main.Clear();
         for (int i = 0; i < L_Data3.Count(); i++)
         {
             L_Data3_Main.Add(L_Data3[i]);
         }
     }));
 }
Esempio n. 5
0
        public void Invoke_Test01()
        {
            var  service    = new DispatcherService();
            bool val1       = false;
            bool checkValue = false;
            bool isSet      = false;

            Task.Factory.StartNew(() => {
                service.Invoke(() => val1 = true);
                checkValue = val1;
                isSet      = true;
            });
            EnqueueWait(() => isSet);
            Assert.IsTrue(checkValue);
        }
Esempio n. 6
0
 private void Timer_Elapsed(object sender, ElapsedEventArgs e)
 {
     DispatcherService.Invoke((System.Action)(() => {
         if (countBtn3 != 0)
         {
             VM.L_Data2_Main.Clear();
             VM.L_Data2.Clear();
         }
         VM.L_Data2.Add(new LmsData2()
         {
             LmsTitle2 = "데이터 로딩중"
         });
         VM.get2();
         VM.L_Data2.Clear();
         Start3();
         countBtn3++;
     }));
 }
Esempio n. 7
0
 protected override void EstablishContext()
 {
     base.EstablishContext();
     DispatcherService.Invoke(Execute);
 }
Esempio n. 8
0
        private async void DownloadUpdateTC()
        {
            if (String.IsNullOrEmpty(Settings.Default.TrunkLocation))
            {
                if (_messageService.Show("You must first set your trunk location! Want to do this right now?", "Trunk location not set!", MessageButton.YesNo, MessageImage.Question) == MessageResult.Yes)
                {
                    SetTrunkLocation();
                }

                return;
            }

            if (_isCloning)
            {
                _messageService.ShowError("Cloning is already in progress!");

                return;
            }

            if (_isCompiling)
            {
                _messageService.ShowError("Currently compiling TrinityCore! Please wait until this has finished.");

                return;
            }

            Busy = true;
            BusyIndeterminate = true;

            _isCloning = true;

            if (new DirectoryInfo(Settings.Default.TrunkLocation).GetFiles().Length == 0)
            {
                var progress = new Progress <double>(prog => _dispatcherService.BeginInvoke(() =>
                {
                    if (BusyIndeterminate)
                    {
                        BusyIndeterminate = false;
                    }

                    if (prog - BusyProgress > 1 || prog >= 99)
                    {
                        BusyProgress = prog;
                    }
                }));

                bool cloneSuccess = await TrinityCoreRepository.Clone(Settings.Default.TrunkLocation, progress);

                _dispatcherService.Invoke(() =>
                {
                    if (cloneSuccess)
                    {
                        _messageService.Show("Cloning has been completed!", "Success", MessageButton.OK, MessageImage.Information);
                    }
                    else
                    {
                        _messageService.Show("Cloning could not be completed!", "Something went wrong", MessageButton.OK, MessageImage.Error);
                    }
                });

                _isCloning = false;
            }
            else
            {
                BusyIndeterminate = true;
                OutputText        = String.Empty;

                var progress = new Progress <string>(prog => _dispatcherService.BeginInvokeIfRequired(delegate
                {
                    OutputText += prog + Environment.NewLine;
                }));

                bool pullSuccess = await TrinityCoreRepository.Pull(Settings.Default.TrunkLocation, progress);

                _dispatcherService.Invoke(() =>
                {
                    if (pullSuccess)
                    {
                        _messageService.Show("The TrinityCore repository has been updated to the latest version.", "Success", MessageButton.OK, MessageImage.Information);
                    }
                    else
                    {
                        _messageService.Show("Pulling could not be completed!", "Something went wrong", MessageButton.OK, MessageImage.Error);
                    }
                });

                _isCloning = false;
            }

            BusyIndeterminate = false;
            BusyProgress      = 0;
            Busy = false;
        }