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); } }); }