示例#1
0
 private void OK_Button_Click(object sender, EventArgs e)
 {
     if (this.ListsList.SelectedIndex > -1) {
         _selectedList = (ListElement)this.ListsList.SelectedItem;
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         this.Close();
     }
 }
示例#2
0
        public string EditList(string list_id, string new_name, bool isPrivate, string description, ref ListElement list)
        {
            HttpStatusCode res = HttpStatusCode.BadRequest;
            var content = string.Empty;

            try
            {
                res = twCon.UpdateListID(this.Username, list_id, new_name, isPrivate, description, ref content);
            }
            catch(Exception ex)
            {
                return "Err:" + ex.Message + "(" + MethodBase.GetCurrentMethod().Name + ")";
            }

            switch (res)
            {
                case HttpStatusCode.OK:
                    Twitter.AccountState = MyCommon.ACCOUNT_STATE.Valid;
                    break;
                case HttpStatusCode.Unauthorized:
                    Twitter.AccountState = MyCommon.ACCOUNT_STATE.Invalid;
                    return Properties.Resources.Unauthorized;
                case HttpStatusCode.BadRequest:
                    return "Err:API Limits?";
                default:
                    return "Err:" + res.ToString() + "(" + MethodBase.GetCurrentMethod().Name + ")";
            }

            try
            {
                var le = MyCommon.CreateDataFromJson<TwitterDataModel.ListElementData>(content);
                var newList = new ListElement(le, this);
                list.Description = newList.Description;
                list.Id = newList.Id;
                list.IsPublic = newList.IsPublic;
                list.MemberCount = newList.MemberCount;
                list.Name = newList.Name;
                list.SubscriberCount = newList.SubscriberCount;
                list.Slug = newList.Slug;
                list.Nickname = newList.Nickname;
                list.Username = newList.Username;
                list.UserId = newList.UserId;
                return string.Empty;
            }
            catch(SerializationException ex)
            {
                MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
                return "Err:Json Parse Error(DataContractJsonSerializer)";
            }
            catch(Exception ex)
            {
                MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
                return "Err:Invalid Json!";
            }
        }
示例#3
0
        private async Task RemoveFromList(ListElement list)
        {
            try
            {
                await this.twitterApi.ListsMembersDestroy(list.Id, this.contextScreenName);

                var index = this.ListsCheckedListBox.Items.IndexOf(list);
                this.ListsCheckedListBox.SetItemCheckState(index, CheckState.Unchecked);
            }
            catch (WebApiException ex)
            {
                MessageBox.Show(string.Format(Properties.Resources.ListManageOKButton2, ex.Message));
            }
        }
