private void image_UserIcon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { AccountListWindow w = new AccountListWindow(this.account); w.Owner = this; w.Show(); }
private bool analyzeCommand(ArgumentMap amap) { List <string> main = amap.GetMainArgs(); if (main[0] == "ac" || main[0] == "account") { if (amap.HasSwitch("-n")) { AuthorizeWindow w = new AuthorizeWindow(); bool? success = w.ShowDialog(); if (success == true) { } AccountManager am = AccountManager.GetInstance(); Account ac = am.GetAccount(am.CurrentAccountIndex); if (ac == null) { return(false); } MainWindow mw = Application.Current.MainWindow as MainWindow; if (mw != null) { mw.ChangeAccount(); } return(true); } if (amap.HasSwitch("-a")) { AccountManager am = AccountManager.GetInstance(); Account ac = am.GetAccount(am.CurrentAccountIndex); if (ac == null) { return(false); } AccountListWindow w = new AccountListWindow(ac); MainWindow mw = Application.Current.MainWindow as MainWindow; if (mw != null) { w.Owner = mw; } w.Show(); return(true); } int i = amap.GetOptionInt("-i", -1); if (i != -1) { AccountManager am = AccountManager.GetInstance(); am.CurrentAccountIndex = i; MainWindow mw = Application.Current.MainWindow as MainWindow; if (mw != null) { mw.ChangeAccount(); } return(true); } if (main.Count == 2) { AccountManager am = AccountManager.GetInstance(); am.SetCurrentIndexFromScreenName(main[1]); MainWindow mw = Application.Current.MainWindow as MainWindow; if (mw != null) { mw.ChangeAccount(); } return(true); } } else if (main[0] == "info") { AccountManager am = AccountManager.GetInstance(); Account ac = am.GetAccount(am.CurrentAccountIndex); if (ac == null) { return(false); } string screenName = ac.ScreenName; if (main.Count == 2) { screenName = main[1]; } UserInfoWindow w = new UserInfoWindow(ac, screenName); MainWindow mw = Application.Current.MainWindow as MainWindow; if (mw != null) { w.Owner = mw; } w.Show(); return(true); } else if (main[0] == "reload") { MainWindow mw = Application.Current.MainWindow as MainWindow; if (mw != null) { mw.ReloadTimeLine(); } return(true); } else if (main[0] == "notification") { if (main.Count == 1) { string message = string.Format("Notification: {0}", ConfigManager.Config.Notification ? "On" : "Off"); MessageBox.Show(message, "Information", MessageBoxButton.OK, MessageBoxImage.Asterisk); return(true); } if (main.Count != 2) { return(false); } if (main[1] == "on") { ConfigManager.Config.Notification = true; MessageBox.Show("Notification: On", "Information", MessageBoxButton.OK, MessageBoxImage.Asterisk); return(true); } else if (main[1] == "off") { ConfigManager.Config.Notification = false; MessageBox.Show("Notification: Off", "Information", MessageBoxButton.OK, MessageBoxImage.Asterisk); return(true); } } else if (main[0] == "face") { if (main.Count < 2) { string message = @"0: |ω・) 1: ( ˘ω˘) 2: ( ꒪ ω꒪) 3: (;꒪ ω꒪) 4: ~(=^・ω・^)ノ ニャー!"; MessageBox.Show(message); return(false); } int index = 0; if (!int.TryParse(main[1], out index)) { return(false); } MainWindow mw = Application.Current.MainWindow as MainWindow; if (mw == null) { return(false); } if (index == 0) { mw.textBox_Tweet.Text += "|ω・)"; } else if (index == 1) { mw.textBox_Tweet.Text += "( ˘ω˘)"; } else if (index == 2) { mw.textBox_Tweet.Text += "( ꒪ ω꒪)"; } else if (index == 3) { mw.textBox_Tweet.Text += "(;꒪ ω꒪)"; } else if (index == 4) { mw.textBox_Tweet.Text += "~(=^・ω・^)ノ ニャー!"; } mw.textBox_Tweet.Focus(); return(true); } return(false); }