Beispiel #1
0
 public Main()
 {
     TestCode();
     using (var sp = new Sprash())
     {
         sp.Show();
         InitializeComponent();
         if (version < CheckLatestVersion())
         {
             sp.Close();
             MessageBox.Show("There is an update.");
             System.Diagnostics.Process.Start("https://github.com/a1cn/Alicium-2.x/downloads");
         }
         Accounts = AccountReader.Read("Settings/Accounts.dat");
         if (Accounts.Count != 0)
         {
             AccountsList.Items.AddRange(Accounts.Keys.ToArray());
         }
         else
         {
             sp.Close();
             MessageBox.Show("Accounts not found.Let's authenticate your first account.");
             var m = new AccountManager(Accounts);
             m.ShowDialog();
             if (m.Change)
             {
                 Accounts.Clear();
                 AccountsList.Items.Clear();
                 Accounts = AccountReader.Read("Settings/Accounts.dat");
                 if (Accounts.Count != 0)
                 {
                     AccountsList.Items.AddRange(Accounts.Keys.ToArray());
                     AccountsList.SelectedIndex = 0;
                 }
             }
         }
         var f = ColumnReader.Load(this);
         for (int i = 0; i < f.Length; i++)
         {
             f[i].TopLevel = false;
             f[i].TopMost  = false;
             f[i].Fresh    = false;
             f[i].Parent   = this;
             f[i].Show();
             f[i].Size     = new Size(240, this.Size.Height - 160);
             f[i].Text     = f[i].Text.Remove(0, 3);
             f[i].Text     = i + ": " + f[i].Text;
             f[i].Location = new Point(240 * i, f[i].Fresh ? 0 : 27);
             f[i].Size     = new Size(240, this.Size.Height - 160);
             Columns.Add(f[i]);
         }
         twitterDo = new TwitterDo(this);
         try
         {
             sp.Close();
         }
         catch {}
     }
 }
Beispiel #2
0
        private void Main_FormClosed(object sender, FormClosedEventArgs e)
        {
            bool b = ColumnReader.Save(Columns.ToArray());
            bool c = AccountReader.Save(Accounts, Application.StartupPath + "/Settings/Accounts.dat");

            if (!b || !c)
            {
                MessageBox.Show("Failed to save your data.");
            }
        }
Beispiel #3
0
        private void accountsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AccountManager m = new AccountManager(Accounts);

            m.ShowDialog();
            if (m.Change)
            {
                Accounts.Clear();
                AccountsList.Items.Clear();
                Accounts = AccountReader.Read("Settings/Accounts.dat");
                if (Accounts.Count != 0)
                {
                    AccountsList.Items.AddRange(Accounts.Keys.ToArray());
                }
            }
        }
Beispiel #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     Change = true;
     AccountReader.Save(Accounts, "Settings/Accounts.dat");
     this.Close();
 }
Beispiel #5
0
 private bool CodeDo()
 {
     /*
      * //TEMP:
      * else if (PostText.Text == "/" || PostText.Text == "/")
      * {
      * return true;
      * }
      */
     if (PostText.Text == "/exit" || PostText.Text == "/e")
     {
         this.Close();
         return(true);
     }
     else if (PostText.Text == "/halt" || PostText.Text == "/h")
     {
         System.Environment.Exit(0);
         return(true);
     }
     else if (PostText.Text == "/account" || PostText.Text == "/a")
     {
         AccountManager m = new AccountManager(Accounts);
         m.ShowDialog();
         if (m.Change)
         {
             Accounts.Clear();
             AccountsList.Items.Clear();
             Accounts = AccountReader.Read("Settings/Accounts.dat");
             if (Accounts.Count != 0)
             {
                 AccountsList.Items.AddRange(Accounts.Keys.ToArray());
             }
         }
         return(true);
     }
     else if (PostText.Text == "/mariari" || PostText.Text == "/m")
     {
         twitterDo.MultiPoster(Mariari.Yakkai);
         return(true);
     }
     else if (PostText.Text == "/cannon" || PostText.Text == "/c")
     {
         twitterDo.MultiPoster(Mariari.Cannon);
         return(true);
     }
     else if (PostText.Text == "/stealth" || PostText.Text == "/s")
     {
         twitterDo.Post(Mariari.Stealth);
         return(true);
     }
     else if (PostText.Text == "/boss" || PostText.Text == "/b")
     {
         this.WindowState   = FormWindowState.Minimized;
         this.ShowInTaskbar = false;
         if (MessageBox.Show("上書きしますか?", "確認", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Cancel)
         {
             this.WindowState   = FormWindowState.Normal;
             this.ShowInTaskbar = true;
         }
         else
         {
             System.Environment.Exit(0);
         }
         return(true);
     }
     else if (PostText.Text.Contains("/user ") || PostText.Text.Contains("/u "))
     {
         if (NowTokens.Length != 0)
         {
             string view = PostText.Text.Replace("/user ", "").Replace("/u ", "");
             try
             {
                 new UserView(view, NowTokens.First().OAuthTokens).Show();
             }
             catch { }
         }
         else
         {
             MConsole.WriteLine("You haven't selected any accounts.");
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }