Inheritance: IDisposable
Ejemplo n.º 1
0
 public TwitPic(Twitter twitter, Twitter tltwitter)
     : base(new Uri( "http://api.twitter.com/" ), new Uri( "https://api.twitter.com/1/account/verify_credentials.json" ))
 {
     this.tw = twitter;
     this.tltw = tltwitter;
     this.Initialize(tltw.ConsumerKey, tltw.ConsumerSecret, tltw.AccessToken, tltw.AccessTokenSecret, "", "");
 }
Ejemplo n.º 2
0
        public void BeginSelection_BlankTest()
        {
            using (var twitter = new Twitter())
            using (var mediaSelector = new MediaSelector { Visible = false, Enabled = false })
            {
                twitter.Initialize("", "", "", 0L);
                mediaSelector.Initialize(twitter, TwitterConfiguration.DefaultConfiguration(), "Twitter");

                var eventCalled = false;
                mediaSelector.BeginSelecting += (o, e) => eventCalled = true;

                mediaSelector.BeginSelection();

                Assert.True(eventCalled);

                Assert.True(mediaSelector.Visible);
                Assert.True(mediaSelector.Enabled);

                // 1 ページ目のみ選択可能な状態
                var pages = mediaSelector.ImagePageCombo.Items;
                Assert.Equal(new[] { "1" }, pages.Cast<object>().Select(x => x.ToString()));

                // 1 ページ目が表示されている
                Assert.Equal("1", mediaSelector.ImagePageCombo.Text);
                Assert.Equal("", mediaSelector.ImagefilePathText.Text);
                Assert.Null(mediaSelector.ImageSelectedPicture.Image);
            }
        }
Ejemplo n.º 3
0
 public void Set(string msg, string tweet, long reply_to, FileInfo mediaFile, Twitter ppc)
 {
     this.msg = msg;
     this.tweet = tweet;
     this.reply_to = reply_to;
     this.mediaFile = mediaFile;
     this.ppc = ppc;
 }
Ejemplo n.º 4
0
        public MyLists(string userName, Twitter tw)
        {
            this.InitializeComponent();

            this.contextUserName = userName;
            this._tw = tw;

            this.Text = this.contextUserName + Properties.Resources.MyLists1;
        }
Ejemplo n.º 5
0
 public void Set(string msg, string tweet, long reply_to, FileInfo mediaFile, Twitter ppc, int interval)
 {
     this.msg = msg;
     this.tweet = tweet;
     this.reply_to = reply_to;
     this.mediaFile = mediaFile;
     this.ppc = ppc;
     this.retryTimer.Interval = interval;
 }
Ejemplo n.º 6
0
        public UserInfoDialog(TweenMain mainForm, Twitter twitter)
        {
            this.mainForm = mainForm;
            this.twitter = twitter;

            InitializeComponent();

            // LabelScreenName のフォントを OTBaseForm.GlobalFont に変更
            this.LabelScreenName.Font = this.ReplaceToGlobalFont(this.LabelScreenName.Font);
        }
Ejemplo n.º 7
0
        public ListElement(TwitterList listElementData, Twitter tw)
        {
            this.Description = listElementData.Description;
            this.Id = listElementData.Id;
            this.IsPublic = (listElementData.Mode == "public");
            this.MemberCount = listElementData.MemberCount;
            this.Name = listElementData.Name;
            this.SubscriberCount = listElementData.SubscriberCount;
            this.Slug = listElementData.Slug;
            this.Nickname = listElementData.User.Name.Trim();
            this.Username = listElementData.User.ScreenName;
            this.UserId = listElementData.User.Id;

            this._tw = tw;
        }
Ejemplo n.º 8
0
        public void Initialize_yfrogTest()
        {
            using (var mediaSelector = new MediaSelector())
            {
                var twitter = new Twitter();
                var config = TwitterConfiguration.DefaultConfiguration();
                mediaSelector.Initialize(twitter, config, "yfrog");

                // 投稿先に yfrog が選択されている
                Assert.Equal("yfrog", mediaSelector.ImageServiceCombo.Text);

                // ページ番号が初期化された状態
                var pages = mediaSelector.ImagePageCombo.Items;
                Assert.Equal(new[] { "1" }, pages.Cast<object>().Select(x => x.ToString()));
            }
        }
Ejemplo n.º 9
0
        public void Initialize_yfrogTest()
        {
            using (var twitter = new Twitter())
            using (var mediaSelector = new MediaSelector())
            {
                twitter.Initialize("", "", "", 0L);
                mediaSelector.Initialize(twitter, TwitterConfiguration.DefaultConfiguration(), "yfrog");

                // 投稿先に yfrog が選択されている
                Assert.Equal("yfrog", mediaSelector.ImageServiceCombo.Text);

                // ページ番号が初期化された状態
                var pages = mediaSelector.ImagePageCombo.Items;
                Assert.Equal(new[] { "1" }, pages.Cast<object>().Select(x => x.ToString()));

                // 代替テキストの入力欄が非表示の状態
                Assert.False(mediaSelector.AlternativeTextPanel.Visible);
            }
        }
