private void Pop()
        {
            IEnumerable dataList;

            _serviceQueueContainer.Output(o =>
            {
                if (o.Items3 != null)
                {
                    return;
                }
                o.Items3 = CollectionViewSource.GetDefaultView(o.Items)
                           .Self(v =>
                {
                    v.Filter = d => d.SaftyGetProperty <bool, IVisibleLinerData>(line => line.Category == _selectedCategory);
                });
            }, out dataList);

            if (StaffingCalculatorData == null)
            {
                StaffingCalculatorData = CollectionViewSource.GetDefaultView(dataList);
            }
            else
            {
                UIThread.BeginInvoke(() => StaffingCalculatorData.Refresh());
            }
        }
Exemple #2
0
 private void BuildDocuments()
 {
     if (Campaigns == null || Campaigns.CurrentItem == null || _schedules == null)
     {
         return;
     }
     UIThread.BeginInvoke(() =>
     {
         _openedDocs = new Dictionary <IDocumentReference, IMetadataContainer>(_schedules.Count);
         RecentScheduleManager.Documents.BeginUpdate();
         RecentScheduleManager.Documents.Clear();
         foreach (var o in _schedules)
         {
             if (o.Campaign.Equals(Campaigns.CurrentItem) || ReferenceEquals(Campaigns.CurrentItem, Campaign.AllOptopn))
             {
                 _recentScheduleManager.Documents.Add(new DocumentReference
                 {
                     Name               = string.Format("{0:yyyy/MM/dd} - {1:MM/dd}", o.Start, o.End.AddDays(-1)),
                     Description        = o.Campaign.Name,
                     Tag                = o,
                     LastOpenedDateTime = o.Start,
                     ImageSourceLarge   = new System.Windows.Media.Imaging.BitmapImage(new Uri("/Resources/Images/Calendar32.png", UriKind.Relative))
                 });
             }
         }
         _recentScheduleManager.Documents.EndUpdate();
     });
 }
Exemple #3
0
 void Items_CurrentChanged(object sender, EventArgs e)
 {
     MarkCheckBox();
     if (EnableSelectedCache)
     {
         UIThread.BeginInvoke(() =>
         {
             ItemsSelected(_cache, true);
         });
         stopListAction = false;
     }
 }
        private void OnItemListOnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            UIThread.BeginInvoke(() =>
            {
                var lb = (ListBoxItem)(ItemList.ItemContainerGenerator.ContainerFromItem(ItemList.SelectedItem));
                if (lb == null)
                {
                    return;
                }

                lb.BringIntoView();
            }, DispatcherPriority.Input);
        }
 private void EstimateShift(object sender, ExecutedRoutedEventArgs e)
 {
     _estimateShiftThread = new Thread(() =>
     {
         var q = _staffingCalculatorService.BeginEstimation();
         NewF(q);
         var action = q.Output();
         UIThread.BeginInvoke(action);
         _estimateShiftThread.Abort();
     })
     {
         IsBackground = true
     }.Self(t => t.Start());
 }
Exemple #6
0
        /// <summary>
        /// 初始化
        /// </summary>
        protected override void OnInitialize()
        {
            CollectionView.CurrentChanging += OnCurrentChanging;

            UIThread.BeginInvoke(() =>
            {
                if (CollectionView.CurrentItem == null)
                {
                    CollectionView.MoveCurrentToFirst();
                }
            });

            base.OnInitialize();
        }
Exemple #7
0
        public void Run(IDictionary args)
        {
            _staffingCalculatorPresenter.SaftyInvoke(p => p.Deactivate());

            if (_staffingCalculatorPresenter == null)
            {
                args["service"] = this;

                _staffingCalculatorPresenter = _container.Resolve <IStaffingChartPresenter>(args);

                UIThread.BeginInvoke(() => View.SetModel(_contentView, _staffingCalculatorPresenter));
            }
            else
            {
                _staffingCalculatorPresenter.Activate();
            }
        }
Exemple #8
0
        private static void TriggerTypePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            FrameworkElement target = sender as FrameworkElement;

            UIThread.BeginInvoke(() =>
            {
                var validators = ValidationService.GetValidators(target);
                if (validators.Count == 0)
                {
                    return;
                }
                var triggerType = (TriggerType)args.NewValue;
                validators[0].CancelTriggerValidationEvent();
                if (triggerType == TriggerType.Trigger)
                {
                    validators[0].RegisterTriggerValidationEvent();
                }
            });
        }
Exemple #9
0
 protected override void OnParentMouseMove(object sender, MouseEventArgs e)
 {
     if (e.Source.IsNot <Rectangle>() && e.Source.IsNot <BlockGrid>())
     {
         return;
     }
     if (e.LeftButton == MouseButtonState.Pressed)
     {
         TraceCurrentMousePoint(e);
         MeasureDragingArea(_screenDataRowIndex);
         _isMouseMove = true;
         IsDraging    = true;
         InvalidateVisual();
     }
     if (IsDraging && e.LeftButton != MouseButtonState.Pressed)
     {
         UIThread.BeginInvoke(ResetMouseStatus);
     }
 }
 protected override void Invoke(object parameter)
 {
     UIThread.BeginInvoke(() => {
         if (Value != null)
         {
             BindablePropertyItem = Value;
         }
         else
         {
             if (DpProperty == null)
             {
                 BindablePropertyItem = AssociatedObject.GetType().GetProperty(Property).GetValue(AssociatedObject, null);
             }
             else
             {
                 BindablePropertyItem = AssociatedObject.GetValue(DpProperty);
             }
         }
     });
 }
        private static object CalendarCoerceValueCallback(DependencyObject d, object basevalue)
        {
            var dataList = basevalue as IEnumerable;

            if (PresentationFrameworkModule.IsInDesignMode || dataList == null)
            {
                return(basevalue);
            }

            var monthCalendar = d as MonthCalendar;

            if (monthCalendar == null)
            {
                return(basevalue);
            }

            UIThread.BeginInvoke(monthCalendar.Refresh);

            return(basevalue);
        }
Exemple #12
0
            public ListBoxMultiUpdatePropertyNamesBehavior(System.Windows.Controls.ListBox listBox)
            {
                this._listBox = listBox;


                //存储原先的SelectedItem
                _previousSelectedItem = listBox.SelectedItem;

                listBox.SelectionChanged += listBox_SelectionChanged;

                //UnLoad时候,释放存储的资源,否则内存会泄露
                UIThread.BeginInvoke(new Action(() =>
                {
                    var container = _listBox.FindAncestor <TabbedMdiContainer>();
                    if (container != null)
                    {
                        container.SelectedWindow.Unloaded += SelectedWindow_Unloaded;
                    }
                }), DispatcherPriority.Render);
            }
Exemple #13
0
        protected static void ValidPropertyPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            Validator validator = d as Validator;

            validator.SetSourceFromProperty();

            if (validator.HasSourceContext)
            {
                UIThread.BeginInvoke(() =>
                {
                    var isValid       = validator.IsValid;
                    validator.IsValid = validator.InnerValidateWithError();
                    if (!isValid && !validator.IsValid && !FrameworkElementService.GetIsFirstVisit(validator))
                    {
                        validator.GapValidate();
                    }
                }, DispatcherPriority.Normal);
            }
            else
            {
                validator.IsValid = true;
            }
            FrameworkElementService.SetIsFirstVisit(validator, false);
        }
Exemple #14
0
 public void BeginInvoke(Action methodToInvoke)
 {
     _thread.BeginInvoke(methodToInvoke);
 }