コード例 #1
0
            private void DoNextActionSequence(DeterministicRandom random, ExecutionContext currentExecution, int threadId)
            {
                currentExecution.GetSequence(random);

                //Synchronously Execute each action in the sequence on Execution Context.
                while (currentExecution.DoNext(random))
                {
                    //Wait between each action in a sequence
                    Trace.WriteLine("[Scheduler] Pushing Frame onto Dispatcher");
                    DispatcherHelper.DoEvents((int)idleDuration.TotalMilliseconds, DispatcherPriority.Background);
                    Trace.WriteLine("[Scheduler] Dispatcher queue has been executed.");
                }

                //Assess execution state for metrics reset if beyond complexity threshold, or if we've gone through test for a while.
                //Iteration based mechanism to compensate for memory growth in lieu of metrics
                if (currentExecution.IsStateBeyondConstraints())
                {
                    Trace.WriteLine("[Scheduler] Resetting State");
                    currentExecution.ResetState(threadId);
                    //After resetting, this is a good time to clean house
                    GC.Collect();
                }

                //De-activate the random object instance for this cycle. Continued use will force-crash the test.
                random.Dispose();
            }
コード例 #2
0
ファイル: ConnectViewModel.cs プロジェクト: zhdwwf/QM
        public void Connect()
        {
            this.Info         = "尝试连接,请稍候";
            this.NeedShowInfo = true;
            this.NotifyOfPropertyChange(() => this.NeedShowInfo);
            this.NotifyOfPropertyChange(() => this.Info);
            DispatcherHelper.DoEvents();

            if (Connection.Connect(this.Connection))
            {
                this.IsConnected  = true;
                this.NeedShowInfo = false;
                this.NotifyOfPropertyChange(() => this.NeedShowInfo);
                this.NotifyOfPropertyChange(() => this.IsConnected);
            }
            else
            {
                this.Info         = "连接失败,请检查";
                this.NeedShowInfo = true;
                this.NotifyOfPropertyChange(() => this.Info);
                this.NotifyOfPropertyChange(() => this.NeedShowInfo);

                DispatcherHelper.DoEvents();
                Thread.Sleep(2000);

                this.NeedShowInfo = false;
                this.NotifyOfPropertyChange(() => this.NeedShowInfo);
            }
        }
コード例 #3
0
            public void DoWork(StabilityTestDefinition metadata, int threadId)
            {
                int              iteration        = 0;
                DateTime         startTime        = DateTime.Now;
                DateTime         endTime          = startTime.Add(metadata.ExecutionTime);
                ExecutionContext executionContext = new ExecutionContext(metadata.ExecutionContext);

                executionContext.ResetState(threadId);

                //Add a stress trace listener so we can capture traces from test and Fail events
                Trace.Listeners.Add(new TraceManager(threadId));

                //make sure that exceptions are not caught by the dispatcher
                Dispatcher.CurrentDispatcher.UnhandledExceptionFilter += delegate(object sender, DispatcherUnhandledExceptionFilterEventArgs e) { e.RequestCatch = false; };
                while (DateTime.Now < endTime)
                {
                    Trace.WriteLine("[Scheduler] Starting Iteration:" + iteration);
                    Trace.WriteLine(String.Format("[Scheduler] StartTime: {0}, Current Time: {1} End Time: {2} ", startTime, DateTime.Now, endTime));

                    //Set up the iteration's randomness
                    DeterministicRandom random = new DeterministicRandom(metadata.RandomSeed, threadId, iteration);
                    DoNextActionSequence(random, executionContext, threadId);

                    Trace.WriteLine("[Scheduler] Pushing Frame onto Dispatcher");
                    DispatcherHelper.DoEvents((int)idleDuration.TotalMilliseconds, DispatcherPriority.Background);

                    Trace.WriteLine("[Scheduler] Dispatcher queue has been executed.");

                    //Visual Space for Logging readability
                    Trace.WriteLine("");
                    Trace.WriteLine("");
                    iteration++;
                }
                Trace.WriteLine(String.Format("[Scheduler] Test is ending at {0}, after running for {1}.", endTime, metadata.ExecutionTime));
            }