示例#4
0
        public bool AddNewTab(string tabName, bool startup, MyCommon.TabUsageType tabType, ListElement listInfo = null)
        {
            //重複チェック
            foreach (TabPage tb in ListTab.TabPages)
            {
                if (tb.Text == tabName) return false;
            }

            //新規タブ名チェック
            if (tabName == Properties.Resources.AddNewTabText1) return false;

            //タブタイプ重複チェック
            if (!startup)
            {
                if (tabType == MyCommon.TabUsageType.DirectMessage ||
                   tabType == MyCommon.TabUsageType.Favorites ||
                   tabType == MyCommon.TabUsageType.Home ||
                   tabType == MyCommon.TabUsageType.Mentions ||
                   tabType == MyCommon.TabUsageType.Related)
                {
                    if (_statuses.GetTabByType(tabType) != null) return false;
                }
            }

            TabPage _tabPage = new TabPage();
            DetailsListView _listCustom = new DetailsListView();
            ColumnHeader _colHd1 = new ColumnHeader();  //アイコン
            ColumnHeader _colHd2 = new ColumnHeader();   //ニックネーム
            ColumnHeader _colHd3 = new ColumnHeader();   //本文
            ColumnHeader _colHd4 = new ColumnHeader();   //日付
            ColumnHeader _colHd5 = new ColumnHeader();   //ユーザID
            ColumnHeader _colHd6 = new ColumnHeader();   //未読
            ColumnHeader _colHd7 = new ColumnHeader();   //マーク&プロテクト
            ColumnHeader _colHd8 = new ColumnHeader();   //ソース

            int cnt = ListTab.TabPages.Count;

            ///ToDo:Create and set controls follow tabtypes

            this.SplitContainer1.Panel1.SuspendLayout();
            this.SplitContainer1.Panel2.SuspendLayout();
            this.SplitContainer1.SuspendLayout();
            this.ListTab.SuspendLayout();
            this.SuspendLayout();

            _tabPage.SuspendLayout();

            /// UserTimeline関連
            Label label = null;
            if (tabType == MyCommon.TabUsageType.UserTimeline || tabType == MyCommon.TabUsageType.Lists)
            {
                label = new Label();
                label.Dock = DockStyle.Top;
                label.Name = "labelUser";
                if (tabType == MyCommon.TabUsageType.Lists)
                {
                    label.Text = listInfo.ToString();
                }
                else
                {
                    label.Text = _statuses.Tabs[tabName].User + "'s Timeline";
                }
                label.TextAlign = ContentAlignment.MiddleLeft;
                using (ComboBox tmpComboBox = new ComboBox())
                {
                    label.Height = tmpComboBox.Height;
                }
                _tabPage.Controls.Add(label);
            }

            /// 検索関連の準備
            Panel pnl = null;
            if (tabType == MyCommon.TabUsageType.PublicSearch)
            {
                pnl = new Panel();

                Label lbl = new Label();
                ComboBox cmb = new ComboBox();
                Button btn = new Button();
                ComboBox cmbLang = new ComboBox();

                pnl.SuspendLayout();

                pnl.Controls.Add(cmb);
                pnl.Controls.Add(cmbLang);
                pnl.Controls.Add(btn);
                pnl.Controls.Add(lbl);
                pnl.Name = "panelSearch";
                pnl.Dock = DockStyle.Top;
                pnl.Height = cmb.Height;
                pnl.Enter += SearchControls_Enter;
                pnl.Leave += SearchControls_Leave;

                cmb.Text = "";
                cmb.Anchor = AnchorStyles.Left | AnchorStyles.Right;
                cmb.Dock = DockStyle.Fill;
                cmb.Name = "comboSearch";
                cmb.DropDownStyle = ComboBoxStyle.DropDown;
                cmb.ImeMode = ImeMode.NoControl;
                cmb.TabStop = false;
                cmb.AutoCompleteMode = AutoCompleteMode.None;
                cmb.KeyDown += SearchComboBox_KeyDown;

                if (_statuses.ContainsTab(tabName))
                {
                    cmb.Items.Add(_statuses.Tabs[tabName].SearchWords);
                    cmb.Text = _statuses.Tabs[tabName].SearchWords;
                }

                cmbLang.Text = "";
                cmbLang.Anchor = AnchorStyles.Left | AnchorStyles.Right;
                cmbLang.Dock = DockStyle.Right;
                cmbLang.Width = 50;
                cmbLang.Name = "comboLang";
                cmbLang.DropDownStyle = ComboBoxStyle.DropDownList;
                cmbLang.TabStop = false;
                cmbLang.Items.Add("");
                cmbLang.Items.Add("ja");
                cmbLang.Items.Add("en");
                cmbLang.Items.Add("ar");
                cmbLang.Items.Add("da");
                cmbLang.Items.Add("nl");
                cmbLang.Items.Add("fa");
                cmbLang.Items.Add("fi");
                cmbLang.Items.Add("fr");
                cmbLang.Items.Add("de");
                cmbLang.Items.Add("hu");
                cmbLang.Items.Add("is");
                cmbLang.Items.Add("it");
                cmbLang.Items.Add("no");
                cmbLang.Items.Add("pl");
                cmbLang.Items.Add("pt");
                cmbLang.Items.Add("ru");
                cmbLang.Items.Add("es");
                cmbLang.Items.Add("sv");
                cmbLang.Items.Add("th");
                if (_statuses.ContainsTab(tabName)) cmbLang.Text = _statuses.Tabs[tabName].SearchLang;

                lbl.Text = "Search(C-S-f)";
                lbl.Name = "label1";
                lbl.Dock = DockStyle.Left;
                lbl.Width = 90;
                lbl.Height = cmb.Height;
                lbl.TextAlign = ContentAlignment.MiddleLeft;

                btn.Text = "Search";
                btn.Name = "buttonSearch";
                btn.UseVisualStyleBackColor = true;
                btn.Dock = DockStyle.Right;
                btn.TabStop = false;
                btn.Click += SearchButton_Click;
            }

            this.ListTab.Controls.Add(_tabPage);
            _tabPage.Controls.Add(_listCustom);

            if (tabType == MyCommon.TabUsageType.PublicSearch) _tabPage.Controls.Add(pnl);
            if (tabType == MyCommon.TabUsageType.UserTimeline || tabType == MyCommon.TabUsageType.Lists) _tabPage.Controls.Add(label);

            _tabPage.Location = new Point(4, 4);
            _tabPage.Name = "CTab" + cnt.ToString();
            _tabPage.Size = new Size(380, 260);
            _tabPage.TabIndex = 2 + cnt;
            _tabPage.Text = tabName;
            _tabPage.UseVisualStyleBackColor = true;

            _listCustom.AllowColumnReorder = true;
            if (!_iconCol)
            {
                _listCustom.Columns.AddRange(new ColumnHeader[] {_colHd1, _colHd2, _colHd3, _colHd4, _colHd5, _colHd6, _colHd7, _colHd8});
            }
            else
            {
                _listCustom.Columns.AddRange(new ColumnHeader[] {_colHd1, _colHd3});
            }
            _listCustom.ContextMenuStrip = this.ContextMenuOperate;
            _listCustom.Dock = DockStyle.Fill;
            _listCustom.FullRowSelect = true;
            _listCustom.HideSelection = false;
            _listCustom.Location = new Point(0, 0);
            _listCustom.Margin = new Padding(0);
            _listCustom.Name = "CList" + Environment.TickCount.ToString();
            _listCustom.ShowItemToolTips = true;
            _listCustom.Size = new Size(380, 260);
            _listCustom.UseCompatibleStateImageBehavior = false;
            _listCustom.View = View.Details;
            _listCustom.OwnerDraw = true;
            _listCustom.VirtualMode = true;
            _listCustom.Font = _fntReaded;
            _listCustom.BackColor = _clListBackcolor;

            _listCustom.GridLines = SettingDialog.ShowGrid;
            _listCustom.AllowDrop = true;

            _listCustom.SelectedIndexChanged += MyList_SelectedIndexChanged;
            _listCustom.MouseDoubleClick += MyList_MouseDoubleClick;
            _listCustom.ColumnClick += MyList_ColumnClick;
            _listCustom.DrawColumnHeader += MyList_DrawColumnHeader;
            _listCustom.DragDrop += TweenMain_DragDrop;
            _listCustom.DragOver += TweenMain_DragOver;
            _listCustom.DrawItem += MyList_DrawItem;
            _listCustom.MouseClick += MyList_MouseClick;
            _listCustom.ColumnReordered += MyList_ColumnReordered;
            _listCustom.ColumnWidthChanged += MyList_ColumnWidthChanged;
            _listCustom.CacheVirtualItems += MyList_CacheVirtualItems;
            _listCustom.RetrieveVirtualItem += MyList_RetrieveVirtualItem;
            _listCustom.DrawSubItem += MyList_DrawSubItem;
            _listCustom.HScrolled += MyList_HScrolled;

            InitColumnText();
            _colHd1.Text = ColumnText[0];
            _colHd1.Width = 48;
            _colHd2.Text = ColumnText[1];
            _colHd2.Width = 80;
            _colHd3.Text = ColumnText[2];
            _colHd3.Width = 300;
            _colHd4.Text = ColumnText[3];
            _colHd4.Width = 50;
            _colHd5.Text = ColumnText[4];
            _colHd5.Width = 50;
            _colHd6.Text = ColumnText[5];
            _colHd6.Width = 16;
            _colHd7.Text = ColumnText[6];
            _colHd7.Width = 16;
            _colHd8.Text = ColumnText[7];
            _colHd8.Width = 50;

            if (_statuses.IsDistributableTab(tabName)) TabDialog.AddTab(tabName);

            _listCustom.SmallImageList = new ImageList();
            if (_iconSz > 0)
            {
                _listCustom.SmallImageList.ImageSize = new Size(_iconSz, _iconSz);
            }
            else
            {
                _listCustom.SmallImageList.ImageSize = new Size(1, 1);
            }

            int[] dispOrder = new int[8];
            if (!startup)
            {
                for (int i = 0; i < _curList.Columns.Count; i++)
                {
                    for (int j = 0; j < _curList.Columns.Count; j++)
                    {
                        if (_curList.Columns[j].DisplayIndex == i)
                        {
                            dispOrder[i] = j;
                            break;
                        }
                    }
                }
                for (int i = 0; i < _curList.Columns.Count; i++)
                {
                    _listCustom.Columns[i].Width = _curList.Columns[i].Width;
                    _listCustom.Columns[dispOrder[i]].DisplayIndex = i;
                }
            }
            else
            {
                if (_iconCol)
                {
                    _listCustom.Columns[0].Width = _cfgLocal.Width1;
                    _listCustom.Columns[1].Width = _cfgLocal.Width3;
                    _listCustom.Columns[0].DisplayIndex = 0;
                    _listCustom.Columns[1].DisplayIndex = 1;
                }
                else
                {
                    for (int i = 0; i <= 7; i++)
                    {
                        if (_cfgLocal.DisplayIndex1 == i)
                            dispOrder[i] = 0;
                        else if (_cfgLocal.DisplayIndex2 == i)
                            dispOrder[i] = 1;
                        else if (_cfgLocal.DisplayIndex3 == i)
                            dispOrder[i] = 2;
                        else if (_cfgLocal.DisplayIndex4 == i)
                            dispOrder[i] = 3;
                        else if (_cfgLocal.DisplayIndex5 == i)
                            dispOrder[i] = 4;
                        else if (_cfgLocal.DisplayIndex6 == i)
                            dispOrder[i] = 5;
                        else if (_cfgLocal.DisplayIndex7 == i)
                            dispOrder[i] = 6;
                        else if (_cfgLocal.DisplayIndex8 == i)
                            dispOrder[i] = 7;
                    }
                    _listCustom.Columns[0].Width = _cfgLocal.Width1;
                    _listCustom.Columns[1].Width = _cfgLocal.Width2;
                    _listCustom.Columns[2].Width = _cfgLocal.Width3;
                    _listCustom.Columns[3].Width = _cfgLocal.Width4;
                    _listCustom.Columns[4].Width = _cfgLocal.Width5;
                    _listCustom.Columns[5].Width = _cfgLocal.Width6;
                    _listCustom.Columns[6].Width = _cfgLocal.Width7;
                    _listCustom.Columns[7].Width = _cfgLocal.Width8;
                    for (int i = 0; i <= 7; i++)
                    {
                        _listCustom.Columns[dispOrder[i]].DisplayIndex = i;
                    }
                }
            }

            if (tabType == MyCommon.TabUsageType.PublicSearch) pnl.ResumeLayout(false);

            _tabPage.ResumeLayout(false);

            this.SplitContainer1.Panel1.ResumeLayout(false);
            this.SplitContainer1.Panel2.ResumeLayout(false);
            this.SplitContainer1.ResumeLayout(false);
            this.ListTab.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();
            _tabPage.Tag = _listCustom;
            return true;
        }
