public void Option_Test() { var consoleMock = new Mock <IShell>(); consoleMock.Setup(c => c.WriteLine("1\tCreate Account")); consoleMock.Setup(c => c.WriteLine("2\tTransfer")); consoleMock.Setup(c => c.WriteLine("3\tDeposit")); consoleMock.Setup(c => c.WriteLine("4\tWithDrawal")); consoleMock.Setup(c => c.WriteLine("5\tExit")); consoleMock.Setup(c => c.WriteLine("-----------------------------------")); consoleMock.Setup(c => c.Write("Enter Choice : ")); var optionsView = new OptionsView("fool", consoleMock.Object); optionsView.Show(); consoleMock.VerifyAll(); }
private void ShowOptions() { var options = new OptionsView { WindowStartupLocation = WindowStartupLocation.CenterScreen }; options.Show(); void EventHandler(object sender, EventArgs e) { BuildMenuItems(); options.Closed -= EventHandler; } options.Closed += EventHandler; }
public MainWindow() { InitializeComponent(); Messenger.Default.Register <MainViewCloseMessage>(this, message => { this.Close(); }); Messenger.Default.Register <SetAddingCommentDirection>(this, message => { _addingCommentToTop = message.IsTop; }); Messenger.Default.Register <SetPostCommentPanel>(this, message => { PostCommentPanelPlaceHolder.Children.Clear(); var newPanel = message.Panel; if (newPanel == null) { PostCommentPanelPlaceHolder.IsEnabled = false; } else { PostCommentPanelPlaceHolder.IsEnabled = true; newPanel.Margin = new Thickness(0); newPanel.VerticalAlignment = VerticalAlignment.Stretch; newPanel.HorizontalAlignment = HorizontalAlignment.Stretch; newPanel.Width = double.NaN; newPanel.Height = double.NaN; PostCommentPanelPlaceHolder.Children.Add(newPanel); } }); Messenger.Default.Register <ShowOptionsViewMessage>(this, message => { try { if (optionsView == null) { optionsView = new OptionsView(); optionsView.Owner = this; } optionsView.Clear(); foreach (var tab in message.Tabs) { optionsView.AddTabPage(tab); } var showPos = Tools.GetShowPos(Tools.GetMousePos(), optionsView); optionsView.Left = showPos.X; optionsView.Top = showPos.Y; optionsView.Show(); } catch (Exception ex) { Debug.WriteLine(ex.Message); Debugger.Break(); } }); Messenger.Default.Register <Common.AutoUpdate.ShowUpdateDialogMessage>(this, message => { try { var updateView = new Common.AutoUpdate.UpdateView(); var showPos = Tools.GetShowPos(Tools.GetMousePos(), updateView); updateView.Left = showPos.X; updateView.Top = showPos.Y; updateView.IsUpdateExists = message.IsUpdateExists; updateView.CurrentVersion = message.CurrentVersion; updateView.LatestVersionInfo = message.LatestVersionInfo; updateView.Owner = this; updateView.Logger = message.Logger; updateView.ShowDialog(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }); Messenger.Default.Register <ShowUserViewMessage>(this, message => { try { var uvm = message.Uvm; var userView = new UserView { DataContext = uvm }; userView.Show(); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }); }
private void Options() { OptionsView view = new OptionsView(); view.Show(); }
public void Execute() { var optionsWindow = new OptionsView(this.config); optionsWindow.Show(); }