// 使用者巡覽至這個頁面時執行。 protected async override void OnNavigatedTo(NavigationEventArgs e) { #if R23 this.chkIsWindowsAlarm.Visibility = Visibility; #endif SecureDBContext db = new SecureDBContext();// DB.GetDB(); try { EntityQuery<tblSysParameter> qry = db.GetTblSysParameterQuery().Where(n => n.VariableName == "TimeoutReturnPage"); var result = await db.LoadAsync(qry); tblSysParameter sysparam = result.FirstOrDefault(); if (sysparam != null) { tmr.Interval = TimeSpan.FromMinutes(double.Parse(sysparam.VariableValue)); tmr.Tick += tmr_Tick; tmr.Start(); } // Microsoft.Expression.Interactivity.Layout.FluidMoveBehavior bev = new Microsoft.Expression.Interactivity.Layout.FluidMoveBehavior(); EntityQuery<vwUserMenuAllow> q = db.GetVwUserMenuAllowQuery().Where(n => n.UserID == Util.GetICommon().GetUserID() && n.IsAllow == true); var UserMenus = await db.LoadAsync(q); var res = from n in UserMenus group n by n.GroupName into g select new UserGroupMenu() { GroupMenu = g.Key, Menus = g.OrderBy(k => k.MenuOrder).ToList() }; this.acdMenu.ItemsSource = res; #if R23 this.frameMain.Navigate(new Uri("/Forms/R23/Monitor.xaml", UriKind.Relative)); #else this.frameMain.Navigate(new Uri("/Forms/R23/Monitor.xaml", UriKind.Relative)); // this.frameMain.Navigate(new Uri("/Forms/Monitor.xaml", UriKind.Relative)); #endif } catch { ;} txtTitle.DataContext = new tblMenu() { MenuName = "門禁監控" }; this.acdMenu.SelectedIndex =1; client = new MyClient("CustomBinding_ISecureService",true); client.OnRegistEvent +=async (s) => { await HookAlarmEvent(); client.OnAlarm += client_OnAlarm; }; this.txtCCTVCnt1.Text = this.NavigationContext.QueryString["username"]; // await client.RegistAndGetKey(); //client.SecureService.HookAlarmEventCompleted += (s, a) => // { // }; }