private void CtlBuyerNoteViewer_Loaded(object sender, RoutedEventArgs e) { base.Loaded -= CtlBuyerNoteViewer_Loaded; _dcaller = new DelayCaller(LoadBuyerNotes, 500, true); pager.EvPageNumberChanged += pager_EvPageNumberChanged; btnReset.xPerformClick(); }
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); }
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); } }
public CtlPager() { this.InitializeComponent(); this._dcaller = new DelayCaller(() => { this.OnInputPageNumber(); }, 500, true); }
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); }
//放回池中 public void addToPool(DelayCaller caller) { //使用这个停止延迟效率会高吗? caller.StopAllCoroutines(); caller.enabled = false; caller.ID = "0"; caller.clearTmp(); pool.Add(caller); }
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); }
private void CtlBuyerMemo_Loaded(object sender, RoutedEventArgs e) { Loaded -= CtlBuyerMemo_Loaded; InitUI(); DelayCaller.CallAfterDelayInUIThread(() => { LoadBuyerNote(Wnd.Desk.BuyerMainNick, Wnd.Desk.Seller); }, 1000); }
//当一个延迟自然结束 public void onFinish(DelayCaller caller) { if (dict.ContainsKey(caller.ID)) { dict.Remove(caller.ID); } addToPool(caller); updateTitle(); }
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); }
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); }
public static void xBrintTop(this Window wnd) { if (!wnd.Topmost) { wnd.Topmost = true; DelayCaller.CallAfterDelayInUIThread(() => { wnd.Topmost = false; wnd.Activate(); }, 500); } }
private void Desk_EvGetForeground(object sender, ChatDeskEventArgs e) { DispatcherEx.xInvoke(() => { ShowAssist(); DelayCaller foregroundTrackDelayCaller = _foregroundTrackDelayCaller; if (foregroundTrackDelayCaller != null) { foregroundTrackDelayCaller.CallAfterDelay(); } }); }
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); } }
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); }
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); } }
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); }
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(); } } } }
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); } } } }
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; }
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); }
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); } }
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(); } }
private HoverSelectInfo(TabControl parent) { this.Parent = parent; this.DelayCall = new DelayCaller(new Action(this.SelectTabItemIfHoverOverTime), 250, true); }
public static void CallOnceAfterDelayInUiThread(Action act, int delayMs) { DelayCaller.CallAfterDelayInUIThread(act, delayMs); }
public void DelayFocusEditor(int delayMs = 200) { DelayCaller.CallAfterDelay(new Action(FocusEditor), delayMs, false); }