コード例 #4
0
        public void Send()
        {
            Task.Factory.StartNew(() => {
                this.IsBusy   = true;
                this.BusyText = "正在发送催款留言...";
                this.NotifyOfPropertyChange(() => this.IsBusy);
                this.NotifyOfPropertyChange(() => this.BusyText);

                foreach (var o in this.Orders.Where(oo => !oo.IsRemindered))
                {
                    Task.Factory.StartNew(async() => {
                        await this.Send(o);
                    }, TaskCreationOptions.AttachedToParent)
                    .ContinueWith(t => {
                        t.Dispose();
                    }, TaskContinuationOptions.AttachedToParent);
                }

                DispatcherHelper.DoEvents();
            }).ContinueWith(t => {
                this.IsBusy = false;
                this.NotifyOfPropertyChange(() => this.IsBusy);
                this.NotifyOfPropertyChange(() => this.BusyText);
                t.Dispose();
            })
            .ContinueWith(t => {
                this.SyncMsg(false);
            });
        }
コード例 #5
0
        public void SyncMsg(bool all = true)
        {
            Task.Factory.StartNew(() => {
                this.IsBusy   = true;
                this.BusyText = "正在同步订单留言...";
                this.NotifyOfPropertyChange(() => this.IsBusy);
                this.NotifyOfPropertyChange(() => this.BusyText);

                DispatcherHelper.DoEvents();
                var willSyncOrders = this.Orders as IEnumerable <ReminderOrder>;
                if (!all)
                {
                    willSyncOrders = this.Orders.Where(o => !o.IsRemindered);
                }
                foreach (var o in willSyncOrders)
                {
                    Task.Factory.StartNew(() => {
                        this.Sync(o);
                    }, TaskCreationOptions.AttachedToParent)
                    .ContinueWith(t => {
                        t.Dispose();
                    }, TaskContinuationOptions.AttachedToParent);
                }
            }).ContinueWith(t => {
                this.IsBusy = false;
                this.NotifyOfPropertyChange(() => this.IsBusy);
                this.NotifyOfPropertyChange(() => this.BusyText);
                this.Orders.Refresh();
                t.Dispose();
            });
        }
コード例 #6
0
 void DisableControls()
 {
     radioTableDataSource.IsEnabled = false;
     radioOlapCube.IsEnabled        = false;
     btnGenerateTableData.IsEnabled = false;
     DispatcherHelper.DoEvents();
 }
コード例 #7
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            processThread = new Thread(() => {
                Dispatcher.Invoke(new Action(() => {
                    for (int i = 0; i < 30; i++)
                    {
                        Thread.Sleep(100);
                        DispatcherHelper.DoEvents();
                    }

                    //GetAllFilesNum(Environment.CurrentDirectory + @"\" + _foldName) +
                    _allNums = GetAllFilesNum(Environment.CurrentDirectory);

                    gunBar.Maximum = _allNums;
                    gunBar.Value   = 0;

                    HuiGun();

                    gunBar.Value   = _allNums;
                    valueText.Text = "100%";
                    DispatcherHelper.DoEvents();
                    Thread.Sleep(200);


                    CallKTV();
                }));
            });
            processThread.Start();
        }
コード例 #8
0
ファイル: WindowUtil.cs プロジェクト: dotnet/wpf-test
        internal static Window CreateWindow(bool isTransparent)
        {
            Window window;

            if (BrowserInteropHelper.IsBrowserHosted)
            {
                window = Application.Current.MainWindow;
            }
            else
            {
                GlobalLog.LogEvidence("Creating a Window");
                Window winsw = new Window();
                window = winsw;

                if (isTransparent)
                {
                    GlobalLog.LogEvidence("Setting Window to Allow Transparency");
                    window.WindowStyle        = WindowStyle.None;
                    window.AllowsTransparency = isTransparent;
                }

                GlobalLog.LogEvidence("Showing the Window");
                window.Show();
                DispatcherHelper.DoEvents(0, DispatcherPriority.Input);
            }

            return(window);
        }
