コード例 #1
0
 private void CtlBuyerNoteViewer_Loaded(object sender, RoutedEventArgs e)
 {
     base.Loaded -= CtlBuyerNoteViewer_Loaded;
     _dcaller     = new DelayCaller(LoadBuyerNotes, 500, true);
     pager.EvPageNumberChanged += pager_EvPageNumberChanged;
     btnReset.xPerformClick();
 }
コード例 #2
0
ファイル: DelayManager.cs プロジェクト: ghrguse/ss
    public string addDelay(float t, DelegateEnums.NoneParam fn_None, string ID = "")
    {
        if (ID == "")
        {
            autoID++;
            ID = autoID.ToString();
        }
        else
        {
            if (dict.ContainsKey(ID))
            {
                stopDelay(ID);
            }
        }

        DelayCaller caller = getCaller();

        caller.ID = ID;
        caller.addDelay(t, fn_None);

        dict.Add(ID, caller);

        updateTitle();
        return(ID);
    }
コード例 #3
0
 private void imgMain_MouseEnter(object sender, MouseEventArgs e)
 {
     this._isMouseInsideImageControl = true;
     if (!string.IsNullOrEmpty(this._partShortcutImageFn) && this.Wnd != null)
     {
         DelayCaller.CallAfterDelayInUIThread(() => {
             if (this._isMouseInsideImageControl)
             {
                 this._actUseImage(this._partShortcutImageFn, (bitmapImage) =>
                 {
                     if (bitmapImage != null)
                     {
                         try
                         {
                             this.Wnd.BringTop();
                             Rect rect = this.ZoomRect(bitmapImage);
                             this.Wnd.imgBig.SetValue(Canvas.LeftProperty, rect.X);
                             this.Wnd.imgBig.SetValue(Canvas.TopProperty, rect.Y);
                             this.Wnd.imgBig.Width  = rect.Width;
                             this.Wnd.imgBig.Height = rect.Height;
                             this.Wnd.imgBig.Source = bitmapImage;
                         }
                         catch (Exception ex)
                         {
                             Log.Exception(ex);
                             MsgBox.ShowErrTip(ex.Message, null);
                         }
                     }
                 });
             }
         }, 300);
     }
 }
コード例 #4
0
 public CtlPager()
 {
     this.InitializeComponent();
     this._dcaller = new DelayCaller(() =>
     {
         this.OnInputPageNumber();
     }, 500, true);
 }
コード例 #5
0
 public ViewData(Window wnd)
 {
     this._wnd       = wnd;
     wnd.DataContext = this;
     System.Windows.Controls.Validation.AddErrorHandler(this._wnd, new EventHandler <ValidationErrorEventArgs>(this.OnValidateError));
     this.InitErrorTemplate();
     this._validateCaller = new DelayCaller(new Action(this.TextChangedValidate), 400, true);
 }
コード例 #6
0
ファイル: DelayManager.cs プロジェクト: ghrguse/ss
 //放回池中
 public void addToPool(DelayCaller caller)
 {
     //使用这个停止延迟效率会高吗?
     caller.StopAllCoroutines();
     caller.enabled = false;
     caller.ID      = "0";
     caller.clearTmp();
     pool.Add(caller);
 }
コード例 #7
0
 public CtlAddRemoveable(string title = "")
 {
     InitializeComponent();
     _title                  = title;
     Height                  = _lineHeight;
     rtb.TextChanged        += Rtb_TextChanged;
     rtb.EvCaretMoveByHuman += Rtb_EvCaretMoveByHuman;
     _delayValidater         = new DelayCaller(new Action(ValidateOnTextChanged), 500, true);
 }
コード例 #8
0
 private void CtlBuyerMemo_Loaded(object sender, RoutedEventArgs e)
 {
     Loaded -= CtlBuyerMemo_Loaded;
     InitUI();
     DelayCaller.CallAfterDelayInUIThread(() =>
     {
         LoadBuyerNote(Wnd.Desk.BuyerMainNick, Wnd.Desk.Seller);
     }, 1000);
 }