示例#5
0
        public string EditList(string list_id, string new_name, bool isPrivate, string description, ref ListElement list)
        {
            HttpStatusCode res;
            var content = "";

            try
            {
                res = twCon.UpdateListID(this.Username, list_id, new_name, isPrivate, description, ref content);
            }
            catch(Exception ex)
            {
                return "Err:" + ex.Message + "(" + MethodBase.GetCurrentMethod().Name + ")";
            }

            var err = this.CheckStatusCode(res, content);
            if (err != null) return err;

            try
            {
                var le = TwitterList.ParseJson(content);
                var newList = new ListElement(le, this);
                list.Description = newList.Description;
                list.Id = newList.Id;
                list.IsPublic = newList.IsPublic;
                list.MemberCount = newList.MemberCount;
                list.Name = newList.Name;
                list.SubscriberCount = newList.SubscriberCount;
                list.Slug = newList.Slug;
                list.Nickname = newList.Nickname;
                list.Username = newList.Username;
                list.UserId = newList.UserId;
                return "";
            }
            catch(SerializationException ex)
            {
                MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
                return "Err:Json Parse Error(DataContractJsonSerializer)";
            }
            catch(Exception ex)
            {
                MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
                return "Err:Invalid Json!";
            }

        }
示例#6
0
 public bool AddTab(string TabName, MyCommon.TabUsageType TabType, ListElement List)
 {
     if (_tabs.ContainsKey(TabName)) return false;
     var tb = new TabClass(TabName, TabType, List);
     _tabs.Add(TabName, tb);
     tb.SortMode = this.SortMode;
     tb.SortOrder = this.SortOrder;
     return true;
 }