コード例 #9
0
ファイル: UIAutomationModule.cs プロジェクト: dotnet/wpf-test
 /// <summary>
 /// Moves mouse to the centre of the UIElement's bounding box, then clicks
 /// left mouse button at this centre point.
 /// </summary>
 /// <param name="element">Control to click</param>
 public static void MoveToCenterAndClickElement(UIElement element)
 {
     MoveToCenter(element);
     MTI.Input.SendMouseInput(0, 0, 0, MTI.SendMouseInputFlags.LeftDown);
     MTI.Input.SendMouseInput(0, 0, 0, MTI.SendMouseInputFlags.LeftUp);
     DispatcherHelper.DoEvents();
 }
コード例 #10
0
        private void InvokeThreadInNewAppDomain()
        {
            Thread t = new Thread(delegate()
            {
                AppDomainSetup ads  = new AppDomainSetup();
                ads.ApplicationBase = System.Environment.CurrentDirectory;

                AppDomain a = AppDomain.CreateDomain("Temporary Domain", null, ads);

                CustomMarshalByRefObject worker = (CustomMarshalByRefObject)a.CreateInstanceAndUnwrap(typeof(CustomMarshalByRefObject).Assembly.FullName, typeof(CustomMarshalByRefObject).FullName);

                // Show a window with button.
                worker.ShowWindow();

                Trace.WriteLine("[ShowWindowInNewAppDomainAction]: Unloading AppDomain...");

                // leave the new appdomain for 5 second.
                DispatcherHelper.DoEvents(5000);

                // Unload AppDomain
                AppDomain.Unload(a);
            });

            t.SetApartmentState(ApartmentState.STA);
            t.Name = " temporary thread";
            t.Start();
            t.Join(2000);
        }
コード例 #11
0
        public void Shipment()
        {
            //var accs = AccountHelper.LoadAccounts();
            this.IsBusy = true;
            this.NotifyOfPropertyChange(() => this.IsBusy);

            Task.Factory.StartNew(() => {
                foreach (var item in this.Items)
                {
                    this.CurrItem = item;
                    this.NotifyOfPropertyChange(() => this.CurrItem);
                    DispatcherHelper.DoEvents();

                    //var acc = accs.FirstOrDefault(a => a.User.Equals(item.Account, System.StringComparison.OrdinalIgnoreCase));
                    var acc = AccountHelper.GetAccount(item.Account);
                    if (acc == null)
                    {
                        continue;
                    }

                    Shipment(item, acc);
                }
            }).ContinueWith((o) => {
                this.WriteToDb(this.Items);

                this.IsBusy = false;
                this.NotifyOfPropertyChange(() => this.IsBusy);
            }, TaskContinuationOptions.None);
        }
コード例 #12
0
        private void ExecuteSearchCommand()
        {
            if (IgnoreSearch)
            {
                return;
            }

            IgnoreSearch = true;

            var delayer = new Delayer <object>(TimeSpan.FromMilliseconds(250));

            delayer.Action += (sender, args) =>
            {
                IgnoreSearch = false;
            };
            delayer.ResetAndTick();

            var delayer2 = new Delayer <object>(TimeSpan.FromMilliseconds(10));

            delayer2.Action += (sender, args) =>
            {
                Logger.Instance.Information("Search in the paste bar started.");
                Search();
                RaisePropertyChanged(nameof(NoSearchResult));
            };
            delayer2.ResetAndTick();

            if (CoreHelper.IsUnitTesting())
            {
                Task.Delay(50).Wait();
                DispatcherHelper.DoEvents();
            }
        }