コード例 #9
0
ファイル: DelayManager.cs プロジェクト: ghrguse/ss
    //当一个延迟自然结束
    public void onFinish(DelayCaller caller)
    {
        if (dict.ContainsKey(caller.ID))
        {
            dict.Remove(caller.ID);
        }
        addToPool(caller);

        updateTitle();
    }
コード例 #10
0
 public void ShowTip(string msg, int showSeconds = 5)
 {
     if (_bottomPanel.tblkTip.Visibility == Visibility.Collapsed)
     {
         _bottomPanel.tblkTip.Visibility = Visibility.Visible;
     }
     _bottomPanel.tblkTip.Text = msg;
     DelayCaller.CallAfterDelayInUIThread(() =>
     {
         _bottomPanel.tblkTip.Visibility = Visibility.Collapsed;
     }, showSeconds * 1000);
 }
コード例 #11
0
 private void WndAssist_Loaded(object sender, RoutedEventArgs e)
 {
     Loaded -= WndAssist_Loaded;
     AddToCache(this);
     _foregroundTrackDelayCaller = new DelayCaller(() =>
     {
         if (Desk.IsMostlyVisible(false))
         {
             Track(false, false);
         }
     }, 100, true);
 }
コード例 #12
0
 public static void xBrintTop(this Window wnd)
 {
     if (!wnd.Topmost)
     {
         wnd.Topmost = true;
         DelayCaller.CallAfterDelayInUIThread(() =>
         {
             wnd.Topmost = false;
             wnd.Activate();
         }, 500);
     }
 }
コード例 #13
0
 private void Desk_EvGetForeground(object sender, ChatDeskEventArgs e)
 {
     DispatcherEx.xInvoke(() =>
     {
         ShowAssist();
         DelayCaller foregroundTrackDelayCaller = _foregroundTrackDelayCaller;
         if (foregroundTrackDelayCaller != null)
         {
             foregroundTrackDelayCaller.CallAfterDelay();
         }
     });
 }
コード例 #14
0
 private void tvMain_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if ((DateTime.Now - _doubleClickTime).TotalMilliseconds > 500.0)
     {
         DelayCaller.CallAfterDelayInUIThread(() => {
             if (!_isDoubleClick)
             {
                 SetTagInfoToEditor(true);
             }
             _isDoubleClick = false;
         }, SystemInformation.DoubleClickTime);
     }
 }
コード例 #15
0
 private void InitDelayCaller()
 {
     this._dcaller = new DelayCaller(() =>
     {
         if (this._hasUnhandledInput && Keyboard.FocusedElement == this)
         {
             this._hasUnhandledInput = false;
             if (!this._isImeProcessed || this.GetTextBeforeCaret(1) != " ")
             {
                 this.RaiseEvCaretMoveByHumanEvent();
             }
         }
     }, 100, true);
 }
コード例 #16
0
 private static void BringWndAssitOfTopDeskTopMostIfNeed()
 {
     try
     {
         if ((DateTime.Now - _preKeepMultiWndAssitZOrderRightIfNeedTime).TotalMilliseconds >= 100.0)
         {
             _preKeepMultiWndAssitZOrderRightIfNeedTime = DateTime.Now;
             TopWnd topWnd = null;
             var    vwset  = new List <WndAssist>();
             while (true)
             {
                 vwset = AssistBag.Where(k => k.IsVisible).ToList();
                 if (vwset.Count <= 1)
                 {
                     if (vwset.Count == 1)
                     {
                         var wnd = vwset.First();
                         if (wnd.Desk.GetVisiblePercent(true) == 0.0)
                         {
                             wnd.Hide();
                         }
                     }
                     break;
                 }
                 topWnd = GetTopMostAssistWindowHwnd(vwset);
                 if (topWnd == null || topWnd.TopAssistWnd == null || topWnd.TopDesk == null)
                 {
                     break;
                 }
                 if (topWnd.TopDesk.GetVisiblePercent(true) != 0.0)
                 {
                     if (((topWnd.TopAssistWnd != null) ? topWnd.TopAssistWnd.Desk : null) != topWnd.TopDesk || topWnd.HasOtherWndAssitUptoTopDesk)
                     {
                         DelayCaller.CallAfterDelayInUIThread(() =>
                         {
                             BrindTopWndAssistAndDesk(topWnd);
                         }, 500);
                     }
                     break;
                 }
                 topWnd.TopAssistWnd.Hide();
             }
         }
     }
     catch (Exception ex)
     {
         Log.Exception(ex);
     }
 }
