Beispiel #1
0
        private void btnLogout_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.AccessToken       = "";
            Properties.Settings.Default.AccessTokenSecret = "";
            Properties.Settings.Default.UserId            = "";
            Properties.Settings.Default.ScreenName        = "";
            Properties.Settings.Default.Save();

            linkUser.Text     = "(未認証)";
            linkUser.Enabled  = false;
            btnLogout.Enabled = false;

            twitter = null;
        }
Beispiel #2
0
        public FormMain()
        {
            InitializeComponent();

            this.MouseMove += new MouseEventHandler(FormMain_MouseMove);

            btnTweet.Enabled   = false;
            btnTweet.BackColor = SystemColors.ControlDark;

            since_id = null;
            if (!string.IsNullOrEmpty(Properties.Settings.Default.AccessToken) &&
                !string.IsNullOrEmpty(Properties.Settings.Default.AccessTokenSecret) &&
                !string.IsNullOrEmpty(Properties.Settings.Default.UserId) &&
                !string.IsNullOrEmpty(Properties.Settings.Default.ScreenName))
            {
                this.Text = Properties.Settings.Default.ScreenName + " - " + Application.ProductName;
                twitter   = new Twitter(OAuthKey.CONSUMER_KEY, OAuthKey.CONSUMER_SECRET, Properties.Settings.Default.AccessToken, Properties.Settings.Default.AccessTokenSecret);
            }
            else
            {
                this.Text = "(未認証) - " + Application.ProductName;
                twitter   = null;
            }

            if (Properties.Settings.Default.Width != 0 && Properties.Settings.Default.Height != 0)
            {
                this.StartPosition = FormStartPosition.Manual;
                this.DesktopBounds = new Rectangle(Properties.Settings.Default.X, Properties.Settings.Default.Y, Properties.Settings.Default.Width, Properties.Settings.Default.Height);
            }

            since_id         = null;
            in_reply_to_id   = null;
            in_reply_to_name = null;
            timelines        = new List <Timeline>();
            hasRead          = false;

            webMain.Visible      = false; // 音を消すため
            webMain.DocumentText = string.Format("<html><head><style type=\"text/css\">{0}</style><script type=\"text/javascript\">{1}</script></head><body><table id=\"tweets\"></table></body></html>", Properties.Resources.css, Properties.Resources.js);

            popup = new FormPopup(this);
        }
Beispiel #3
0
        private void btnSetting_Click(object sender, EventArgs e)
        {
            var setting = new SettingForm();

            if (setting.ShowDialog() == DialogResult.OK)
            {
                timerCheck.Interval = REFRESH_INTERVAL;

                if (string.IsNullOrEmpty(Properties.Settings.Default.AccessTokenSecret))
                {
                    timerCheck.Stop();
                    this.Text = "(未認証) - " + Application.ProductName;
                    twitter   = null;
                    SetNotifyIcon();
                }
                else
                {
                    this.Text = Properties.Settings.Default.ScreenName + " - " + Application.ProductName;
                    twitter   = new Twitter(OAuthKey.CONSUMER_KEY, OAuthKey.CONSUMER_SECRET, Properties.Settings.Default.AccessToken, Properties.Settings.Default.AccessTokenSecret);
                    SetNotifyIcon();
                    timerCheck_Tick(null, null);
                }
            }
        }
Beispiel #4
0
        public SettingForm()
        {
            InitializeComponent();

            // アカウントタブ関連
            if (!string.IsNullOrEmpty(Properties.Settings.Default.ScreenName))
            {
                linkUser.Text     = Properties.Settings.Default.ScreenName;
                linkUser.Enabled  = true;
                btnLogout.Enabled = true;
            }
            else
            {
                linkUser.Text     = "(未認証)";
                linkUser.Enabled  = false;
                btnLogout.Enabled = false;
            }
            twitter           = null;
            editPin.Text      = "";
            editPin.Enabled   = false;
            btnAuthorize.Text = FIRST_TEXT_OF_BUTTON;

            // ネットワークタブ関連
            if (Properties.Settings.Default.Interval <= 0)
            {
                cmbInterval.SelectedIndex = 2;  // デフォルトは1分
            }
            else if (Properties.Settings.Default.Interval <= 15 * 1000)
            {
                cmbInterval.SelectedIndex = 0;  // 15秒
            }
            else if (Properties.Settings.Default.Interval <= 30 * 1000)
            {
                cmbInterval.SelectedIndex = 1;  // 30秒
            }
            else if (Properties.Settings.Default.Interval <= 1 * 60 * 1000)
            {
                cmbInterval.SelectedIndex = 2;  // 1分
            }
            else if (Properties.Settings.Default.Interval <= 2 * 60 * 1000)
            {
                cmbInterval.SelectedIndex = 3;  // 2分
            }
            else if (Properties.Settings.Default.Interval <= 5 * 60 * 1000)
            {
                cmbInterval.SelectedIndex = 4;  // 5分
            }
            else if (Properties.Settings.Default.Interval <= 10 * 60 * 1000)
            {
                cmbInterval.SelectedIndex = 5;  // 10分
            }
            else
            {
                cmbInterval.SelectedIndex = 6;  // 30分
            }
            if (Properties.Settings.Default.UseProxy)
            {
                chkUseProxy.Checked = true;
            }
            else
            {
                chkUseProxy.Checked = false;
            }
            chkUseProxy_CheckedChanged(null, null);
            if (!string.IsNullOrEmpty(Properties.Settings.Default.ProxyHost))
            {
                editProxyHost.Text = Properties.Settings.Default.ProxyHost;
            }
            if (Properties.Settings.Default.ProxyPort > 0)
            {
                editProxyPort.Text = Properties.Settings.Default.ProxyPort.ToString();
            }
        }