コード例 #13
0
        void DoCloseTest(bool?allowClose, bool destroyOnClose, bool destroyed, Action <IDocument, bool> closeMethod)
        {
            Window.Show();
            DispatcherHelper.DoEvents();
            IDocumentManagerService service = null;
            bool      closeChecked          = false;
            bool      destroyCalled         = false;
            IDocument document = null;

            WindowedDocumentUIService windowedDocumentUIService = CreateService();

            Interaction.GetBehaviors(Window).Add(windowedDocumentUIService);
            service = windowedDocumentUIService;
            TestDocumentContent viewModel = new TestDocumentContent(() => {
                closeChecked = true;
                return(allowClose != null && allowClose.Value);
            }, () => {
                destroyCalled = true;
            });

            document = service.CreateDocument("EmptyView", viewModel);
            document.Show();
            DispatcherHelper.DoEvents();

            document.DestroyOnClose = destroyOnClose;
            closeMethod(document, allowClose == null);
            Assert.AreEqual(allowClose != null, closeChecked);
            Assert.AreEqual(destroyed, destroyCalled);
            Assert.AreEqual(!destroyed, service.Documents.Contains(document));
        }
コード例 #14
0
ファイル: UIAutomationModule.cs プロジェクト: dotnet/wpf-test
        /// <summary>
        /// Move mouse to the center of this UIElement.
        /// </summary>
        public static void MoveToCenter(UIElement element)
        {
            Point center = GetElementCenter(element);

            MoveTo(center);
            DispatcherHelper.DoEvents();
        }
コード例 #15
0
        public void T718930()
        {
            var bt = new Button();
            var cb = new System.Windows.Input.CommandBinding()
            {
                Command = System.Windows.Input.ApplicationCommands.Open
            };
            int exCount  = 0;
            int canCount = 0;

            cb.Executed   += (d, e) => { exCount++; };
            cb.CanExecute += (d, e) => { canCount++; e.CanExecute = true; };
            bt.CommandBindings.Add(cb);

            var bt1 = new Button();
            var etc = new EventToCommand()
            {
                EventName     = "Loaded",
                Command       = System.Windows.Input.ApplicationCommands.Open,
                CommandTarget = bt
            };

            Interaction.GetBehaviors(bt1).Add(etc);

            var root = new StackPanel();

            root.Children.Add(bt);
            root.Children.Add(bt1);
            Window.Content = root;
            Window.Show();
            DispatcherHelper.DoEvents();
            Assert.AreEqual(1, exCount);
            Assert.AreEqual(2, canCount);
        }
コード例 #16
0
        public void ClosingDocumentOnWindowClosingShouldntThrow()
        {
            Window.Show();
            DispatcherHelper.DoEvents();
            BindingTestClass          testClass = new BindingTestClass();
            WindowedDocumentUIService service   = CreateService();

            Interaction.GetBehaviors(Window).Add(service);
            IDocumentManagerService iService = service;

            IDocument document = null;

            WindowedDocumentUIService.WindowDocument typedDocument = null;
            var content = new TestDocumentContent();

            document      = iService.CreateDocument("View1", content);
            typedDocument = (WindowedDocumentUIService.WindowDocument)document;
            document.Show();
            DispatcherHelper.DoEvents();

            Window window = typedDocument.Window.RealWindow;

            content.onClose = () => document.Close();
            window.Close();
            DispatcherHelper.DoEvents();
        }
コード例 #17
0
ファイル: UIAutomationModule.cs プロジェクト: dotnet/wpf-test
 /// <summary>
 /// Press key.
 /// </summary>
 /// <param name="keyToPress"></param>
 public static void PressKey(Key keyToPress)
 {
     // Click on key (press, then release) once
     MTI.Input.SendKeyboardInput(keyToPress, true);
     MTI.Input.SendKeyboardInput(keyToPress, false);
     DispatcherHelper.DoEvents();
 }
コード例 #18
0
ファイル: UIAutomationModule.cs プロジェクト: dotnet/wpf-test
 /// <summary>
 /// Perform a Ctrl+'Key' operation.
 /// </summary>
 public static void Ctrl(Key key)
 {
     MTI.Input.SendKeyboardInput(Key.LeftCtrl, true);
     PressKey(key);
     MTI.Input.SendKeyboardInput(Key.LeftCtrl, false);
     DispatcherHelper.DoEvents();
 }