コード例 #17
0
 public void Init(TreeViewController controller, Func <TreeNode, bool> showFilter = null, Action <TreeViewItem, TreeNode> leafChildrenCreater = null, bool isReadOnly = false, bool isShowRoot = false, string targetNodeId = null, TreeNode showFrom = null, Func <bool> canDrag = null)
 {
     _ctl                 = controller;
     _showFilter          = showFilter;
     _leafChildrenCreater = leafChildrenCreater;
     _showFrom            = (showFrom ?? _ctl.DbAccessor.Root);
     _isReadOnly          = isReadOnly;
     _isShowRoot          = isShowRoot;
     _candrag             = canDrag;
     _treeUpdater         = new DelayCaller(() =>
     {
         LoadTreeViewData(null);
     }, 500, true);
     LoadTreeViewData(targetNodeId);
 }
コード例 #18
0
 private void CtlHoverableTextBlock_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (e.ChangedButton == MouseButton.Right)
     {
         RaiseRightClickEvent();
     }
     else
     {
         if (IsClickAndDoubleClickAllUse)
         {
             if (e.ClickCount == 1)
             {
                 DelayCaller.CallAfterDelayInUIThread(() =>
                 {
                     if (!_isDoubleClick)
                     {
                         RaiseClickEvent();
                     }
                     _isDoubleClick = false;
                 }, 300);
             }
             else
             {
                 if (e.ClickCount == 2)
                 {
                     _isDoubleClick = true;
                     e.Handled      = true;
                     RaiseDoubleClickEvent();
                 }
             }
         }
         else
         {
             if (e.ClickCount == 1)
             {
                 RaiseClickEvent();
             }
             else
             {
                 RaiseDoubleClickEvent();
             }
         }
     }
 }
コード例 #19
0
 private void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if ((DateTime.Now - this._doubleClickTime).TotalMilliseconds > 500.0)
     {
         this._isDoubleClick   = false;
         this._doubleClickTime = DateTime.Now;
         TreeView    tv  = sender as TreeView;
         CtlTreeView ctv = tv.xFindAncestor <CtlTreeView>();
         bool        isCatalog;
         if (ctv.IsPointInsideItem(false, out isCatalog))
         {
             if (!isCatalog)
             {
                 DelayCaller.CallAfterDelayInUIThread(() =>
                 {
                     var shortcut = ctv.ReadNodeFromSelectedItem() as ShortcutEntity;
                     this.SetOrSendShortcut(shortcut, false);
                 }, 80);
             }
         }
     }
 }
コード例 #20
0
        private void WndNotifyIcon_Loaded(object sender, RoutedEventArgs e)
        {
            base.Loaded -= WndNotifyIcon_Loaded;
            this.xMoveToWorkAreaCenter();
            this.xShowFirstTime();
            DelayCaller.CallAfterDelay(() =>
            {
                Visibility = Visibility.Collapsed;
            }, 2000, true);
            notifyIcon.Text = string.Format("{0}({1})", Params.AppName, Params.VersionStr);
            CreateHelpMenu();
            notifyIcon.StartBlink(base.FindResource("iconGray") as ImageSource);

            AppStartInitiator.Init();
            var hotMsg = HotKeyHelper.Init();

            if (!string.IsNullOrEmpty(hotMsg))
            {
                MsgBox.ShowErrTip(hotMsg, null);
            }
            notifyIcon.StopBlink();
            base.Visibility = Visibility.Collapsed;
        }
