/// <summary> /// 定时没有操作调到第一个页面 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timer_Elapsed(object sender, ElapsedEventArgs e) { this.Dispatcher.BeginInvoke(new Action(() => { try { //正在播放视频音频文件不做界面跳转 if (!AppConfigInfos.IsPlay && SystemInfo.GetLastInputTime() > 300000) { App.Current.Dispatcher.Invoke(new Action(() => { ModuleBaseEntry moduleBase = ModuleDispather.Instance.Modules.Find(p => p.ModuleNavigable.Index.ToString().Equals("0")); if (toolButtons.ContainsKey(moduleBase.ModuleCode)) { ButtonClick(toolButtons[moduleBase.ModuleCode], moduleBase, false); } })); } } catch (Exception ex) { LogHelper.Instance.WirteErrorMsg(ex.Message); } })); }
/// <summary> /// 模块通知显示自己 /// </summary> /// <param name="sender"></param> private void item_ShowViewNotice(object sender) { App.Current.Dispatcher.Invoke(new Action(() => { ModuleBaseEntry moduleBase = sender as ModuleBaseEntry; if (toolButtons.ContainsKey(moduleBase.ModuleCode)) { ButtonClick(toolButtons[moduleBase.ModuleCode], moduleBase, false); } })); }
/// <summary> /// 按钮切换内容 /// </summary> /// <param name="button"></param> /// <param name="item"></param> /// <param name="validate">是否需要验证</param> private void ButtonClick(SelectButton button, ModuleBaseEntry item, bool validate = true) { if (button.IsSelect) { return; } //验证权限 if (!string.IsNullOrEmpty(item.ModuleNavigable.PermissionCode) && validate) { LoginWindow loginWindow = WindowsHelper.ShowDialogWindow <LoginWindow>(this, item.ModuleNavigable.PermissionCode, "1"); if (loginWindow.MessageBoxResult != MessageBoxResult.OK) { return; } } frameContent.Content = null; item.ShowModelView(frameContent, this); ChangeSelectButton(button); }