示例#7
0
 public TabClass(string TabName, MyCommon.TabUsageType TabType, ListElement list) : this()
 {
     this.TabName = TabName;
     this.TabType = TabType;
     this.ListInfo = list;
 }
示例#8
0
 public TabClass()
 {
     _innerPosts = new Dictionary<long, PostClass>();
     Posts = _innerPosts;
     SoundFile = "";
     TabName = "";
     _filters = new List<PostFilterRule>();
     Protected = false;
     Notify = true;
     SoundFile = "";
     UnreadManage = true;
     _ids = new List<long>();
     _tabType = MyCommon.TabUsageType.Undefined;
     _listInfo = null;
 }
示例#9
0
        public bool AddNewTab(string tabName, bool startup, MyCommon.TabUsageType tabType, ListElement listInfo = null)
        {
            //重複チェック
            foreach (TabPage tb in ListTab.TabPages)
            {
                if (tb.Text == tabName) return false;
            }

            //新規タブ名チェック
            if (tabName == Properties.Resources.AddNewTabText1) return false;

            //タブタイプ重複チェック
            if (!startup)
            {
                if (tabType == MyCommon.TabUsageType.DirectMessage ||
                   tabType == MyCommon.TabUsageType.Favorites ||
                   tabType == MyCommon.TabUsageType.Home ||
                   tabType == MyCommon.TabUsageType.Mentions ||
                   tabType == MyCommon.TabUsageType.Related)
                {
                    if (_statuses.GetTabByType(tabType) != null) return false;
                }
            }

            TabPage _tabPage = new TabPage();
            DetailsListView _listCustom = new DetailsListView();

            int cnt = ListTab.TabPages.Count;

            ///ToDo:Create and set controls follow tabtypes

            using (ControlTransaction.Update(_listCustom))
            using (ControlTransaction.Layout(this.SplitContainer1.Panel1, false))
            using (ControlTransaction.Layout(this.SplitContainer1.Panel2, false))
            using (ControlTransaction.Layout(this.SplitContainer1, false))
            using (ControlTransaction.Layout(this.ListTab, false))
            using (ControlTransaction.Layout(this))
            using (ControlTransaction.Layout(_tabPage, false))
            {
                /// UserTimeline関連
                Label label = null;
                if (tabType == MyCommon.TabUsageType.UserTimeline || tabType == MyCommon.TabUsageType.Lists)
                {
                    label = new Label();
                    label.Dock = DockStyle.Top;
                    label.Name = "labelUser";
                    if (tabType == MyCommon.TabUsageType.Lists)
                    {
                        label.Text = listInfo.ToString();
                    }
                    else
                    {
                        label.Text = _statuses.Tabs[tabName].User + "'s Timeline";
                    }
                    label.TextAlign = ContentAlignment.MiddleLeft;
                    using (ComboBox tmpComboBox = new ComboBox())
                    {
                        label.Height = tmpComboBox.Height;
                    }
                    _tabPage.Controls.Add(label);
                }

                /// 検索関連の準備
                Panel pnl = null;
                if (tabType == MyCommon.TabUsageType.PublicSearch)
                {
                    pnl = new Panel();

                    Label lbl = new Label();
                    ComboBox cmb = new ComboBox();
                    Button btn = new Button();
                    ComboBox cmbLang = new ComboBox();

                    pnl.SuspendLayout();

                    pnl.Controls.Add(cmb);
                    pnl.Controls.Add(cmbLang);
                    pnl.Controls.Add(btn);
                    pnl.Controls.Add(lbl);
                    pnl.Name = "panelSearch";
                    pnl.Dock = DockStyle.Top;
                    pnl.Height = cmb.Height;
                    pnl.Enter += SearchControls_Enter;
                    pnl.Leave += SearchControls_Leave;

                    cmb.Text = "";
                    cmb.Anchor = AnchorStyles.Left | AnchorStyles.Right;
                    cmb.Dock = DockStyle.Fill;
                    cmb.Name = "comboSearch";
                    cmb.DropDownStyle = ComboBoxStyle.DropDown;
                    cmb.ImeMode = ImeMode.NoControl;
                    cmb.TabStop = false;
                    cmb.AutoCompleteMode = AutoCompleteMode.None;
                    cmb.KeyDown += SearchComboBox_KeyDown;

                    if (_statuses.ContainsTab(tabName))
                    {
                        cmb.Items.Add(_statuses.Tabs[tabName].SearchWords);
                        cmb.Text = _statuses.Tabs[tabName].SearchWords;
                    }

                    cmbLang.Text = "";
                    cmbLang.Anchor = AnchorStyles.Left | AnchorStyles.Right;
                    cmbLang.Dock = DockStyle.Right;
                    cmbLang.Width = 50;
                    cmbLang.Name = "comboLang";
                    cmbLang.DropDownStyle = ComboBoxStyle.DropDownList;
                    cmbLang.TabStop = false;
                    cmbLang.Items.Add("");
                    cmbLang.Items.Add("ja");
                    cmbLang.Items.Add("en");
                    cmbLang.Items.Add("ar");
                    cmbLang.Items.Add("da");
                    cmbLang.Items.Add("nl");
                    cmbLang.Items.Add("fa");
                    cmbLang.Items.Add("fi");
                    cmbLang.Items.Add("fr");
                    cmbLang.Items.Add("de");
                    cmbLang.Items.Add("hu");
                    cmbLang.Items.Add("is");
                    cmbLang.Items.Add("it");
                    cmbLang.Items.Add("no");
                    cmbLang.Items.Add("pl");
                    cmbLang.Items.Add("pt");
                    cmbLang.Items.Add("ru");
                    cmbLang.Items.Add("es");
                    cmbLang.Items.Add("sv");
                    cmbLang.Items.Add("th");
                    if (_statuses.ContainsTab(tabName)) cmbLang.Text = _statuses.Tabs[tabName].SearchLang;

                    lbl.Text = "Search(C-S-f)";
                    lbl.Name = "label1";
                    lbl.Dock = DockStyle.Left;
                    lbl.Width = 90;
                    lbl.Height = cmb.Height;
                    lbl.TextAlign = ContentAlignment.MiddleLeft;

                    btn.Text = "Search";
                    btn.Name = "buttonSearch";
                    btn.UseVisualStyleBackColor = true;
                    btn.Dock = DockStyle.Right;
                    btn.TabStop = false;
                    btn.Click += SearchButton_Click;
                }

                this.ListTab.Controls.Add(_tabPage);
                _tabPage.Controls.Add(_listCustom);

                if (tabType == MyCommon.TabUsageType.PublicSearch) _tabPage.Controls.Add(pnl);
                if (tabType == MyCommon.TabUsageType.UserTimeline || tabType == MyCommon.TabUsageType.Lists) _tabPage.Controls.Add(label);

                _tabPage.Location = new Point(4, 4);
                _tabPage.Name = "CTab" + cnt.ToString();
                _tabPage.Size = new Size(380, 260);
                _tabPage.TabIndex = 2 + cnt;
                _tabPage.Text = tabName;
                _tabPage.UseVisualStyleBackColor = true;

                _listCustom.AllowColumnReorder = true;
                _listCustom.ContextMenuStrip = this.ContextMenuOperate;
                _listCustom.ColumnHeaderContextMenuStrip = this.ContextMenuColumnHeader;
                _listCustom.Dock = DockStyle.Fill;
                _listCustom.FullRowSelect = true;
                _listCustom.HideSelection = false;
                _listCustom.Location = new Point(0, 0);
                _listCustom.Margin = new Padding(0);
                _listCustom.Name = "CList" + Environment.TickCount.ToString();
                _listCustom.ShowItemToolTips = true;
                _listCustom.Size = new Size(380, 260);
                _listCustom.UseCompatibleStateImageBehavior = false;
                _listCustom.View = View.Details;
                _listCustom.OwnerDraw = true;
                _listCustom.VirtualMode = true;
                _listCustom.Font = _fntReaded;
                _listCustom.BackColor = _clListBackcolor;

                _listCustom.GridLines = this._cfgCommon.ShowGrid;
                _listCustom.AllowDrop = true;

                _listCustom.SmallImageList = _listViewImageList;

                InitColumns(_listCustom, startup);

                _listCustom.SelectedIndexChanged += MyList_SelectedIndexChanged;
                _listCustom.MouseDoubleClick += MyList_MouseDoubleClick;
                _listCustom.ColumnClick += MyList_ColumnClick;
                _listCustom.DrawColumnHeader += MyList_DrawColumnHeader;
                _listCustom.DragDrop += TweenMain_DragDrop;
                _listCustom.DragEnter += TweenMain_DragEnter;
                _listCustom.DragOver += TweenMain_DragOver;
                _listCustom.DrawItem += MyList_DrawItem;
                _listCustom.MouseClick += MyList_MouseClick;
                _listCustom.ColumnReordered += MyList_ColumnReordered;
                _listCustom.ColumnWidthChanged += MyList_ColumnWidthChanged;
                _listCustom.CacheVirtualItems += MyList_CacheVirtualItems;
                _listCustom.RetrieveVirtualItem += MyList_RetrieveVirtualItem;
                _listCustom.DrawSubItem += MyList_DrawSubItem;
                _listCustom.HScrolled += MyList_HScrolled;

                if (tabType == MyCommon.TabUsageType.PublicSearch) pnl.ResumeLayout(false);
            }

            _tabPage.Tag = _listCustom;
            return true;
        }