コード例 #19
0
        public void DispatcherServiceTest()
        {
            TestVM      vm      = new TestVM();
            UserControl control = new UserControl()
            {
                DataContext = vm
            };
            DispatcherService service = new DispatcherService();

            Interactivity.Interaction.GetBehaviors(control).Add(service);
            Window.Content = control;
            EnqueueShowWindow();
            EnqueueCallback(() => {
                Assert.IsFalse(vm.IsProgress);
                vm.Calculate();
                Assert.IsTrue(vm.IsProgress);
            });
            EnqueueWait(() => vm.Task.IsCompleted);
            EnqueueWindowUpdateLayout();
            EnqueueCallback(() => {
                DispatcherHelper.DoEvents();
                Assert.IsFalse(vm.IsProgress);
                Assert.IsTrue(vm.IsCompleted);
            });
            EnqueueTestComplete();
        }
コード例 #20
0
        //private List<OrderMessageEx> DealMessage(IEnumerable<OrderMessage> msgs) {
        //    if (msgs == null || msgs.Count() == 0)
        //        return new List<OrderMessageEx>();

        //    var mes = msgs.Select(m => {
        //        var me = new OrderMessageEx();
        //        //DynamicCopy.CopyProperties(m, me);
        //        DynamicCopy.CopyTo(m, me);
        //        return me;
        //    }).ToList();

        //    var f = mes.First().Sender;
        //    mes.ForEach(m => {
        //        m.Left = m.Sender.Equals(f);
        //    });

        //    return mes;
        //}

        public async Task Sync()
        {
            this.IsBusy   = true;
            this.BusyText = "正在同步订单留言...";
            this.NotifyOfPropertyChange(() => this.IsBusy);
            this.NotifyOfPropertyChange(() => this.BusyText);

            DispatcherHelper.DoEvents();

            var msgs = await MessageSync.SyncByOrderNO(this.OrderNO, this.Account);

            var msgs1 = msgs.Select(m => new OrderMessage {
                ID       = m.ID,
                Content  = m.Content,
                OrderNO  = this.OrderNO,
                Sender   = m.Sender,
                CreateOn = m.CreateOn
            }).ToList();

            //this.Msgs = this.DealMessage(msgs1);

            this.NotifyOfPropertyChange("Msgs");

            //if (this.Msgs != null && this.Msgs.Count > 0)
            if (msgs1 != null && msgs1.Count > 0)
            {
                this.Order.Messages = msgs1;
                this.Build(this.Order);
                this.OrderBiz.SaveOrderMessage(msgs1);
            }
            this.IsBusy = false;
            this.NotifyOfPropertyChange(() => this.IsBusy);
            this.NotifyOfPropertyChange(() => this.BusyText);
        }
コード例 #21
0
        public void SetResultWindow()
        {
            UIWindowRegion service = new UIWindowRegion()
            {
                RegionName = "region"
            };

            ModuleManager.DefaultImplementation.GetRegionImplementation("region").RegisterUIRegion(service);
            var serviceHelper = InjectionTestHelper.CreateServiceHelper(service);

            object vm1 = null;
            object vm2 = null;

            Manager.Register("region", new Module("1", () => vm1 = new object()));
            Manager.Register("region", new Module("2", () => vm2 = new object()));

            var t1 = WindowManager.Show("region", "1");
            var t2 = WindowManager.Show("region", "2");

            DispatcherHelper.DoEvents();

            WindowManager.Close("region", "1", MessageBoxResult.OK);
            DispatcherHelper.DoEvents();
            Assert.AreEqual(MessageBoxResult.OK, t1.Result.Result);
            Assert.AreEqual(vm1, t1.Result.ViewModel);

            WindowManager.Close("region", "2", MessageBoxResult.Cancel);
            DispatcherHelper.DoEvents();
            Assert.AreEqual(MessageBoxResult.Cancel, t2.Result.Result);
            Assert.AreEqual(vm2, t2.Result.ViewModel);

            serviceHelper.Dispose();
            Manager.Clear("region");
        }