コード例 #21
0
        public void CloseCurrentBuyer()
        {
            var _prebuyer = Buyer;

            if (IsGroupChat.HasValue)
            {
                if (IsGroupChat.HasValue && IsGroupChat.Value)
                {
                    Automator.ClickGroupChatCloseBuyerButton();
                }
                else
                {
                    Automator.ClickSingleChatCloseBuyerButton();
                }
            }
            DelayCaller.CallAfterDelay(() =>
            {
                if (Buyer == _prebuyer && (Automator.IsGroupChatCloseButtonEnable() || Automator.IsSingleChatCloseButtonEnable()))
                {
                    CloseCurrentBuyer();
                }
            }, 500, false);
        }
コード例 #22
0
 private void OnMouseEnter()
 {
     try
     {
         this._isMouseInsideImageControl = true;
         this._mouseEnterTime            = DateTime.Now;
         if (this.imgGoods.Source != null && this.imgGoods.Source != WebImageHelper.ImgLoading && this.Wnd != null)
         {
             DelayCaller.CallAfterDelayInUIThread(() => {
                 if (this._isMouseInsideImageControl && this.Wnd.imgBig.Source == null)
                 {
                     this.Wnd.BringTop();
                     this.Wnd.imgBig.Width  = 300.0;
                     this.Wnd.imgBig.Height = 300.0;
                     Point point            = base.TranslatePoint(new Point(base.ActualWidth + 5.0, 0.0), this.Wnd);
                     if (point.Y + this.Wnd.imgBig.Height > SystemParameters.WorkArea.Height)
                     {
                         point.Y = SystemParameters.WorkArea.Height - this.Wnd.imgBig.Height - 5.0;
                     }
                     this.Wnd.imgBig.SetValue(Canvas.LeftProperty, point.X);
                     this.Wnd.imgBig.SetValue(Canvas.TopProperty, point.Y);
                     WebImageHelper.GetImageFromUrl(this._imgUrl, this.Wnd.imgBig, false);
                     DelayCaller.CallAfterDelayInUIThread(() => {
                         if (this._isMouseInsideImageControl && this._mouseEnterTime.xElapse().TotalSeconds > 9.0)
                         {
                             this.OnMouseLeave();
                         }
                     }, 10000);
                 }
             }, 200);
         }
     }
     catch (Exception e)
     {
         Log.Exception(e);
     }
 }
コード例 #23
0
        private async void btnExit_Click(object sender, EventArgs e)
        {
            DelayCaller.CallAfterDelay(() =>
            {
                if (System.Windows.Application.Current != null)
                {
                    System.Windows.Application.Current.Shutdown();
                }
            }, 5000, false);
            base.Visibility     = Visibility.Visible;
            tbkClose.Visibility = Visibility.Visible;
            this.xMoveToWorkAreaCenter();
            notifyIcon.StartBlink(base.FindResource("iconGray") as ImageSource);
            await Task.Run(() =>
            {
                AppCloseEnder.EndApp();
            });

            notifyIcon.StopBlink();
            if (System.Windows.Application.Current != null)
            {
                System.Windows.Application.Current.Shutdown();
            }
        }
コード例 #24
0
 private HoverSelectInfo(TabControl parent)
 {
     this.Parent    = parent;
     this.DelayCall = new DelayCaller(new Action(this.SelectTabItemIfHoverOverTime), 250, true);
 }
コード例 #25
0
 public static void CallOnceAfterDelayInUiThread(Action act, int delayMs)
 {
     DelayCaller.CallAfterDelayInUIThread(act, delayMs);
 }
コード例 #26
0
 public void DelayFocusEditor(int delayMs = 200)
 {
     DelayCaller.CallAfterDelay(new Action(FocusEditor), delayMs, false);
 }