//private void ShowCurTimer() //{ // //"星期"+DateTime.Now.DayOfWeek.ToString(("d")) // //获得星期几 // DataTextBlock.Text = DateTime.Now.ToString("dddd", new System.Globalization.CultureInfo("zh-cn")); // DataTextBlock.Text += " "; // //获得年月日 // DataTextBlock.Text += DateTime.Now.ToString("yyyy年MM月dd日"); //yyyy年MM月dd日 // DataTextBlock.Text += " "; // //获得时分秒 // TimeTextBlock.Text += DateTime.Now.ToString("HH:mm:ss"); // //System.Diagnostics.Debug.Print("this.ShowCurrentTime {0}", this.ShowCurrentTime); //} /// <summary> /// 响应式快捷键 /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void Dispatcher_AcceleratorKeyActivated(CoreDispatcher sender, AcceleratorKeyEventArgs args) { if (args.EventType.ToString().Contains("Down")) { var ctrl = Window.Current.CoreWindow.GetKeyState(VirtualKey.Control); if (ctrl.HasFlag(CoreVirtualKeyStates.Down)) { switch (args.VirtualKey) { case VirtualKey.D: var noteViewModel = Application.Current.Resources["NoteViewModel"] as NoteViewModel; var note = (DataContext as NoteViewModel)?.SelectNote; noteViewModel?.DeleteNoteCommand.Execute(note); break; case VirtualKey.S: var theNoteViewModel = (DataContext as NoteViewModel); theNoteViewModel?.AddNoteCommand.Execute(null); break; case VirtualKey.T: SetToastContentDialog setting = new SetToastContentDialog(); setting.ShowAsync(); break; case VirtualKey.E: var dialog = new ContentDialog() { Title = "Time to relax", Content = "https://pan.baidu.com/s/1ARSnPD82Yi59vERMoBlX8Q", PrimaryButtonText = "确定", FullSizeDesired = false, }; dialog.PrimaryButtonClick += (s, e) => { if (s == null) { throw new ArgumentNullException(nameof(s)); } if (e == null) { throw new ArgumentNullException(nameof(e)); } }; dialog.ShowAsync(); break; } } } }
//private async void AllNoteButton_Click(object sender, RoutedEventArgs e) //{ // CoreApplicationView newView = null; // if (CoreApplication.Views.Count > 1) // { // newView = CoreApplication.Views[1]; // } // // 如果没有这个视图,就创一个 // if (newView == null) // { // newView = CoreApplication.CreateNewView(); // } // int newViewId = default(int); // // 初始化视图 // await newView.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, // () => // { // // 获取视图视图ID // ApplicationView theView = ApplicationView.GetForCurrentView(); // newViewId = theView.Id; // // 初始化视图的UI // Frame frame = new Frame(); // frame.Navigate(typeof(AllNotePage), null); // Window.Current.Content = frame; // // You have to activate the window in order to show it later. // Window.Current.Activate(); // }); // bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newViewId); // if (viewShown) // { // // 成功显示新视图 // } // else // { // // 视图显示失败 // } //} private void ToastButton_Click(object sender, RoutedEventArgs e) { SetToastContentDialog setting = new SetToastContentDialog(); setting.ShowAsync(); }