コード例 #22
0
 private void ShowValue()
 {
     _nums++;
     gunBar.Value   = _nums;
     valueText.Text = (_nums / (float)_allNums * 100.0).ToString("#0.00") + "%";
     DispatcherHelper.DoEvents();
 }
コード例 #23
0
        public void Search(OrderSearchCondition cond)
        {
            Task.Factory.StartNew(() => {
                this.IsBusy = true;
                this.NotifyOfPropertyChange(() => this.IsBusy);
                DispatcherHelper.DoEvents();

                cond.Pager.Page         = this.PaginationVM.CurrPage - 1;
                cond.Pager.PageSize     = this.PaginationVM.PageSize;
                var results             = this.OrderBiz.Search(cond);
                this.PaginationVM.Total = cond.Pager.Count;

                this.QueryResult = new BindableCollection <Order>(results);

                this.NotifyOfPropertyChange("QueryResult");
                if (this.QueryResult.Count > 0)
                {
                    this.CurrOrder = this.QueryResult.First();
                }
                else
                {
                    this.CurrOrder = null;
                }

                this.NotifyOfPropertyChange(() => this.CurrOrder);
                this.IsBusy = false;
                this.NotifyOfPropertyChange(() => this.IsBusy);
            });
        }
コード例 #24
0
        private void TextDialogWithTimer_Click(object sender, RoutedEventArgs e)
        {
            TextDialogWithTimer dialog = new TextDialogWithTimer();

            HandyControl.Controls.Dialog.Show(dialog);
            // Customized
            int count      = 200;
            int totalCount = 100 * count;

            for (int i = 1; i <= totalCount; i++)
            {
                dialog.vm.CurrentValue = i / count;
                dialog.vm.ShowText     = "Current value: " + dialog.vm.CurrentValue;
                if (dialog.vm.CurrentValue == 100)
                {
                    dialog.vm.ShowText = "Finished";
                }
                if (dialog.IsPaused)
                {
                    HandyControl.Controls.MessageBox.Show("TextDialogWithTimer is paused.\n" +
                                                          "Current value is" + dialog.vm.CurrentValue);
                    break;
                }
                DispatcherHelper.DoEvents();
            }
        }
コード例 #25
0
        void CommandAttribute_ViewModelTestCore(CommandAttributeViewModelBaseCounters viewModel, Expression <Action> methodWithCanExecuteExpression, Expression <Action> methodWithCustomCanExecuteExpression)
        {
            var button = new Button()
            {
                DataContext = viewModel
            };

            button.SetBinding(Button.CommandProperty, new Binding("SimpleCommand"));
            button.Command.Execute(null);
            Assert.AreEqual(1, viewModel.SimpleMethodCallCount);

            button.SetBinding(Button.CommandProperty, new Binding("NoAttributeCommand"));
            Assert.IsNull(button.Command);

            button.SetBinding(Button.CommandProperty, new Binding("MethodWithCommand"));
            button.Command.Execute(null);
            Assert.AreEqual(1, viewModel.MethodWithCommandCallCount);

            button.SetBinding(Button.CommandProperty, new Binding("MyCommand"));
            button.Command.Execute(null);
            Assert.AreEqual(1, viewModel.CustomNameCommandCallCount);

            button.SetBinding(Button.CommandProperty, new Binding("BaseClassCommand"));
            button.Command.Execute(null);
            Assert.AreEqual(1, viewModel.BaseClassCommandCallCount);
            Assert.IsTrue(button.IsEnabled);

            button.SetBinding(Button.CommandProperty, new Binding("MethodWithCanExecuteCommand"));
            Assert.IsFalse(button.IsEnabled);
            viewModel.MethodWithCanExecuteCanExcute = true;
            DispatcherHelper.DoEvents();
            Assert.IsFalse(button.IsEnabled);
            viewModel.RaiseCanExecuteChanged(methodWithCanExecuteExpression);

            Assert.IsFalse(button.IsEnabled);
            DispatcherHelper.DoEvents();
            Assert.IsTrue(button.IsEnabled);

            button.SetBinding(Button.CommandProperty, new Binding("MethodWithReturnTypeCommand"));
            button.Command.Execute(null);
            Assert.AreEqual(1, viewModel.MethodWithReturnTypeCallCount);

            button.SetBinding(Button.CommandProperty, new Binding("MethodWithParameterCommand"));
            button.Command.Execute(9);
            Assert.AreEqual(1, viewModel.MethodWithParameterCallCount);
            Assert.AreEqual(9, viewModel.MethodWithParameterLastParameter);
            Assert.IsTrue(button.Command.CanExecute(9));
            Assert.IsFalse(button.Command.CanExecute(13));
            button.Command.Execute("10");
            Assert.AreEqual(2, viewModel.MethodWithParameterCallCount);
            Assert.AreEqual(10, viewModel.MethodWithParameterLastParameter);

            button.SetBinding(Button.CommandProperty, new Binding("MethodWithCustomCanExecuteCommand"));
            Assert.IsFalse(button.IsEnabled);
            viewModel.MethodWithCustomCanExecuteCanExcute = true;
            Assert.IsFalse(button.IsEnabled);
            viewModel.RaiseCanExecuteChanged(methodWithCustomCanExecuteExpression);
            Assert.IsTrue(button.IsEnabled);
        }