示例#10
0
 private void Cancel_Button_Click(object sender, EventArgs e)
 {
     _selectedList = null;
     this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.Close();
 }
示例#11
0
 private void Cancel_Button_Click(object sender, EventArgs e)
 {
     _selectedList     = null;
     this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.Close();
 }
        public virtual string Refresh()
        {
            ListElement t = this;

            return(_tw.EditList(this.Id.ToString(), Name, !this.IsPublic, this.Description, ref t));
        }
示例#13
0
        private void MyLists_Load(object sender, EventArgs e)
        {
            this.ListsCheckedListBox.ItemCheck -= this.ListsCheckedListBox_ItemCheck;

            this.ListsCheckedListBox.Items.AddRange(TabInformations.GetInstance().SubscribableLists.FindAll((item) => item.Username == this._tw.Username).ToArray());

            for (int i = 0; i < this.ListsCheckedListBox.Items.Count; i++)
            {
                ListElement listItem = (ListElement)this.ListsCheckedListBox.Items[i];

                List <PostClass> listPost  = new List <PostClass>();
                List <PostClass> otherPost = new List <PostClass>();

                foreach (TabClass tab in TabInformations.GetInstance().Tabs.Values)
                {
                    if (tab.TabType == MyCommon.TabUsageType.Lists)
                    {
                        if (listItem.Id == tab.ListInfo.Id)
                        {
                            listPost.AddRange(tab.Posts.Values);
                        }
                        else
                        {
                            otherPost.AddRange(tab.Posts.Values);
                        }
                    }
                }

                //リストが空の場合は推定不能
                if (listPost.Count == 0)
                {
                    this.ListsCheckedListBox.SetItemCheckState(i, CheckState.Indeterminate);
                    continue;
                }

                //リストに該当ユーザーのポストが含まれていれば、リストにユーザーが含まれているとする。
                if (listPost.Exists((item) => item.ScreenName == contextUserName))
                {
                    this.ListsCheckedListBox.SetItemChecked(i, true);
                    continue;
                }

                List <long>   listPostUserIDs         = new List <long>();
                List <string> listPostUserNames       = new List <string>();
                DateTime      listOlderPostCreatedAt  = DateTime.MaxValue;
                DateTime      listNewistPostCreatedAt = DateTime.MinValue;

                foreach (PostClass post in listPost)
                {
                    if (post.UserId > 0 && !listPostUserIDs.Contains(post.UserId))
                    {
                        listPostUserIDs.Add(post.UserId);
                    }
                    if (post.ScreenName != null && !listPostUserNames.Contains(post.ScreenName))
                    {
                        listPostUserNames.Add(post.ScreenName);
                    }
                    if (post.CreatedAt < listOlderPostCreatedAt)
                    {
                        listOlderPostCreatedAt = post.CreatedAt;
                    }
                    if (post.CreatedAt > listNewistPostCreatedAt)
                    {
                        listNewistPostCreatedAt = post.CreatedAt;
                    }
                }

                //リスト中のユーザーの人数がlistItem.MemberCount以上で、かつ該当のユーザーが含まれていなければ、リストにユーザーは含まれていないとする。
                if (listItem.MemberCount > 0 && listItem.MemberCount <= listPostUserIDs.Count && (!listPostUserNames.Contains(contextUserName)))
                {
                    this.ListsCheckedListBox.SetItemChecked(i, false);
                    continue;
                }

                otherPost.AddRange(TabInformations.GetInstance().Posts.Values);

                //リストに該当ユーザーのポストが含まれていないのにリスト以外で取得したポストの中にリストに含まれるべきポストがある場合は、リストにユーザーは含まれていないとする。
                if (otherPost.Exists((item) => (item.ScreenName == this.contextUserName) && (item.CreatedAt > listOlderPostCreatedAt) && (item.CreatedAt < listNewistPostCreatedAt) && ((!item.IsReply) || listPostUserNames.Contains(item.InReplyToUser))))
                {
                    this.ListsCheckedListBox.SetItemChecked(i, false);
                    continue;
                }

                this.ListsCheckedListBox.SetItemCheckState(i, CheckState.Indeterminate);
            }

            this.ListsCheckedListBox.ItemCheck += this.ListsCheckedListBox_ItemCheck;
        }