Beispiel #1
0
        private ListViewItem CreateItem(TabPage Tab, PostClass Post, int Index)
        {
            StringBuilder mk = new StringBuilder();
            //if (Post.IsDeleted) mk.Append("×");
            //if (Post.IsMark) mk.Append("♪");
            //if (Post.IsProtect) mk.Append("Ю");
            //if (Post.InReplyToStatusId > 0) mk.Append("⇒");
            if (Post.FavoritedCount > 0) mk.Append("+" + Post.FavoritedCount.ToString());
            ImageListViewItem itm;
            if (Post.RetweetedId == 0)
            {
                string[] sitem= {"",
                                 Post.Nickname,
                                 Post.IsDeleted ? "(DELETED)" : Post.TextFromApi,
                                 Post.CreatedAt.ToString(SettingDialog.DateTimeFormat),
                                 Post.ScreenName,
                                 "",
                                 mk.ToString(),
                                 Post.Source};
                itm = new ImageListViewItem(sitem, (ImageDictionary)this.TIconDic, Post.ImageUrl);
            }
            else
            {
                string[] sitem = {"",
                                  Post.Nickname,
                                  Post.IsDeleted ? "(DELETED)" : Post.TextFromApi,
                                  Post.CreatedAt.ToString(SettingDialog.DateTimeFormat),
                                  Post.ScreenName + Environment.NewLine + "(RT:" + Post.RetweetedBy + ")",
                                  "",
                                  mk.ToString(),
                                  Post.Source};
                itm = new ImageListViewItem(sitem, (ImageDictionary)this.TIconDic, Post.ImageUrl);
            }
            itm.StateImageIndex = Post.StateIndex;

            bool read = Post.IsRead;
            //未読管理していなかったら既読として扱う
            if (!_statuses.Tabs[Tab.Text].UnreadManage || !SettingDialog.UnreadManage) read = true;
            ChangeItemStyleRead(read, itm, Post, null);
            if (Tab.Equals(_curTab)) ColorizeList(itm, Index);
            return itm;
        }
Beispiel #2
0
        private void ChangeCacheStyleRead(bool Read, int Index, TabPage Tab)
        {
            //Read:true=既読 false=未読
            //未読管理していなかったら既読として扱う
            if (!_statuses.Tabs[_curTab.Text].UnreadManage ||
               !SettingDialog.UnreadManage) Read = true;

            //対象の特定
            ListViewItem itm = null;
            PostClass post = null;

            if (Tab.Equals(this._curTab))
            {
                this.TryGetListViewItemCache(Index, out itm, out post);
            }

            if (itm == null || post == null)
            {
                itm = ((DetailsListView)Tab.Tag).Items[Index];
                post = _statuses[Tab.Text, Index];
            }

            ChangeItemStyleRead(Read, itm, post, ((DetailsListView)Tab.Tag));
        }
Beispiel #3
0
        private void ChangeCacheStyleRead(bool Read, int Index, TabPage Tab)
        {
            //Read:true=既読 false=未読
            //未読管理していなかったら既読として扱う
            if (!_statuses.Tabs[_curTab.Text].UnreadManage ||
               !SettingDialog.UnreadManage) Read = true;

            //対象の特定
            ListViewItem itm;
            PostClass post;
            if (Tab.Equals(_curTab) && _itemCache != null && Index >= _itemCacheIndex && Index < _itemCacheIndex + _itemCache.Length)
            {
                itm = _itemCache[Index - _itemCacheIndex];
                post = _postCache[Index - _itemCacheIndex];
            }
            else
            {
                itm = ((DetailsListView)Tab.Tag).Items[Index];
                post = _statuses[Tab.Text, Index];
            }

            ChangeItemStyleRead(Read, itm, post, ((DetailsListView)Tab.Tag));
        }
Beispiel #4
0
        private void SubmitSelectedTabPage(TabPage currentTabPage)
        {
            string errMsg;
            DevControl.tagErrorCode eCode;

            if (currentTabPage.Equals(this.tabPage_Power))
            {
                RebootType rebootType;

                if (radioButton_Default.Checked)
                {
                    rebootType = RebootType.DefaultWithoutReboot;
                }
                else if (radioButton_DefaultReboot.Checked)
                {
                    rebootType = RebootType.DefaultAndReboot;
                }
                else if (radioButton_Reboot.Checked)
                {
                    rebootType = RebootType.RebootWithoutSave;
                }
                else
                {
                    rebootType = RebootType.SaveAndReboot;
                }

                eCode = this.CurrentDevice.RebootManage(rebootType);
                //返回值处理
                errMsg = ErrorHandling.HandleDeviceError(eCode, this.CurrentDevice);
                this.Lable_Message.Text = errMsg;
                System.Windows.Forms.MessageBox.Show(errMsg);
            }
            else if (currentTabPage.Equals(this.tabPage_Password))
            {
                string password, newPassword;

                password = this.oldPwdTB.Text.Trim();
                newPassword = this.newPwdTB.Text.Trim();

                if ((password == "") || (newPassword == ""))
                {
                    System.Windows.Forms.MessageBox.Show("Password required!");
                    return;
                }

                if (newPassword != this.retypePwdTB.Text.Trim())
                {
                    System.Windows.Forms.MessageBox.Show("Password are not same!");
                    return;
                }
                //
                eCode = this.CurrentDevice.ModifyPassword(password, newPassword);
                //返回值处理
                errMsg = ErrorHandling.HandleDeviceError(eCode, this.CurrentDevice);
                this.Lable_Message.Text = errMsg;
                System.Windows.Forms.MessageBox.Show(errMsg);
            }
            else
            {
                int channelNum = 0;

                if (currentTabPage.Equals(this.tabPage_Hostlist))
                {
                    channelNum = (int)this.comboBox_HostChannel.SelectedItem;
                }
                else if (currentTabPage.Equals(this.tabPage_Serial))
                {
                    channelNum = (int)this.comboBox_SerialChannel.SelectedItem;
                }
                else if (currentTabPage.Equals(this.tabPage_Connection))
                {
                    channelNum = (int)this.comboBox_ConnChannel.SelectedItem;
                }

                eCode = this.AutoProperty.SetParameter(currentTabPage, channelNum);
                //返回值处理
                errMsg = ErrorHandling.HandleDeviceError(eCode, this.CurrentDevice);
                this.Lable_Message.Text = errMsg;
                System.Windows.Forms.MessageBox.Show(errMsg);
            }
        }