コード例 #26
0
ファイル: MainWindow.xaml.cs プロジェクト: gradusina/FA2
        //public void GetWorkerStat()
        //{
        //    var bw = new BackgroundWorker { WorkerReportsProgress = true };

        //    DataRow statDataRow = null;
        //    DataRow plannedClockRateDataRow = null;

        //    FillWorkerStat();

        //    bw.DoWork += (obj, ea) => Dispatcher.BeginInvoke(new ThreadStart(delegate
        //    {
        //        statDataRow = _ttc.GetWorkerStatForCurrentYearAndMonth(AdministrationClass.CurrentWorkerId);
        //        plannedClockRateDataRow = _ttc.GetPlannedClockRateForCurrentYearAndMonth();

        //    }));

        //    bw.RunWorkerCompleted += (obj, ea) => Dispatcher.BeginInvoke(new ThreadStart(delegate
        //    {
        //        FillWorkerStat(statDataRow);

        //        if (plannedClockRateDataRow != null)
        //            PlannedClockRateLabel.Content = "Норма часов: " + plannedClockRateDataRow["Standart40Time"];
        //        else
        //            PlannedClockRateLabel.Content = "Норма часов: --";
        //    }));

        //    bw.RunWorkerAsync();
        //}
        private void FileStorageButton_Click(object sender, RoutedEventArgs e)
        {
            var fileExplorer = new FileExplorer((int)AdministrationClass.CurrentModuleId, !_workshopMode);

            ShowToolsGrid(fileExplorer, "Файлы");
            HideWaitAnnimation();
            DispatcherHelper.DoEvents();
        }
コード例 #27
0
 public static void UpdateLayout(this UIElement element, bool waitForIdleDispatcher)
 {
     element.UpdateLayout();
     if (waitForIdleDispatcher)
     {
         DispatcherHelper.DoEvents(DispatcherPriority.ApplicationIdle);
     }
 }
コード例 #28
0
 private void WaitEndpointDisable(int timeout)
 {
     for (int i = 0; i < timeout && Endpoint.IsDisabled == false; i += 25)
     {
         System.Threading.Thread.Sleep(25);
         DispatcherHelper.DoEvents();
     }
 }
コード例 #29
0
        /// <summary>
        /// Simple Visual Comparison.
        /// </summary>
        /// <returns></returns>
        public bool CompareImage()
        {
            DispatcherHelper.DoEvents(1000);
            MasterImageComparer comparer = new MasterImageComparer(index);

            comparer.ToleranceSettings = ImageComparisonSettings.CreateCustomTolerance(DefaultTolerance());
            return(comparer.Compare(HWND));
        }
コード例 #30
0
        public static void Delay(uint ms)
        {
            uint start = GetTickCount();

            while (GetTickCount() - start < ms)
            {
                DispatcherHelper.DoEvents();
            }
        }