Ejemplo n.º 10
0
        private void ShowApiInfo(Twitter _tw)
        {
            ApiInfo info = new ApiInfo();
            StringBuilder tmp = new StringBuilder();
            GetApiInfoArgs args = new GetApiInfoArgs(){ info = info, tw = _tw };

            using (FormInfo dlg = new FormInfo(this, Properties.Resources.ApiInfo6, GetApiInfo_Dowork, null, args))
            {
                dlg.ShowDialog();
                if ((bool)dlg.Result)
                {
                    tmp.AppendLine("@" + args.tw.Username + "(" + args.tw.UserId.ToString() + ")");
                    tmp.AppendLine();
                    tmp.AppendLine(Properties.Resources.ApiInfo1 + args.info.MaxCount.ToString());
                    tmp.AppendLine(Properties.Resources.ApiInfo2 + args.info.RemainCount.ToString());
                    tmp.AppendLine(Properties.Resources.ApiInfo3 + args.info.ResetTime.ToString());
                    tmp.AppendLine(Properties.Resources.ApiInfo7 + (args.tw.UserStreamEnabled ? Properties.Resources.Enable : Properties.Resources.Disable).ToString());

                    tmp.AppendLine();
                    tmp.AppendLine(Properties.Resources.ApiInfo8 + args.info.AccessLevel.ToString());
                    SetStatusLabelUrl();

                    tmp.AppendLine();
                    tmp.AppendLine(Properties.Resources.ApiInfo9 + (args.info.MediaMaxCount < 0 ? Properties.Resources.ApiInfo91 : args.info.MediaMaxCount.ToString()));
                    tmp.AppendLine(Properties.Resources.ApiInfo10 + (args.info.MediaRemainCount < 0 ? Properties.Resources.ApiInfo91 : args.info.MediaRemainCount.ToString()));
                    tmp.AppendLine(Properties.Resources.ApiInfo11 + (args.info.MediaResetTime == new DateTime() ? Properties.Resources.ApiInfo91 : args.info.MediaResetTime.ToString()));
                }
                else
                {
                    tmp.Append(Properties.Resources.ApiInfo5);
                }
            }

            MessageBox.Show(tmp.ToString(), Properties.Resources.ApiInfo4, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 11
0
        private void TweenMain_Load(object sender, EventArgs e)
        {
            _ignoreConfigSave = true;
            this.Visible = false;

            //Win32Api.SetProxy(HttpConnection.ProxyType.Specified, "127.0.0.1", 8080, "user", "pass")

            new InternetSecurityManager(PostBrowser);
            this.PostBrowser.AllowWebBrowserDrop = false;  // COMException を回避するため、ActiveX の初期化が終わってから設定する

            MyCommon.TwitterApiInfo.AccessLimitUpdated += TwitterApiStatus_AccessLimitUpdated;
            Microsoft.Win32.SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;

            if (MyApplication.StartupOptions.ContainsKey("d"))
                MyCommon.TraceFlag = true;

            Regex.CacheSize = 100;

            InitializeTraceFrag();
            LoadIcons(); // アイコン読み込み

            //発言保持クラス
            _statuses = TabInformations.GetInstance();

            //アイコン設定
            this.Icon = MainIcon;              //メインフォーム(TweenMain)
            NotifyIcon1.Icon = NIconAt;      //タスクトレイ
            TabImage.Images.Add(TabIcon);    //タブ見出し

            SettingDialog.Owner = this;;
            SearchDialog.Owner = this;
            fltDialog.Owner = this;
            UrlDialog.Owner = this;

            _history.Add(new PostingStatus());
            _hisIdx = 0;
            _reply_to_id = null;
            _reply_to_name = null;

            //<<<<<<<<<設定関連>>>>>>>>>
            //設定コンバージョン
            //ConvertConfig();

            ////設定読み出し
            LoadConfig();

            ThumbnailGenerator.InitializeGenerator();

            var imgazyobizinet = ThumbnailGenerator.ImgAzyobuziNetInstance;
            imgazyobizinet.Enabled = this._cfgCommon.EnableImgAzyobuziNet;
            imgazyobizinet.DisabledInDM = this._cfgCommon.ImgAzyobuziNetDisabledInDM;

            Thumbnail.Services.TonTwitterCom.InitializeOAuthToken = x =>
                x.Initialize(ApplicationSettings.TwitterConsumerKey, ApplicationSettings.TwitterConsumerSecret,
                    this.tw.AccessToken, this.tw.AccessTokenSecret, "", "");

            //新着バルーン通知のチェック状態設定
            NewPostPopMenuItem.Checked = _cfgCommon.NewAllPop;
            this.NotifyFileMenuItem.Checked = NewPostPopMenuItem.Checked;

            //フォント&文字色&背景色保持
            _fntUnread = _cfgLocal.FontUnread;
            _clUnread = _cfgLocal.ColorUnread;
            _fntReaded = _cfgLocal.FontRead;
            _clReaded = _cfgLocal.ColorRead;
            _clFav = _cfgLocal.ColorFav;
            _clOWL = _cfgLocal.ColorOWL;
            _clRetweet = _cfgLocal.ColorRetweet;
            _fntDetail = _cfgLocal.FontDetail;
            _clDetail = _cfgLocal.ColorDetail;
            _clDetailLink = _cfgLocal.ColorDetailLink;
            _clDetailBackcolor = _cfgLocal.ColorDetailBackcolor;
            _clSelf = _cfgLocal.ColorSelf;
            _clAtSelf = _cfgLocal.ColorAtSelf;
            _clTarget = _cfgLocal.ColorTarget;
            _clAtTarget = _cfgLocal.ColorAtTarget;
            _clAtFromTarget = _cfgLocal.ColorAtFromTarget;
            _clAtTo = _cfgLocal.ColorAtTo;
            _clListBackcolor = _cfgLocal.ColorListBackcolor;
            _clInputBackcolor = _cfgLocal.ColorInputBackcolor;
            _clInputFont = _cfgLocal.ColorInputFont;
            _fntInputFont = _cfgLocal.FontInputFont;

            var fontUIGlobal = this._cfgLocal.FontUIGlobal;
            if (fontUIGlobal != null)
            {
                OTBaseForm.GlobalFont = fontUIGlobal;
                this.Font = fontUIGlobal;
            }

            // StringFormatオブジェクトへの事前設定
            //sf.Alignment = StringAlignment.Near;             // Textを近くへ配置(左から右の場合は左寄せ)
            //sf.LineAlignment = StringAlignment.Near;         // Textを近くへ配置(上寄せ)
            //sf.FormatFlags = StringFormatFlags.LineLimit;    // 
            sfTab.Alignment = StringAlignment.Center;
            sfTab.LineAlignment = StringAlignment.Center;

            //不正値チェック
            if (!MyApplication.StartupOptions.ContainsKey("nolimit"))
            {
                if (this._cfgCommon.TimelinePeriod < 15 && this._cfgCommon.TimelinePeriod > 0)
                    this._cfgCommon.TimelinePeriod = 15;

                if (this._cfgCommon.ReplyPeriod < 15 && this._cfgCommon.ReplyPeriod > 0)
                    this._cfgCommon.ReplyPeriod = 15;

                if (this._cfgCommon.DMPeriod < 15 && this._cfgCommon.DMPeriod > 0)
                    this._cfgCommon.DMPeriod = 15;

                if (this._cfgCommon.PubSearchPeriod < 30 && this._cfgCommon.PubSearchPeriod > 0)
                    this._cfgCommon.PubSearchPeriod = 30;

                if (this._cfgCommon.UserTimelinePeriod < 15 && this._cfgCommon.UserTimelinePeriod > 0)
                    this._cfgCommon.UserTimelinePeriod = 15;

                if (this._cfgCommon.ListsPeriod < 15 && this._cfgCommon.ListsPeriod > 0)
                    this._cfgCommon.ListsPeriod = 15;
            }

            if (this._cfgCommon.CountApi < 20 || this._cfgCommon.CountApi > 200)
                this._cfgCommon.CountApi = 60;
            if (this._cfgCommon.CountApiReply < 20 || this._cfgCommon.CountApiReply > 200)
                this._cfgCommon.CountApiReply = 40;

            HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;

            //認証関連
            if (string.IsNullOrEmpty(_cfgCommon.Token)) _cfgCommon.UserName = "";
            tw.Initialize(_cfgCommon.Token, _cfgCommon.TokenSecret, _cfgCommon.UserName, _cfgCommon.UserId);

            //新着取得時のリストスクロールをするか。trueならスクロールしない
            ListLockMenuItem.Checked = _cfgCommon.ListLock;
            this.LockListFileMenuItem.Checked = _cfgCommon.ListLock;
            //サウンド再生(タブ別設定より優先)
            this.PlaySoundMenuItem.Checked = this._cfgCommon.PlaySound;
            this.PlaySoundFileMenuItem.Checked = this._cfgCommon.PlaySound;

            //廃止サービスが選択されていた場合bit.lyへ読み替え
            if (_cfgCommon.AutoShortUrlFirst < 0)
                _cfgCommon.AutoShortUrlFirst = MyCommon.UrlConverter.Uxnu;

            AtIdSupl = new AtIdSupplement(SettingAtIdList.Load().AtIdList, "@");

            this.IdeographicSpaceToSpaceToolStripMenuItem.Checked = _cfgCommon.WideSpaceConvert;
            this.ToolStripFocusLockMenuItem.Checked = _cfgCommon.FocusLockToStatusText;

            //Regex statregex = new Regex("^0*");
            this.recommendedStatusFooter = " [TWNv" + Regex.Replace(MyCommon.FileVersion.Replace(".", ""), "^0*", "") + "]";

            //ハッシュタグ関連
            HashSupl = new AtIdSupplement(_cfgCommon.HashTags, "#");
            HashMgr = new HashtagManage(HashSupl,
                                    _cfgCommon.HashTags.ToArray(),
                                    _cfgCommon.HashSelected,
                                    _cfgCommon.HashIsPermanent,
                                    _cfgCommon.HashIsHead,
                                    _cfgCommon.HashIsNotAddToAtReply);
            if (!string.IsNullOrEmpty(HashMgr.UseHash) && HashMgr.IsPermanent) HashStripSplitButton.Text = HashMgr.UseHash;

            _initial = true;

            Networking.Initialize();

            //アイコンリスト作成
            this.IconCache = new ImageCache();

            bool saveRequired = false;
            bool firstRun = false;

            //ユーザー名、パスワードが未設定なら設定画面を表示(初回起動時など)
            if (string.IsNullOrEmpty(tw.Username))
            {
                saveRequired = true;
                firstRun = true;
                SettingDialog.ShowInTaskbar = true;

                this.SettingDialog.tw = this.tw;
                this.SettingDialog.LoadConfig(this._cfgCommon, this._cfgLocal);

                //設定せずにキャンセルされた場合はプログラム終了
                if (SettingDialog.ShowDialog(this) == DialogResult.Cancel)
                {
                    Application.Exit();  //強制終了
                    return;
                }
                //設定されたが、依然ユーザー名とパスワードが未設定ならプログラム終了
                if (string.IsNullOrEmpty(tw.Username))
                {
                    Application.Exit();  //強制終了
                    return;
                }
                SettingDialog.ShowInTaskbar = false;

                //新しい設定を反映
                //フォント&文字色&背景色保持
                _fntUnread = this._cfgLocal.FontUnread;
                _clUnread = this._cfgLocal.ColorUnread;
                _fntReaded = this._cfgLocal.FontRead;
                _clReaded = this._cfgLocal.ColorRead;
                _clFav = this._cfgLocal.ColorFav;
                _clOWL = this._cfgLocal.ColorOWL;
                _clRetweet = this._cfgLocal.ColorRetweet;
                _fntDetail = this._cfgLocal.FontDetail;
                _clDetail = this._cfgLocal.ColorDetail;
                _clDetailLink = this._cfgLocal.ColorDetailLink;
                _clDetailBackcolor = this._cfgLocal.ColorDetailBackcolor;
                _clSelf = this._cfgLocal.ColorSelf;
                _clAtSelf = this._cfgLocal.ColorAtSelf;
                _clTarget = this._cfgLocal.ColorTarget;
                _clAtTarget = this._cfgLocal.ColorAtTarget;
                _clAtFromTarget = this._cfgLocal.ColorAtFromTarget;
                _clAtTo = this._cfgLocal.ColorAtTo;
                _clListBackcolor = this._cfgLocal.ColorListBackcolor;
                _clInputBackcolor = this._cfgLocal.ColorInputBackcolor;
                _clInputFont = this._cfgLocal.ColorInputFont;
                _fntInputFont = this._cfgLocal.FontInputFont;
            }

            _brsBackColorMine = new SolidBrush(_clSelf);
            _brsBackColorAt = new SolidBrush(_clAtSelf);
            _brsBackColorYou = new SolidBrush(_clTarget);
            _brsBackColorAtYou = new SolidBrush(_clAtTarget);
            _brsBackColorAtFromTarget = new SolidBrush(_clAtFromTarget);
            _brsBackColorAtTo = new SolidBrush(_clAtTo);
            //_brsBackColorNone = new SolidBrush(Color.FromKnownColor(KnownColor.Window));
            _brsBackColorNone = new SolidBrush(_clListBackcolor);

            InitDetailHtmlFormat();

            if (this._cfgCommon.HotkeyEnabled)
            {
                //////グローバルホットキーの登録
                HookGlobalHotkey.ModKeys modKey = HookGlobalHotkey.ModKeys.None;
                if ((this._cfgCommon.HotkeyModifier & Keys.Alt) == Keys.Alt)
                    modKey |= HookGlobalHotkey.ModKeys.Alt;
                if ((this._cfgCommon.HotkeyModifier & Keys.Control) == Keys.Control)
                    modKey |= HookGlobalHotkey.ModKeys.Ctrl;
                if ((this._cfgCommon.HotkeyModifier & Keys.Shift) == Keys.Shift)
                    modKey |= HookGlobalHotkey.ModKeys.Shift;
                if ((this._cfgCommon.HotkeyModifier & Keys.LWin) == Keys.LWin)
                    modKey |= HookGlobalHotkey.ModKeys.Win;

                _hookGlobalHotkey.RegisterOriginalHotkey(this._cfgCommon.HotkeyKey, this._cfgCommon.HotkeyValue, modKey);
            }

            //Twitter用通信クラス初期化
            Networking.DefaultTimeout = TimeSpan.FromSeconds(this._cfgCommon.DefaultTimeOut);
            Networking.SetWebProxy(this._cfgLocal.ProxyType,
                this._cfgLocal.ProxyAddress, this._cfgLocal.ProxyPort,
                this._cfgLocal.ProxyUser, this._cfgLocal.ProxyPassword);

            tw.RestrictFavCheck = this._cfgCommon.RestrictFavCheck;
            tw.ReadOwnPost = this._cfgCommon.ReadOwnPost;
            ShortUrl.Instance.DisableExpanding = !this._cfgCommon.TinyUrlResolve;
            ShortUrl.Instance.BitlyId = this._cfgCommon.BilyUser;
            ShortUrl.Instance.BitlyKey = this._cfgCommon.BitlyPwd;
            HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;
            tw.TrackWord = _cfgCommon.TrackWord;
            TrackToolStripMenuItem.Checked = !String.IsNullOrEmpty(tw.TrackWord);
            tw.AllAtReply = _cfgCommon.AllAtReply;
            AllrepliesToolStripMenuItem.Checked = tw.AllAtReply;

            //画像投稿サービス
            ImageSelector.Initialize(tw, this.tw.Configuration, _cfgCommon.UseImageServiceName, _cfgCommon.UseImageService);

            //ウィンドウ設定
            this.ClientSize = _cfgLocal.FormSize;
            _mySize = _cfgLocal.FormSize;                     //サイズ保持(最小化・最大化されたまま終了した場合の対応用)
            _myLoc = _cfgLocal.FormLocation;
            //タイトルバー領域
            if (this.WindowState != FormWindowState.Minimized)
            {
                this.DesktopLocation = _cfgLocal.FormLocation;
                Rectangle tbarRect = new Rectangle(this.Location, new Size(_mySize.Width, SystemInformation.CaptionHeight));
                bool outOfScreen = true;
                if (Screen.AllScreens.Length == 1)    //ハングするとの報告
                {
                    foreach (Screen scr in Screen.AllScreens)
                    {
                        if (!Rectangle.Intersect(tbarRect, scr.Bounds).IsEmpty)
                        {
                            outOfScreen = false;
                            break;
                        }
                    }
                    if (outOfScreen)
                    {
                        this.DesktopLocation = new Point(0, 0);
                        _myLoc = this.DesktopLocation;
                    }
                }
            }
            this.TopMost = this._cfgCommon.AlwaysTop;
            _mySpDis = _cfgLocal.SplitterDistance;
            _mySpDis2 = _cfgLocal.StatusTextHeight;
            _mySpDis3 = _cfgLocal.PreviewDistance;
            if (_mySpDis3 == -1)
            {
                _mySpDis3 = _mySize.Width - 150;
                if (_mySpDis3 < 1) _mySpDis3 = 50;
                _cfgLocal.PreviewDistance = _mySpDis3;
            }
            MultiLineMenuItem.Checked = _cfgLocal.StatusMultiline;
            //this.Tween_ClientSizeChanged(this, null);
            this.PlaySoundMenuItem.Checked = this._cfgCommon.PlaySound;
            this.PlaySoundFileMenuItem.Checked = this._cfgCommon.PlaySound;
            //入力欄
            StatusText.Font = _fntInputFont;
            StatusText.ForeColor = _clInputFont;

            // NameLabel のフォントを OTBaseForm.GlobalFont に変更
            this.NameLabel.Font = this.ReplaceToGlobalFont(this.NameLabel.Font);

            // 必要であれば、発言一覧と発言詳細部・入力欄の上下を入れ替える
            SplitContainer1.IsPanelInverted = !this._cfgCommon.StatusAreaAtBottom;

            //全新着通知のチェック状態により、Reply&DMの新着通知有効無効切り替え(タブ別設定にするため削除予定)
            if (this._cfgCommon.UnreadManage == false)
            {
                ReadedStripMenuItem.Enabled = false;
                UnreadStripMenuItem.Enabled = false;
            }

            if (this._cfgCommon.IsUseNotifyGrowl)
                gh.RegisterGrowl();

            //タイマー設定
            TimerTimeline.AutoReset = true;
            TimerTimeline.SynchronizingObject = this;
            //Recent取得間隔
            TimerTimeline.Interval = 1000;
            TimerTimeline.Enabled = true;

            //更新中アイコンアニメーション間隔
            TimerRefreshIcon.Interval = 200;
            TimerRefreshIcon.Enabled = true;

            //状態表示部の初期化(画面右下)
            StatusLabel.Text = "";
            StatusLabel.AutoToolTip = false;
            StatusLabel.ToolTipText = "";
            //文字カウンタ初期化
            lblLen.Text = GetRestStatusCount(true, false).ToString();

            ////////////////////////////////////////////////////////////////////////////////
            _statuses.SortOrder = (SortOrder)_cfgCommon.SortOrder;
            IdComparerClass.ComparerMode mode = IdComparerClass.ComparerMode.Id;
            switch (_cfgCommon.SortColumn)
            {
                case 0:    //0:アイコン,5:未読マーク,6:プロテクト・フィルターマーク
                case 5:
                case 6:
                    //ソートしない
                    mode = IdComparerClass.ComparerMode.Id;  //Idソートに読み替え
                    break;
                case 1:  //ニックネーム
                    mode = IdComparerClass.ComparerMode.Nickname;
                    break;
                case 2:  //本文
                    mode = IdComparerClass.ComparerMode.Data;
                    break;
                case 3:  //時刻=発言Id
                    mode = IdComparerClass.ComparerMode.Id;
                    break;
                case 4:  //名前
                    mode = IdComparerClass.ComparerMode.Name;
                    break;
                case 7:  //Source
                    mode = IdComparerClass.ComparerMode.Source;
                    break;
            }
            _statuses.SortMode = mode;
            ////////////////////////////////////////////////////////////////////////////////

            ApplyListViewIconSize(this._cfgCommon.IconSize);

            StatusLabel.Text = Properties.Resources.Form1_LoadText1;       //画面右下の状態表示を変更
            StatusLabelUrl.Text = "";            //画面左下のリンク先URL表示部を初期化
            NameLabel.Text = "";                 //発言詳細部名前ラベル初期化
            DateTimeLabel.Text = "";             //発言詳細部日時ラベル初期化
            SourceLinkLabel.Text = "";           //Source部分初期化

            //<<<<<<<<タブ関連>>>>>>>
            //デフォルトタブの存在チェック、ない場合には追加
            if (_statuses.GetTabByType(MyCommon.TabUsageType.Home) == null)
            {
                TabClass tab;
                if (!_statuses.Tabs.TryGetValue(MyCommon.DEFAULTTAB.RECENT, out tab))
                {
                    _statuses.AddTab(MyCommon.DEFAULTTAB.RECENT, MyCommon.TabUsageType.Home, null);
                }
                else
                {
                    tab.TabType = MyCommon.TabUsageType.Home;
                }
            }
            if (_statuses.GetTabByType(MyCommon.TabUsageType.Mentions) == null)
            {
                TabClass tab;
                if (!_statuses.Tabs.TryGetValue(MyCommon.DEFAULTTAB.REPLY, out tab))
                {
                    _statuses.AddTab(MyCommon.DEFAULTTAB.REPLY, MyCommon.TabUsageType.Mentions, null);
                }
                else
                {
                    tab.TabType = MyCommon.TabUsageType.Mentions;
                }
            }
            if (_statuses.GetTabByType(MyCommon.TabUsageType.DirectMessage) == null)
            {
                TabClass tab;
                if (!_statuses.Tabs.TryGetValue(MyCommon.DEFAULTTAB.DM, out tab))
                {
                    _statuses.AddTab(MyCommon.DEFAULTTAB.DM, MyCommon.TabUsageType.DirectMessage, null);
                }
                else
                {
                    tab.TabType = MyCommon.TabUsageType.DirectMessage;
                }
            }
            if (_statuses.GetTabByType(MyCommon.TabUsageType.Favorites) == null)
            {
                TabClass tab;
                if (!_statuses.Tabs.TryGetValue(MyCommon.DEFAULTTAB.FAV, out tab))
                {
                    _statuses.AddTab(MyCommon.DEFAULTTAB.FAV, MyCommon.TabUsageType.Favorites, null);
                }
                else
                {
                    tab.TabType = MyCommon.TabUsageType.Favorites;
                }
            }
            foreach (var tab in _statuses.Tabs.Values)
            {
                if (tab.TabType == MyCommon.TabUsageType.Undefined)
                {
                    tab.TabType = MyCommon.TabUsageType.UserDefined;
                }
                if (!AddNewTab(tab.TabName, true, tab.TabType, tab.ListInfo))
                    throw new TabException(Properties.Resources.TweenMain_LoadText1);
            }

            this.JumpReadOpMenuItem.ShortcutKeyDisplayString = "Space";
            CopySTOTMenuItem.ShortcutKeyDisplayString = "Ctrl+C";
            CopyURLMenuItem.ShortcutKeyDisplayString = "Ctrl+Shift+C";
            CopyUserIdStripMenuItem.ShortcutKeyDisplayString = "Shift+Alt+C";

            if (!this._cfgCommon.MinimizeToTray || this.WindowState != FormWindowState.Minimized)
            {
                this.Visible = true;
            }
            _curTab = ListTab.SelectedTab;
            _curItemIndex = -1;
            _curList = (DetailsListView)_curTab.Tag;
            SetMainWindowTitle();
            SetNotifyIconText();

            if (this._cfgCommon.TabIconDisp)
            {
                ListTab.DrawMode = TabDrawMode.Normal;
            }
            else
            {
                ListTab.DrawMode = TabDrawMode.OwnerDrawFixed;
                ListTab.DrawItem += ListTab_DrawItem;
                ListTab.ImageList = null;
            }

            _ignoreConfigSave = false;
            this.TweenMain_Resize(null, null);
            if (saveRequired) SaveConfigsAll(false);

            if (tw.UserId == 0)
                tw.VerifyCredentials();

            foreach (var ua in this._cfgCommon.UserAccounts)
            {
                if (ua.UserId == 0 && ua.Username.ToLower() == tw.Username.ToLower())
                {
                    ua.UserId = tw.UserId;
                    break;
                }
            }

            if (firstRun)
            {
                // 初回起動時だけ右下のメニューを目立たせる
                HashStripSplitButton.ShowDropDown();
            }

            // タブの位置を調整する
            SetTabAlignment();
        }
Ejemplo n.º 12
0
        private void SettingStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result;

            // 設定画面表示前のユーザー情報
            var oldUser = new { tw.AccessToken, tw.AccessTokenSecret, tw.Username, tw.UserId };

            this.SettingDialog.tw = this.tw;
            this.SettingDialog.LoadConfig(this._cfgCommon, this._cfgLocal);

            try
            {
                result = SettingDialog.ShowDialog(this);
            }
            catch (Exception)
            {
                return;
            }

            if (result == DialogResult.OK)
            {
                lock (_syncObject)
                {
                    var oldIconSz = this._cfgCommon.IconSize;

                    this.SettingDialog.SaveConfig(this._cfgCommon, this._cfgLocal);

                    tw.RestrictFavCheck = this._cfgCommon.RestrictFavCheck;
                    tw.ReadOwnPost = this._cfgCommon.ReadOwnPost;
                    ShortUrl.Instance.DisableExpanding = !this._cfgCommon.TinyUrlResolve;
                    ShortUrl.Instance.BitlyId = this._cfgCommon.BilyUser;
                    ShortUrl.Instance.BitlyKey = this._cfgCommon.BitlyPwd;
                    HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;

                    Networking.DefaultTimeout = TimeSpan.FromSeconds(this._cfgCommon.DefaultTimeOut);
                    Networking.SetWebProxy(this._cfgLocal.ProxyType,
                        this._cfgLocal.ProxyAddress, this._cfgLocal.ProxyPort,
                        this._cfgLocal.ProxyUser, this._cfgLocal.ProxyPassword);

                    ImageSelector.Reset(tw, this.tw.Configuration);

                    try
                    {
                        if (this._cfgCommon.TabIconDisp)
                        {
                            ListTab.DrawItem -= ListTab_DrawItem;
                            ListTab.DrawMode = TabDrawMode.Normal;
                            ListTab.ImageList = this.TabImage;
                        }
                        else
                        {
                            ListTab.DrawItem -= ListTab_DrawItem;
                            ListTab.DrawItem += ListTab_DrawItem;
                            ListTab.DrawMode = TabDrawMode.OwnerDrawFixed;
                            ListTab.ImageList = null;
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.Data["Instance"] = "ListTab(TabIconDisp)";
                        ex.Data["IsTerminatePermission"] = false;
                        throw;
                    }

                    try
                    {
                        if (!this._cfgCommon.UnreadManage)
                        {
                            ReadedStripMenuItem.Enabled = false;
                            UnreadStripMenuItem.Enabled = false;
                            if (this._cfgCommon.TabIconDisp)
                            {
                                foreach (TabPage myTab in ListTab.TabPages)
                                {
                                    myTab.ImageIndex = -1;
                                }
                            }
                        }
                        else
                        {
                            ReadedStripMenuItem.Enabled = true;
                            UnreadStripMenuItem.Enabled = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.Data["Instance"] = "ListTab(UnreadManage)";
                        ex.Data["IsTerminatePermission"] = false;
                        throw;
                    }

                    // タブの表示位置の決定
                    SetTabAlignment();

                    SplitContainer1.IsPanelInverted = !this._cfgCommon.StatusAreaAtBottom;

                    var imgazyobizinet = ThumbnailGenerator.ImgAzyobuziNetInstance;
                    imgazyobizinet.Enabled = this._cfgCommon.EnableImgAzyobuziNet;
                    imgazyobizinet.DisabledInDM = this._cfgCommon.ImgAzyobuziNetDisabledInDM;

                    this.PlaySoundMenuItem.Checked = this._cfgCommon.PlaySound;
                    this.PlaySoundFileMenuItem.Checked = this._cfgCommon.PlaySound;
                    _fntUnread = this._cfgLocal.FontUnread;
                    _clUnread = this._cfgLocal.ColorUnread;
                    _fntReaded = this._cfgLocal.FontRead;
                    _clReaded = this._cfgLocal.ColorRead;
                    _clFav = this._cfgLocal.ColorFav;
                    _clOWL = this._cfgLocal.ColorOWL;
                    _clRetweet = this._cfgLocal.ColorRetweet;
                    _fntDetail = this._cfgLocal.FontDetail;
                    _clDetail = this._cfgLocal.ColorDetail;
                    _clDetailLink = this._cfgLocal.ColorDetailLink;
                    _clDetailBackcolor = this._cfgLocal.ColorDetailBackcolor;
                    _clSelf = this._cfgLocal.ColorSelf;
                    _clAtSelf = this._cfgLocal.ColorAtSelf;
                    _clTarget = this._cfgLocal.ColorTarget;
                    _clAtTarget = this._cfgLocal.ColorAtTarget;
                    _clAtFromTarget = this._cfgLocal.ColorAtFromTarget;
                    _clAtTo = this._cfgLocal.ColorAtTo;
                    _clListBackcolor = this._cfgLocal.ColorListBackcolor;
                    _clInputBackcolor = this._cfgLocal.ColorInputBackcolor;
                    _clInputFont = this._cfgLocal.ColorInputFont;
                    _fntInputFont = this._cfgLocal.FontInputFont;
                    _brsBackColorMine.Dispose();
                    _brsBackColorAt.Dispose();
                    _brsBackColorYou.Dispose();
                    _brsBackColorAtYou.Dispose();
                    _brsBackColorAtFromTarget.Dispose();
                    _brsBackColorAtTo.Dispose();
                    _brsBackColorNone.Dispose();
                    _brsBackColorMine = new SolidBrush(_clSelf);
                    _brsBackColorAt = new SolidBrush(_clAtSelf);
                    _brsBackColorYou = new SolidBrush(_clTarget);
                    _brsBackColorAtYou = new SolidBrush(_clAtTarget);
                    _brsBackColorAtFromTarget = new SolidBrush(_clAtFromTarget);
                    _brsBackColorAtTo = new SolidBrush(_clAtTo);
                    _brsBackColorNone = new SolidBrush(_clListBackcolor);

                    try
                    {
                        if (StatusText.Focused) StatusText.BackColor = _clInputBackcolor;
                        StatusText.Font = _fntInputFont;
                        StatusText.ForeColor = _clInputFont;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }

                    try
                    {
                        InitDetailHtmlFormat();
                    }
                    catch (Exception ex)
                    {
                        ex.Data["Instance"] = "Font";
                        ex.Data["IsTerminatePermission"] = false;
                        throw;
                    }

                    try
                    {
                        _statuses.SetUnreadManage(this._cfgCommon.UnreadManage);
                    }
                    catch (Exception ex)
                    {
                        ex.Data["Instance"] = "_statuses";
                        ex.Data["IsTerminatePermission"] = false;
                        throw;
                    }

                    try
                    {
                        foreach (TabPage tb in ListTab.TabPages)
                        {
                            if (this._cfgCommon.TabIconDisp)
                            {
                                if (_statuses.Tabs[tb.Text].UnreadCount == 0)
                                    tb.ImageIndex = -1;
                                else
                                    tb.ImageIndex = 0;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.Data["Instance"] = "ListTab(TabIconDisp no2)";
                        ex.Data["IsTerminatePermission"] = false;
                        throw;
                    }

                    try
                    {
                        var oldIconCol = _iconCol;

                        if (this._cfgCommon.IconSize != oldIconSz)
                            ApplyListViewIconSize(this._cfgCommon.IconSize);

                        foreach (TabPage tp in ListTab.TabPages)
                        {
                            DetailsListView lst = (DetailsListView)tp.Tag;

                            using (ControlTransaction.Update(lst))
                            {
                                lst.GridLines = this._cfgCommon.ShowGrid;
                                lst.Font = _fntReaded;
                                lst.BackColor = _clListBackcolor;

                                if (_iconCol != oldIconCol)
                                    ResetColumns(lst);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ex.Data["Instance"] = "ListView(IconSize)";
                        ex.Data["IsTerminatePermission"] = false;
                        throw;
                    }

                    SetMainWindowTitle();
                    SetNotifyIconText();

                    this.PurgeListViewItemCache();
                    if (_curList != null) _curList.Refresh();
                    ListTab.Refresh();

                    _hookGlobalHotkey.UnregisterAllOriginalHotkey();
                    if (this._cfgCommon.HotkeyEnabled)
                    {
                        ///グローバルホットキーの登録。設定で変更可能にするかも
                        HookGlobalHotkey.ModKeys modKey = HookGlobalHotkey.ModKeys.None;
                        if ((this._cfgCommon.HotkeyModifier & Keys.Alt) == Keys.Alt)
                            modKey |= HookGlobalHotkey.ModKeys.Alt;
                        if ((this._cfgCommon.HotkeyModifier & Keys.Control) == Keys.Control)
                            modKey |= HookGlobalHotkey.ModKeys.Ctrl;
                        if ((this._cfgCommon.HotkeyModifier & Keys.Shift) == Keys.Shift)
                            modKey |=  HookGlobalHotkey.ModKeys.Shift;
                        if ((this._cfgCommon.HotkeyModifier & Keys.LWin) == Keys.LWin)
                            modKey |= HookGlobalHotkey.ModKeys.Win;

                        _hookGlobalHotkey.RegisterOriginalHotkey(this._cfgCommon.HotkeyKey, this._cfgCommon.HotkeyValue, modKey);
                    }

                    if (tw.Username != oldUser.Username)
                        this.doGetFollowersMenu();

                    if (this._cfgCommon.IsUseNotifyGrowl) gh.RegisterGrowl();
                    try
                    {
                        StatusText_TextChanged(null, null);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            else
            {
                // キャンセル時は Twitter クラスの認証情報を画面表示前の状態に戻す
                this.tw.Initialize(oldUser.AccessToken, oldUser.AccessTokenSecret, oldUser.Username, oldUser.UserId);
            }

            Twitter.AccountState = MyCommon.ACCOUNT_STATE.Valid;

            this.TopMost = this._cfgCommon.AlwaysTop;
            SaveConfigsAll(false);
        }
Ejemplo n.º 13
0
 private bool IsMyEventNotityAsEventType(Twitter.FormattedEvent ev)
 {
     return (ev.Eventtype & this._cfgCommon.IsMyEventNotifyFlag) != 0 ? true : !ev.IsMe;
 }
Ejemplo n.º 14
0
 public TwitterPhoto( Twitter twitter )
 {
     this.tw = twitter;
 }
Ejemplo n.º 15
0
        public void GetTextLengthRemain_DirectMessageTest()
        {
            using (var twitter = new Twitter())
            {
                // 2015年8月から DM の文字数上限が 10,000 文字に変更された
                // https://twittercommunity.com/t/41348
                twitter.Configuration.DmTextCharacterLimit = 10000;

                Assert.Equal(10000, twitter.GetTextLengthRemain("D twitter "));
                Assert.Equal(9992, twitter.GetTextLengthRemain("D twitter hogehoge"));
            }
        }
Ejemplo n.º 16
0
 private ListViewItem CreateListViewItem(Twitter.FormattedEvent source)
 {
     string[] s = { source.CreatedAt.ToString(), source.Event.ToUpper(), source.Username, source.Target };
     return new ListViewItem(s);
 }
Ejemplo n.º 17
0
        private void NotifyEvent(Twitter.FormattedEvent ev)
        {
            //新着通知
            if (BalloonRequired(ev))
            {
                NotifyIcon1.BalloonTipIcon = ToolTipIcon.Warning;
                //if (SettingDialog.DispUsername) NotifyIcon1.BalloonTipTitle = tw.Username + " - "; else NotifyIcon1.BalloonTipTitle = "";
                //NotifyIcon1.BalloonTipTitle += Application.ProductName + " [" + ev.Event.ToUpper() + "] by " + ((string)(!string.IsNullOrEmpty(ev.Username) ? ev.Username : ""), string);
                StringBuilder title = new StringBuilder();
                if (SettingDialog.DispUsername)
                {
                    title.Append(tw.Username);
                    title.Append(" - ");
                }
                else
                {
                    //title.Clear();
                }
                title.Append(Application.ProductName);
                title.Append(" [");
                title.Append(ev.Event.ToUpper());
                title.Append("] by ");
                if (!string.IsNullOrEmpty(ev.Username))
                {
                    title.Append(ev.Username.ToString());
                }
                else
                {
                    //title.Append("");
                }
                string text;
                if (!string.IsNullOrEmpty(ev.Target))
                {
                    //NotifyIcon1.BalloonTipText = ev.Target;
                    text = ev.Target;
                }
                else
                {
                    //NotifyIcon1.BalloonTipText = " ";
                    text = " ";
                }
                //NotifyIcon1.ShowBalloonTip(500);
                if (SettingDialog.IsNotifyUseGrowl)
                {
                    gh.Notify(GrowlHelper.NotifyType.UserStreamEvent,
                              ev.Id.ToString(), title.ToString(), text);
                }
                else
                {
                    NotifyIcon1.BalloonTipIcon = ToolTipIcon.Warning;
                    NotifyIcon1.BalloonTipTitle = title.ToString();
                    NotifyIcon1.BalloonTipText = text;
                    NotifyIcon1.ShowBalloonTip(500);
                }
            }

            //サウンド再生
            string snd = SettingDialog.EventSoundFile;
            if (!_initial && SettingDialog.PlaySound && !string.IsNullOrEmpty(snd))
            {
                if ((ev.Eventtype & SettingDialog.EventNotifyFlag) != 0 && IsMyEventNotityAsEventType(ev))
                {
                    try
                    {
                        string dir = Application.StartupPath;
                        if (Directory.Exists(Path.Combine(dir, "Sounds")))
                        {
                            dir = Path.Combine(dir, "Sounds");
                        }
                        using (SoundPlayer player = new SoundPlayer(Path.Combine(dir, snd)))
                        {
                            player.Play();
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Ejemplo n.º 18
0
 private bool BalloonRequired(Twitter.FormattedEvent ev)
 {
     if ((
         IsEventNotifyAsEventType(ev.Eventtype) && IsMyEventNotityAsEventType(ev) &&
         (NewPostPopMenuItem.Checked || (SettingDialog.ForceEventNotify && ev.Eventtype != MyCommon.EVENTTYPE.None)) &&
         !_initial &&
         (
             (
                 SettingDialog.LimitBalloon &&
                 (
                     this.WindowState == FormWindowState.Minimized ||
                     !this.Visible ||
                     Form.ActiveForm == null
                     )
                 ) ||
             !SettingDialog.LimitBalloon
             )
         ) &&
         !Win32Api.IsScreenSaverRunning())
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Ejemplo n.º 19
0
 public void GetTextLengthRemain_SurrogatePairTest()
 {
     using (var twitter = new Twitter())
     {
         Assert.Equal(139, twitter.GetTextLengthRemain("🍣"));
         Assert.Equal(133, twitter.GetTextLengthRemain("🔥🐔🔥 焼き鳥"));
     }
 }
Ejemplo n.º 20
0
        public void GetTextLengthRemain_UrlWithoutSchemeTest()
        {
            using (var twitter = new Twitter())
            {
                // t.co に短縮される分の文字数を考慮
                twitter.Configuration.ShortUrlLength = 20;
                Assert.Equal(120, twitter.GetTextLengthRemain("example.com"));
                Assert.Equal(120, twitter.GetTextLengthRemain("example.com/hogehoge"));
                Assert.Equal(111, twitter.GetTextLengthRemain("hogehoge example.com"));

                // スキーム (http://) を省略かつ末尾が ccTLD の場合は t.co に短縮されない
                Assert.Equal(130, twitter.GetTextLengthRemain("example.jp"));
                // ただし、末尾にパスが続く場合は t.co に短縮される
                Assert.Equal(120, twitter.GetTextLengthRemain("example.jp/hogehoge"));
            }
        }
Ejemplo n.º 21
0
        public void GetTextLengthRemain_UrlTest()
        {
            using (var twitter = new Twitter())
            {
                // t.co に短縮される分の文字数を考慮
                twitter.Configuration.ShortUrlLength = 20;
                Assert.Equal(120, twitter.GetTextLengthRemain("http://example.com/"));
                Assert.Equal(120, twitter.GetTextLengthRemain("http://example.com/hogehoge"));
                Assert.Equal(111, twitter.GetTextLengthRemain("hogehoge http://example.com/"));

                twitter.Configuration.ShortUrlLengthHttps = 21;
                Assert.Equal(119, twitter.GetTextLengthRemain("https://example.com/"));
                Assert.Equal(119, twitter.GetTextLengthRemain("https://example.com/hogehoge"));
                Assert.Equal(110, twitter.GetTextLengthRemain("hogehoge https://example.com/"));
            }
        }
Ejemplo n.º 22
0
 public UserStreamEventReceivedEventArgs(Twitter.FormattedEvent eventData)
 {
     this.eventData = eventData;
 }
Ejemplo n.º 23
0
 private void tw_UserStreamEventArrived(Twitter.FormattedEvent ev)
 {
     try
     {
         if (InvokeRequired && !IsDisposed)
         {
             Invoke(new Action<Twitter.FormattedEvent>(tw_UserStreamEventArrived), ev);
             return;
         }
     }
     catch (ObjectDisposedException)
     {
         return;
     }
     catch (InvalidOperationException)
     {
         return;
     }
     StatusLabel.Text = "Event: " + ev.Event;
     //if (ev.Event == "favorite")
     //{
     //    NotifyFavorite(ev);
     //}
     NotifyEvent(ev);
     if (ev.Event == "favorite" || ev.Event == "unfavorite")
     {
         if (_curTab != null && _statuses.Tabs[_curTab.Text].Contains(ev.Id))
         {
             _itemCache = null;
             _itemCacheIndex = -1;
             _postCache = null;
             ((DetailsListView)_curTab.Tag).Update();
         }
         if (ev.Event == "unfavorite" && ev.Username.ToLower().Equals(tw.Username.ToLower()))
         {
             RemovePostFromFavTab(new long[] {ev.Id});
         }
     }
 }
Ejemplo n.º 24
0
 public void GetTextLengthRemain_Test()
 {
     using (var twitter = new Twitter())
     {
         Assert.Equal(140, twitter.GetTextLengthRemain(""));
         Assert.Equal(132, twitter.GetTextLengthRemain("hogehoge"));
     }
 }
Ejemplo n.º 25
0
 private bool IsMyEventNotityAsEventType(Twitter.FormattedEvent ev)
 {
     return (ev.Eventtype & SettingDialog.IsMyEventNotifyFlag) != 0 ? true : !ev.IsMe;
 }
Ejemplo n.º 26
0
        private void CreateServices(Twitter tw, TwitterConfiguration twitterConfig)
        {
            if (this.pictureService != null) this.pictureService.Clear();
            this.pictureService = null;

            this.pictureService = new Dictionary<string, IMediaUploadService> {
                {"Twitter", new TwitterPhoto(tw, twitterConfig)},
                {"img.ly", new imgly(tw, twitterConfig)},
                {"yfrog", new yfrog(tw, twitterConfig)},
                {"ついっぷるフォト", new TwipplePhoto(tw, twitterConfig)},
                {"Imgur", new Imgur(tw, twitterConfig)},
                {"Mobypicture", new Mobypicture(tw, twitterConfig)},
            };
        }
Ejemplo n.º 27
0
 private bool IsFilterMatch(Twitter.FormattedEvent x)
 {
     if (!CheckBoxFilter.Checked || string.IsNullOrEmpty(TextBoxKeyword.Text))
     {
         return true;
     }
     else
     {
         if (CheckRegex.Checked)
         {
             try
             {
                 Regex rx = new Regex(TextBoxKeyword.Text);
                 return rx.Match(x.Username).Success || rx.Match(x.Target).Success;
             }
             catch (Exception ex)
             {
                 MessageBox.Show(Properties.Resources.ButtonOK_ClickText3 + ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 return false;
             }
         }
         else
         {
             return x.Username.Contains(TextBoxKeyword.Text) || x.Target.Contains(TextBoxKeyword.Text);
         }
     }
 }
Ejemplo n.º 28
0
        /// <summary>
        /// 投稿先サービスなどを初期化する。
        /// </summary>
        public void Initialize(Twitter tw, TwitterConfiguration twitterConfig, string svc, int? index = null)
        {
            CreateServices(tw, twitterConfig);

            SetImageServiceCombo();
            SetImagePageCombo();

            SelectImageServiceComboItem(svc, index);
        }
Ejemplo n.º 29
0
        private void Setting_Load(object sender, EventArgs e)
        {
            #if UA
            this.FollowCheckBox.Text = string.Format(this.FollowCheckBox.Text, ApplicationSettings.FeedbackTwitterName);
            this.GroupBox2.Visible = true;
            #else
            this.GroupBox2.Visible = false;
            #endif
            tw = ((TweenMain)this.Owner).TwitterInstance;
            string uname = tw.Username;
            string pw = tw.Password;
            string tk = tw.AccessToken;
            string tks = tw.AccessTokenSecret;
            //this.AuthStateLabel.Enabled = true;
            //this.AuthUserLabel.Enabled = true;
            this.AuthClearButton.Enabled = true;

            //if (tw.Username == "")
            //{
            //    //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4
            //    //this.AuthUserLabel.Text = ""
            //    //this.Save.Enabled = false
            //}
            //else
            //{
            //    //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
            //    //if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWrite)
            //    //{
            //    //    this.AuthStateLabel.Text += "(xAuth)";
            //    //}
            //    //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
            //    //{
            //    //    this.AuthStateLabel.Text += "(OAuth)";
            //    //}
            //    //this.AuthUserLabel.Text = tw.Username;
            //}

            this.AuthUserCombo.Items.Clear();
            if (this.UserAccounts.Count > 0)
            {
                this.AuthUserCombo.Items.AddRange(this.UserAccounts.ToArray());
                foreach (UserAccount u in this.UserAccounts)
                {
                    if (u.UserId == tw.UserId)
                    {
                        this.AuthUserCombo.SelectedItem = u;
                        this.InitialUserId = u.UserId;
                        break;
                    }
                }
            }

            this.StartupUserstreamCheck.Checked = UserstreamStartup;
            UserstreamPeriod.Text = UserstreamPeriodInt.ToString();
            TimelinePeriod.Text = TimelinePeriodInt.ToString();
            ReplyPeriod.Text = ReplyPeriodInt.ToString();
            DMPeriod.Text = DMPeriodInt.ToString();
            PubSearchPeriod.Text = PubSearchPeriodInt.ToString();
            ListsPeriod.Text = ListsPeriodInt.ToString();
            UserTimelinePeriod.Text = UserTimelinePeriodInt.ToString();

            StartupReaded.Checked = Readed;
            switch (IconSz)
            {
                case MyCommon.IconSizes.IconNone:
                    IconSize.SelectedIndex = 0;
                    break;
                case MyCommon.IconSizes.Icon16:
                    IconSize.SelectedIndex = 1;
                    break;
                case MyCommon.IconSizes.Icon24:
                    IconSize.SelectedIndex = 2;
                    break;
                case MyCommon.IconSizes.Icon48:
                    IconSize.SelectedIndex = 3;
                    break;
                case MyCommon.IconSizes.Icon48_2:
                    IconSize.SelectedIndex = 4;
                    break;
            }
            StatusText.Text = Status;
            UReadMng.Checked = UnreadManage;
            if (UnreadManage == false)
            {
                StartupReaded.Enabled = false;
            }
            else
            {
                StartupReaded.Enabled = true;
            }
            PlaySnd.Checked = PlaySound;
            OneWayLv.Checked = OneWayLove;

            lblListFont.Font = FontReaded;
            lblUnread.Font = FontUnread;
            lblUnread.ForeColor = ColorUnread;
            lblListFont.ForeColor = ColorReaded;
            lblFav.ForeColor = ColorFav;
            lblOWL.ForeColor = ColorOWL;
            lblRetweet.ForeColor = ColorRetweet;
            lblDetail.Font = FontDetail;
            lblSelf.BackColor = ColorSelf;
            lblAtSelf.BackColor = ColorAtSelf;
            lblTarget.BackColor = ColorTarget;
            lblAtTarget.BackColor = ColorAtTarget;
            lblAtFromTarget.BackColor = ColorAtFromTarget;
            lblAtTo.BackColor = ColorAtTo;
            lblInputBackcolor.BackColor = ColorInputBackcolor;
            lblInputFont.ForeColor = ColorInputFont;
            lblInputFont.Font = FontInputFont;
            lblListBackcolor.BackColor = ColorListBackcolor;
            lblDetailBackcolor.BackColor = ColorDetailBackcolor;
            lblDetail.ForeColor = ColorDetail;
            lblDetailLink.ForeColor = ColorDetailLink;

            switch (NameBalloon)
            {
                case MyCommon.NameBalloonEnum.None:
                    cmbNameBalloon.SelectedIndex = 0;
                    break;
                case MyCommon.NameBalloonEnum.UserID:
                    cmbNameBalloon.SelectedIndex = 1;
                    break;
                case MyCommon.NameBalloonEnum.NickName:
                    cmbNameBalloon.SelectedIndex = 2;
                    break;
            }

            if (PostCtrlEnter)
            {
                ComboBoxPostKeySelect.SelectedIndex = 1;
            }
            else if (PostShiftEnter)
            {
                ComboBoxPostKeySelect.SelectedIndex = 2;
            }
            else
            {
                ComboBoxPostKeySelect.SelectedIndex = 0;
            }

            TextCountApi.Text = CountApi.ToString();
            TextCountApiReply.Text = CountApiReply.ToString();
            BrowserPathText.Text = BrowserPath;
            CheckPostAndGet.Checked = PostAndGet;
            CheckUseRecommendStatus.Checked = UseRecommendStatus;
            CheckDispUsername.Checked = DispUsername;
            CheckCloseToExit.Checked = CloseToExit;
            CheckMinimizeToTray.Checked = MinimizeToTray;
            switch (DispLatestPost)
            {
                case MyCommon.DispTitleEnum.None:
                    ComboDispTitle.SelectedIndex = 0;
                    break;
                case MyCommon.DispTitleEnum.Ver:
                    ComboDispTitle.SelectedIndex = 1;
                    break;
                case MyCommon.DispTitleEnum.Post:
                    ComboDispTitle.SelectedIndex = 2;
                    break;
                case MyCommon.DispTitleEnum.UnreadRepCount:
                    ComboDispTitle.SelectedIndex = 3;
                    break;
                case MyCommon.DispTitleEnum.UnreadAllCount:
                    ComboDispTitle.SelectedIndex = 4;
                    break;
                case MyCommon.DispTitleEnum.UnreadAllRepCount:
                    ComboDispTitle.SelectedIndex = 5;
                    break;
                case MyCommon.DispTitleEnum.UnreadCountAllCount:
                    ComboDispTitle.SelectedIndex = 6;
                    break;
                case MyCommon.DispTitleEnum.OwnStatus:
                    ComboDispTitle.SelectedIndex = 7;
                    break;
            }
            CheckSortOrderLock.Checked = SortOrderLock;
            CheckViewTabBottom.Checked = ViewTabBottom;
            CheckTinyURL.Checked = TinyUrlResolve;
            CheckForceResolve.Checked = ShortUrlForceResolve;
            switch (_MyProxyType)
            {
                case HttpConnection.ProxyType.None:
                    RadioProxyNone.Checked = true;
                    break;
                case HttpConnection.ProxyType.IE:
                    RadioProxyIE.Checked = true;
                    break;
                default:
                    RadioProxySpecified.Checked = true;
                    break;
            }
            bool chk = RadioProxySpecified.Checked;
            LabelProxyAddress.Enabled = chk;
            TextProxyAddress.Enabled = chk;
            LabelProxyPort.Enabled = chk;
            TextProxyPort.Enabled = chk;
            LabelProxyUser.Enabled = chk;
            TextProxyUser.Enabled = chk;
            LabelProxyPassword.Enabled = chk;
            TextProxyPassword.Enabled = chk;

            TextProxyAddress.Text = ProxyAddress;
            TextProxyPort.Text = ProxyPort.ToString();
            TextProxyUser.Text = ProxyUser;
            TextProxyPassword.Text = ProxyPassword;

            CheckPeriodAdjust.Checked = PeriodAdjust;
            CheckStartupVersion.Checked = StartupVersion;
            if (ApplicationSettings.VersionInfoUrl == null)
                CheckStartupVersion.Enabled = false; // 更新チェック無効化
            CheckStartupFollowers.Checked = StartupFollowers;
            CheckFavRestrict.Checked = RestrictFavCheck;
            CheckAlwaysTop.Checked = AlwaysTop;
            CheckAutoConvertUrl.Checked = UrlConvertAuto;
            ShortenTcoCheck.Checked = ShortenTco;
            ShortenTcoCheck.Enabled = CheckAutoConvertUrl.Checked;
            CheckOutputz.Checked = OutputzEnabled;
            TextBoxOutputzKey.Text = OutputzKey;

            switch (OutputzUrlmode)
            {
                case MyCommon.OutputzUrlmode.twittercom:
                    ComboBoxOutputzUrlmode.SelectedIndex = 0;
                    break;
                case MyCommon.OutputzUrlmode.twittercomWithUsername:
                    ComboBoxOutputzUrlmode.SelectedIndex = 1;
                    break;
            }

            CheckNicoms.Checked = Nicoms;
            chkUnreadStyle.Checked = UseUnreadStyle;
            CmbDateTimeFormat.Text = DateTimeFormat;
            ConnectionTimeOut.Text = DefaultTimeOut.ToString();
            CheckRetweetNoConfirm.Checked = RetweetNoConfirm;
            CheckBalloonLimit.Checked = LimitBalloon;

            ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
            CheckForceEventNotify.Checked = ForceEventNotify;
            CheckFavEventUnread.Checked = FavEventUnread;
            ComboBoxTranslateLanguage.SelectedIndex = (new Bing()).GetIndexFromLanguageEnum(TranslateLanguage);
            SoundFileListup();
            ComboBoxAutoShortUrlFirst.SelectedIndex = (int)AutoShortUrlFirst;
            chkTabIconDisp.Checked = TabIconDisp;
            chkReadOwnPost.Checked = ReadOwnPost;
            chkGetFav.Checked = GetFav;
            CheckMonospace.Checked = IsMonospace;
            CheckReadOldPosts.Checked = ReadOldPosts;
            CheckUseSsl.Checked = UseSsl;
            TextBitlyId.Text = BitlyUser;
            TextBitlyPw.Text = BitlyPwd;
            TextBitlyId.Modified = false;
            TextBitlyPw.Modified = false;
            CheckShowGrid.Checked = ShowGrid;
            CheckAtIdSupple.Checked = UseAtIdSupplement;
            CheckHashSupple.Checked = UseHashSupplement;
            CheckPreviewEnable.Checked = PreviewEnable;
            TwitterAPIText.Text = TwitterApiUrl;
            TwitterSearchAPIText.Text = TwitterSearchApiUrl;
            switch (ReplyIconState)
            {
                case MyCommon.REPLY_ICONSTATE.None:
                    ReplyIconStateCombo.SelectedIndex = 0;
                    break;
                case MyCommon.REPLY_ICONSTATE.StaticIcon:
                    ReplyIconStateCombo.SelectedIndex = 1;
                    break;
                case MyCommon.REPLY_ICONSTATE.BlinkIcon:
                    ReplyIconStateCombo.SelectedIndex = 2;
                    break;
            }
            switch (Language)
            {
                case "OS":
                    LanguageCombo.SelectedIndex = 0;
                    break;
                case "ja":
                    LanguageCombo.SelectedIndex = 1;
                    break;
                case "en":
                    LanguageCombo.SelectedIndex = 2;
                    break;
                case "zh-CN":
                    LanguageCombo.SelectedIndex = 3;
                    break;
                default:
                    LanguageCombo.SelectedIndex = 0;
                    break;
            }
            HotkeyCheck.Checked = HotkeyEnabled;
            HotkeyAlt.Checked = ((HotkeyMod & Keys.Alt) == Keys.Alt);
            HotkeyCtrl.Checked = ((HotkeyMod & Keys.Control) == Keys.Control);
            HotkeyShift.Checked = ((HotkeyMod & Keys.Shift) == Keys.Shift);
            HotkeyWin.Checked = ((HotkeyMod & Keys.LWin) == Keys.LWin);
            HotkeyCode.Text = HotkeyValue.ToString();
            HotkeyText.Text = HotkeyKey.ToString();
            HotkeyText.Tag = HotkeyKey;
            HotkeyAlt.Enabled = HotkeyEnabled;
            HotkeyShift.Enabled = HotkeyEnabled;
            HotkeyCtrl.Enabled = HotkeyEnabled;
            HotkeyWin.Enabled = HotkeyEnabled;
            HotkeyText.Enabled = HotkeyEnabled;
            HotkeyCode.Enabled = HotkeyEnabled;
            ChkNewMentionsBlink.Checked = BlinkNewMentions;

            CheckOutputz_CheckedChanged(sender, e);

            GetMoreTextCountApi.Text = MoreCountApi.ToString();
            FirstTextCountApi.Text = FirstCountApi.ToString();
            SearchTextCountApi.Text = SearchCountApi.ToString();
            FavoritesTextCountApi.Text = FavoritesCountApi.ToString();
            UserTimelineTextCountApi.Text = UserTimelineCountApi.ToString();
            ListTextCountApi.Text = ListCountApi.ToString();
            UseChangeGetCount.Checked = UseAdditionalCount;
            Label28.Enabled = UseChangeGetCount.Checked;
            Label30.Enabled = UseChangeGetCount.Checked;
            Label53.Enabled = UseChangeGetCount.Checked;
            Label66.Enabled = UseChangeGetCount.Checked;
            Label17.Enabled = UseChangeGetCount.Checked;
            Label25.Enabled = UseChangeGetCount.Checked;
            GetMoreTextCountApi.Enabled = UseChangeGetCount.Checked;
            FirstTextCountApi.Enabled = UseChangeGetCount.Checked;
            SearchTextCountApi.Enabled = UseChangeGetCount.Checked;
            FavoritesTextCountApi.Enabled = UseChangeGetCount.Checked;
            UserTimelineTextCountApi.Enabled = UseChangeGetCount.Checked;
            ListTextCountApi.Enabled = UseChangeGetCount.Checked;
            CheckOpenUserTimeline.Checked = OpenUserTimeline;
            ListDoubleClickActionComboBox.SelectedIndex = ListDoubleClickAction;
            UserAppointUrlText.Text = UserAppointUrl;
            this.HideDuplicatedRetweetsCheck.Checked = this.HideDuplicatedRetweets;
            this.IsPreviewFoursquareCheckBox.Checked = this.IsPreviewFoursquare;
            this.MapThumbnailProviderComboBox.SelectedIndex = (int)this.MapThumbnailProvider;
            this.MapThumbnailHeightTextBox.Text = this.MapThumbnailHeight.ToString();
            this.MapThumbnailWidthTextBox.Text = this.MapThumbnailWidth.ToString();
            this.MapThumbnailZoomTextBox.Text = this.MapThumbnailZoom.ToString();
            this.IsListsIncludeRtsCheckBox.Checked = this.IsListStatusesIncludeRts;
            this.TabMouseLockCheck.Checked = this.TabMouseLock;
            this.IsRemoveSameFavEventCheckBox.Checked = this.IsRemoveSameEvent;
            this.IsNotifyUseGrowlCheckBox.Checked = this.IsNotifyUseGrowl;

            if (GrowlHelper.IsDllExists)
            {
                IsNotifyUseGrowlCheckBox.Enabled = true;
            }
            else
            {
                IsNotifyUseGrowlCheckBox.Enabled = false;
            }

            this.TreeViewSetting.Nodes["BasedNode"].Tag = BasedPanel;
            this.TreeViewSetting.Nodes["BasedNode"].Nodes["PeriodNode"].Tag = GetPeriodPanel;
            this.TreeViewSetting.Nodes["BasedNode"].Nodes["StartUpNode"].Tag = StartupPanel;
            this.TreeViewSetting.Nodes["BasedNode"].Nodes["GetCountNode"].Tag = GetCountPanel;
            //this.TreeViewSetting.Nodes["BasedNode"].Nodes["UserStreamNode"].Tag = UserStreamPanel;
            this.TreeViewSetting.Nodes["ActionNode"].Tag = ActionPanel;
            this.TreeViewSetting.Nodes["ActionNode"].Nodes["TweetActNode"].Tag = TweetActPanel;
            this.TreeViewSetting.Nodes["PreviewNode"].Tag = PreviewPanel;
            this.TreeViewSetting.Nodes["PreviewNode"].Nodes["TweetPrvNode"].Tag = TweetPrvPanel;
            this.TreeViewSetting.Nodes["PreviewNode"].Nodes["NotifyNode"].Tag = NotifyPanel;
            this.TreeViewSetting.Nodes["FontNode"].Tag = FontPanel;
            this.TreeViewSetting.Nodes["FontNode"].Nodes["FontNode2"].Tag = FontPanel2;
            this.TreeViewSetting.Nodes["ConnectionNode"].Tag = ConnectionPanel;
            this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ProxyNode"].Tag = ProxyPanel;
            this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["CooperateNode"].Tag = CooperatePanel;
            this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"].Tag = ShortUrlPanel;

            this.TreeViewSetting.SelectedNode = this.TreeViewSetting.Nodes[0];
            this.TreeViewSetting.ExpandAll();

            //TreeViewSetting.SelectedNode = TreeViewSetting.TopNode;
            ActiveControl = StartAuthButton;
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 投稿先サービスを再作成する。
        /// </summary>
        public void Reset(Twitter tw, TwitterConfiguration twitterConfig)
        {
            CreateServices(tw, twitterConfig);

            SetImageServiceCombo();
        }