public MainWindow() { InitializeComponent(); SpiritWindow = new SpiritWindow(); Confirmation = new ConfirmationWindow(); CloseButton.Click += (a, e) => Close(); TitleBar.MouseDown += (a, e) => DragMove(); this.Closing += (a, e) => WindowClose(); ListAddButton.Click += (a, e) => MainViewModel.Lists.Add(new SpiritListViewModel() { ListTitle = "new List" }); SettingWindow = new SettingWindow(MainViewModel.Setting); if (Messanger.IsAuth) { SettingWindow.TwitterAuthButton.IsEnabled = false; SettingWindow.TwitterAuthButton.Content = "認証済み"; } this.DataContext = MainViewModel; Grass.TargetWebView = GrassView; Grass.GetGrass(MainViewModel.Setting.GitHubName); SettingButton.Click += (a, e) => SettingWindow.Show(); }
public void CloseButton_Clicked() { var data = this.DataContext as SettingViewModel; if (!Equals(data.UserName, buffer.UserName) || !Equals(data.GitHubName, buffer.GitHubName)) { Messanger.Write(); if (!Equals(data.GitHubName, buffer.GitHubName)) { Grass.GetGrass(data.GitHubName); } } this.Hide(); }