protected override void OnBackKeyPress(CancelEventArgs e) { if (isChangeStatusVisible) { Job_ChangeStatus_Up.Begin(); isChangeStatusVisible = !isChangeStatusVisible; e.Cancel = true; } if (isSetRemindVisible) { Job_SetRemind_Up.Begin(); isSetRemindVisible = !isSetRemindVisible; e.Cancel = true; } if (isJobMapVisible) { Job_Map_Up.Begin(); isJobMapVisible = !isJobMapVisible; e.Cancel = true; } if (isJobShareVisible) { Job_Share_Up.Begin(); isJobShareVisible = !isJobShareVisible; e.Cancel = true; } if (isJobChangeDateTimeDialogVisible) { Job_ChangeDateTimeDialog_Up.Begin(); isJobChangeDateTimeDialogVisible = !isJobChangeDateTimeDialogVisible; e.Cancel = true; } if (e.Cancel == false && !btn2.Text.Equals("添加收藏")) { Messenger.Default.Send <bool>(true, "UpdateCollectJobData"); } else { } base.OnBackKeyPress(e); }
private void registerMessenger() { Messenger.Default.Send <string>("", "SendJobToDetail"); Messenger.Default.Register <string>(this, "AddJobStatus", empty => { PopupCotainer popupContainer = new PopupCotainer(this); popupContainer.Show(new InputDialog()); } ); Messenger.Default.Register <string>(this, "setRemindCompleted", (s) => { Job_SetRemind_Up.Begin(); isSetRemindVisible = !isSetRemindVisible; }); Messenger.Default.Register <string>(this, "changeStatus", (s) => { Job_ChangeStatus_Down.Begin(); isChangeStatusVisible = !isChangeStatusVisible; }); Messenger.Default.Register <string>(this, "ChangeStatusCompleted", (s) => { Job_ChangeStatus_Up.Begin(); isChangeStatusVisible = !isChangeStatusVisible; tbk_status.Text = s; }); Messenger.Default.Register <string>(this, "JobDetailShareCompleted", (s) => { Job_Share_Up.Begin(); isJobShareVisible = !isJobShareVisible; }); Messenger.Default.Register <string>(this, "NavigateToLoginPage", (s) => { NavigationService.Navigate(new Uri("/View/LoginPage.xaml", UriKind.Relative)); }); Messenger.Default.Register <string[]>(this, "JobDetailChangeAddress", (s) => { tbox_university.Text = s[0]; tbox_address.Text = s[1]; }); Messenger.Default.Register <string>(this, "SetDateTimeCompleted", (msg) => { if (msg.Equals("ok")) { datePicker.Value = job_ChangeDateTimeDialog.datePicker.Value; timePicker.Value = job_ChangeDateTimeDialog.timePicker.Value; } isJobChangeDateTimeDialogVisible = !isJobChangeDateTimeDialogVisible; Job_ChangeDateTimeDialog_Up.Begin(); // PopupCotainer popupContainer = new PopupCotainer(this); //control.datePicker.Value = datePicker.Value; //control.timePicker.Value = timePicker.Value; }); Messenger.Default.Register <string>(this, "job_detail", (s) => { if (!s.StartsWith("http")) { DispatcherHelper.CheckBeginInvokeOnUI(() => { webBrowser.NavigateToString(Unicode2HTML(s)); webBrowser.Visibility = Visibility.Visible; btnSeeDetailInBrowser.Visibility = Visibility.Collapsed; }); } else { DispatcherHelper.CheckBeginInvokeOnUI(() => { webBrowser.Visibility = Visibility.Collapsed; btnSeeDetailInBrowser.Visibility = Visibility.Visible; }); } }); }