Beispiel #5
0
        private void ReflashSelectedTabPage(TabPage currentTabPage)
        {
            int channelNum=0;
            string errMsg;
            this.Lable_Message.Text = "";
            if (currentTabPage.Equals(this.tabPage_Power))
            {
                //do nothing;
            }
            else if (currentTabPage.Equals(this.tabPage_Password))
            {
                //do nothing;
            }
            else
            {
                if (currentTabPage.Equals(this.tabPage_Hostlist))
                {
                    channelNum = (int)this.comboBox_HostChannel.SelectedItem;
                }
                else if(currentTabPage.Equals(this.tabPage_Serial))
                {
                    channelNum = (int)this.comboBox_SerialChannel.SelectedItem;
                }
                else if (currentTabPage.Equals(this.tabPage_Connection))
                {
                    channelNum = (int)this.comboBox_ConnChannel.SelectedItem;
                }

                DevControl.tagErrorCode eCode = this.AutoProperty.GetParameter(currentTabPage, channelNum);
                errMsg = ErrorHandling.HandleDeviceError(eCode, this.CurrentDevice);
                this.Lable_Message.Text = errMsg;
            //    System.Windows.Forms.MessageBox.Show(errMsg);
            }
        }
Beispiel #6
0
        private ListViewItem CreateItem(TabPage Tab, PostClass Post, int Index)
        {
            StringBuilder mk = new StringBuilder();
            //if (Post.IsDeleted) mk.Append("×");
            //if (Post.IsMark) mk.Append("♪");
            //if (Post.IsProtect) mk.Append("Ю");
            //if (Post.InReplyToStatusId != null) mk.Append("⇒");
            if (Post.FavoritedCount > 0) mk.Append("+" + Post.FavoritedCount.ToString());
            string[] sitem = {"",
                              Post.Nickname,
                              Post.IsDeleted ? "(DELETED)" : Post.TextSingleLine,
                              Post.CreatedAt.ToString(this._cfgCommon.DateTimeFormat),
                              Post.RetweetedId == null ? Post.ScreenName : Post.ScreenName + Environment.NewLine + "(RT:" + Post.RetweetedBy + ")",
                              "",
                              mk.ToString(),
                              Post.Source};
            ImageListViewItem itm = this._cfgCommon.IconSize != MyCommon.IconSizes.IconNone ?
                                        new ImageListViewItem(sitem, this.IconCache, Post.ImageUrl) :
                                        new ImageListViewItem(sitem);
            itm.StateIndex = Post.StateIndex;

            bool read = Post.IsRead;
            //未読管理していなかったら既読として扱う
            if (!_statuses.Tabs[Tab.Text].UnreadManage || !this._cfgCommon.UnreadManage) read = true;
            ChangeItemStyleRead(read, itm, Post, null);
            if (Tab.Equals(_curTab)) ColorizeList(itm, Index);
            return itm;
        }
Beispiel #7
0
        private void ChangeCacheStyleRead(bool read, int index, TabPage tab)
        {
            // Read_:True=既読 False=未読
            // 未読管理していなかったら既読として扱う
            if (!_statuses.Tabs[_curTab.Text].UnreadManage || !_configs.UnreadManage)
            {
                read = true;
            }

            // 対象の特定
            ListViewItem itm;
            PostClass post;
            if (tab.Equals(_curTab) && _itemCache != null && index >= _itemCacheIndex && index < _itemCacheIndex + _itemCache.Length)
            {
                itm = _itemCache[index - _itemCacheIndex];
                post = _postCache[index - _itemCacheIndex];
            }
            else
            {
                itm = ((DetailsListView)tab.Tag).Items[index];
                post = _statuses.Item(tab.Text, index);
            }

            ChangeItemStyleRead(read, itm, post, (DetailsListView)tab.Tag);
        }
Beispiel #8
0
        private ListViewItem CreateItem(TabPage tabPage, PostClass post, int index)
        {
            var mk = new StringBuilder();
            if (post.FavoritedCount > 0)
            {
                mk.AppendFormat("+{0}", post.FavoritedCount);
            }

            string postedByDetail = post.ScreenName;
            if (post.IsRetweeted)
            {
                postedByDetail += string.Format("{0}(RT:{1})", Environment.NewLine, post.RetweetedBy);
            }

            bool read = post.IsRead || (!_statuses.Tabs[tabPage.Text].UnreadManage || !_configs.UnreadManage);

            var subitem = new[]
                {
                    string.Empty,
                    post.Nickname,
                    (post.IsDeleted ? "(DELETED)" : string.Empty) + post.TextFromApi,
                    post.CreatedAt.ToString(_configs.DateTimeFormat),
                    postedByDetail,
                    string.Empty,
                    mk.ToString(),
                    post.Source
                };
            var itm = new ImageListViewItem(subitem, _iconDict, post.ImageUrl)
            {
                StateImageIndex = post.StateIndex
            };

            ChangeItemStyleRead(read, itm, post, null);
            if (tabPage.Equals(_curTab))
            {
                ColorizeList(itm, index);
            }

            return itm;
        }