private void StackPanel_Click(object sender, RoutedEventArgs e) { switch (((Button)e.OriginalSource).Name) { case "_showFullScreen": this.Show(new FullScreenDialog()); break; case "_showNormal": this.Show(new NormalDialog()); break; case "_showEventBt": this.Show(new DialogWithEvent()); break; case "_showDialogAsModalBt": var modalresult = this.ShowModal(new NormalDialog() { SetModalResultBtVisibility = Visibility.Visible }); if (modalresult != null) { MessageDialogBox.Show(modalresult.Result + ""); } break; } }
private void DialogWithEvent_Showing(object sender, System.ComponentModel.CancelEventArgs e) { var msresult = MessageDialogBox.Show("Dialog With Event 准备显示,此时可以取消,是否继续显示", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question); if (msresult == MessageBoxResult.No) { e.Cancel = true; } }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); var msresult = MessageDialogBox.Show($"是否确认关闭?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question); if (msresult == MessageBoxResult.No) { e.Cancel = true; } }
private void initProgressBar() { _timeSinceLastQuestion = 0f; //_questionId = questionInfo.id; Rectangle progressArea = new Rectangle((int)MyGame.ScreenCenter.X - 300, (int)MyGame.ScreenCenter.Y - 300 , 600, 50); //_progressBar = new UIElements.ProgressBar(_UIBack, _UIBack, progressArea); _animatedFire = new UIElements.AnimatedTexture(_fireSprite, _fireSprite.Width / 4, _fireSprite.Height, 0.1f, true); _animatedFire.Scale = 0.3f; _progressBar = new UIElements.AnimatedProgressBar(_animatedFire, _ropeSprite, progressArea); MessageDialogBox msgBox = new MessageDialogBox("You should be answering questions on your phone right now", new Rectangle(0, 0, 400, 600), _messageStretchImage); msgBox.Position = MyGame.ScreenCenter; msgBox.Show(); _currentDialog = msgBox; }
/// <summary> /// Loads the contents of a list of blast result collator objects into the model. /// <para> /// When finished, fires the LoadComplete event to notify listeners. /// </para> /// </summary> public void Load(IList <BlastResultCollator> blastResults) { StringWriter errorLog = new StringWriter(); featureCollection.features.Clear(); featureCollection.hits.Clear(); featureCollection.sequences.Clear(); featureCollection.initialQuerySequence = null; foreach (BlastResultCollator blastResult in blastResults) { try { ILinearDomain querySequence = null; ILinearDomain hitSequence = null; string queryId = blastResult.QueryId == null ? String.Format(Resource.SILVERMAP_UNKNOWN_QUERY_ID, unknownQuerySerialNumber ++) : blastResult.QueryId; string subjectId = blastResult.SubjectId == null ? blastResult.Accession : blastResult.SubjectId; if (featureCollection.sequences.ContainsKey(queryId)) { querySequence = featureCollection.sequences[queryId]; } else { querySequence = new SilverMapSequence( queryId, Resource.SILVERMAP_QUERY_SEQUENCE, queryId, blastResult.Length ); featureCollection.sequences.Add(queryId, querySequence); } if (featureCollection.initialQuerySequence == null) { featureCollection.initialQuerySequence = querySequence; } featureCollection.querySequences.Add(querySequence); if (featureCollection.sequences.ContainsKey(subjectId)) { hitSequence = featureCollection.sequences[subjectId]; } else { hitSequence = new SilverMapSequence( subjectId, blastResult.Description, subjectId, blastResult.Length ); featureCollection.sequences.Add(subjectId, hitSequence); } long queryStart = Math.Min(blastResult.QStart, blastResult.QEnd); long queryEnd = Math.Max(blastResult.QStart, blastResult.QEnd); DefaultFeature queryFeature = new DefaultFeature( querySequence, queryStart, queryEnd, blastResult.QueryString ); long subjectStart = Math.Min(blastResult.SStart, blastResult.SEnd); long subjectEnd = Math.Max(blastResult.SStart, blastResult.SEnd); DefaultFeature hitFeature = new DefaultFeature( hitSequence, subjectStart, subjectEnd, blastResult.SubjectString ); featureCollection.features.Add(queryFeature); featureCollection.features.Add(hitFeature); featureCollection.hits.Add(new Hit(queryFeature, hitFeature) { EValue = blastResult.EValue, Identities = blastResult.Identity, Midline = Hit.SEQUENCE_DATA_UNAVAILABLE, Positives = blastResult.Positives }); } catch (Exception e) { errorLog.WriteLine(String.Format(Resource.SILVERMAP_ERROR_PROCESSING_BLAST_RESULT, e)); } } if (errorLog.GetStringBuilder().Length > 0) { MessageDialogBox.Show(errorLog.ToString(), Resource.CAPTION, MessageDialogButton.OK); } SignalLoadComplete(); }
private void DialogWithEvent_Shown(object sender, EventArgs e) { MessageDialogBox.Show("该Dialog已显示完成,可在此事件处理中处理一些加载问题", "信息", MessageBoxButton.OK, MessageBoxImage.Information); }
private void DialogWithEvent_Closed(object sender, EventArgs e) { MessageDialogBox.Show("该Dialog已彻底关闭,并已从视图栈移除,可在此事件处理中处理一些释放问题", "信息", MessageBoxButton.OK, MessageBoxImage.Information); }
private async static void CommandExecuteAction(string cmdkey, UICommandParameter <string> parameter) { switch (cmdkey) { case "DialogsDemoView": ViewManager.Instance.MainRichView.Show(DialogsDemoView.Instance); break; case "FlyoutsDemoView": ViewManager.Instance.MainRichView.SwitchView(FlyoutsDemoView.Instance); break; case "ShowMessageDialogBox": { var msresult = MessageDialogBox.Show($"是、否、取消MessageDialogBox,根据需要返回结果,请继续...{Environment.NewLine}[是]:是{Environment.NewLine}[否]:否{Environment.NewLine}[取消]:取消", "提示", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); if (msresult == MessageBoxResult.Yes) { MessageDialogBox.Show("你点击了 [是]", "信息", MessageBoxButton.OK, MessageBoxImage.Information); } else if (msresult == MessageBoxResult.No) { MessageDialogBox.Show("你点击了 [否]", "信息", MessageBoxButton.OK, MessageBoxImage.Information); } else if (msresult == MessageBoxResult.Cancel) { MessageDialogBox.Show("你点击了 [取消],或者直接关闭了", "信息", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageDialogBox.Show("不应该返回此结果", "信息", MessageBoxButton.OK, MessageBoxImage.Error); } } break; case "ShowProcessDialogBox": { using (ProcessDialogBox box = ProcessDialogBox.Show("测试信息", "标题", false, ProcessBoxButton.Cancel | ProcessBoxButton.PauseContinue | ProcessBoxButton.Stop)) using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource()) { bool ispause = false; box.CancelAction = () => { cancellationTokenSource.Cancel(); }; box.PauseAction = () => { ispause = true; }; box.StopAction = () => { cancellationTokenSource.Cancel(); }; box.ContinueAction = () => { ispause = false; }; await Task.Factory.StartNew(() => { for (int i = 0; i < 200; i++) { SpinWait.SpinUntil(() => !ispause || cancellationTokenSource.IsCancellationRequested); if (cancellationTokenSource.IsCancellationRequested) { break; } box.ProcessValue = (double)i / 200 * 100; Thread.Sleep(100); } }, cancellationTokenSource.Token); } } break; case "Exit": MainWindow.Instance.Close(); break; } }
private static void CommandExecuteAction(string cmdkey, UICommandParameter <string> parameter) { switch (cmdkey) { case "SwitchMainView1": ViewManager.Instance.MainRichView.SwitchView(MainDemoView.Instance); break; case "SwitchMainView2": ViewManager.Instance.MainRichView.SwitchView(MainDemoView2.Instance); break; case "ShowFlyoutLeft": ViewManager.Instance.MainRichView.Show(new FlyoutLocationDemo { FlyoutLocation = FlyoutLocation.Left, Width = 250 }); break; case "ShowFlyoutTop": ViewManager.Instance.MainRichView.Show(new FlyoutLocationDemo { FlyoutLocation = FlyoutLocation.Top, Height = 250 }); break; case "ShowFlyoutRight": ViewManager.Instance.MainRichView.Show(new FlyoutLocationDemo { FlyoutLocation = FlyoutLocation.Right, Width = 250 }); break; case "ShowFlyoutBottom": ViewManager.Instance.MainRichView.Show(new FlyoutLocationDemo { FlyoutLocation = FlyoutLocation.Bottom, Height = 250 }); break; case "ShowDialogFullScreen": ViewManager.Instance.MainRichView.Show(new FullScreenDialog()); break; case "ShowDialogNormal": ViewManager.Instance.MainRichView.Show(new NormalDialog()); break; //当Dialog以模态显示时,其同一个显示堆栈上只可以再堆叠MessageDialogBox,其余的任何可弹出组件不可显示 case "ShowDialogAsModal": { ModalResult result = ViewManager.Instance.MainRichView.ShowModal(new NormalDialog()); if (result != null) { MessageDialogBox.Show(result.Result + ""); } } break; case "ShowMessageDialogBox": { var msresult = MessageDialogBox.Show($"是、否、取消MessageDialogBox,根据需要返回结果,请继续...{Environment.NewLine}[是]:是{Environment.NewLine}[否]:否{Environment.NewLine}[取消]:取消", "提示", MessageBoxButton.YesNoCancel, MessageBoxImage.Question); if (msresult == MessageBoxResult.Yes) { MessageDialogBox.Show("你点击了 [是]"); } else if (msresult == MessageBoxResult.No) { MessageDialogBox.Show("你点击了 [否]"); } else if (msresult == MessageBoxResult.Cancel) { MessageDialogBox.Show("你点击了 [取消],或者直接关闭了"); } else { MessageDialogBox.Show("不应该返回此结果"); } } break; case "Exit": MainWindow.Instance.Close(); break; } }