예제 #1
0
파일: test.cs 프로젝트: mono/gert
	static void Main (string [] args)
	{
		ListView entryList = new ListView ();
		entryList.Sorting = System.Windows.Forms.SortOrder.Descending;

		entryList.BeginUpdate ();
		entryList.Columns.Add ("Type", 100, HorizontalAlignment.Left);

		ListViewItem item = new ListViewItem (new string [] { "A" });
		entryList.Items.Add (item);
		item = new ListViewItem (new string [] { "B" });
		entryList.Items.Add (item);
	}
        private void ColumnSort(object sender, ColumnClickEventArgs e)
        {
            ListView  lvw      = (ListView)sender;
            ArrayList SortList = (ArrayList)lvw.Tag;

            SortList[e.Column] = (SortOrder)SortList[e.Column] ==
                                 SortOrder.Ascending ?
                                 SortOrder.Descending :
                                 SortOrder.Ascending;
            lvw.Sorting = (SortOrder)SortList[e.Column];

            lvw.BeginUpdate();
            lvw.ListViewItemSorter = new ListViewSorter(e.Column, lvw.Sorting);
            lvw.Sort();
            lvw.EndUpdate();
        }
예제 #3
0
        internal static void Fill([NotNull] this ListView listView, [NotNull] IEnumerable <ListViewItem> items)
        {
            if (listView == null)
            {
                throw new ArgumentNullException("listView");
            }
            if (items == null)
            {
                throw new ArgumentNullException("items");
            }

            listView.Items.Clear();
            listView.BeginUpdate();
            items.ForEach(item => listView.Items.Add(item));
            listView.EndUpdate();
        }
        // refresh History ListView Data
        public void RefreshHistoryListViewData(ListView lv, DataHandle.JSONHistoryDataStruct.Rootobject root)
        {
            lv.BeginUpdate();
            lv.Items.Clear();
            int no = 1;

            foreach (var node in root.historyData)
            {
                ListViewItem it = new ListViewItem();
                it.Text = "" + (no++);
                it.SubItems.Add(node.assessTime);
                it.SubItems.Add(node.resultValue.Level1.Maintainability);
                lv.Items.Add(it);
            }
            lv.EndUpdate();
        }
예제 #5
0
 public void RefreshTaskView(ListView view)
 {
     view.BeginUpdate();
     try
     {
         view.Items.Clear();
         foreach (Task task in _project.Tasks)
         {
             ListViewItem item = view.Items.Add(task.Name);
         }
     }
     finally
     {
         view.EndUpdate();
     }
 }
예제 #6
0
 /// <summary>
 /// 升级列表中的文件名
 /// </summary>
 /// <param name="listView"></param>
 /// <param name="nameStyle"></param>
 private void UpdataListViewFileName(ListView listView, string nameStyle)
 {
     if (CheckFileStyle(nameStyle, out string msg))
     {
         listView.BeginUpdate();
         foreach (ListViewItem item in listView.Items)
         {
             string filePath = item.SubItems[2].Text;
             if (File.Exists(filePath))
             {
                 item.SubItems[1].Text = Path.GetFileName(MakeFileName(filePath, nameStyle, Convert.ToInt32(item.Text).ToString().PadLeft(listView.Items.Count.ToString().Length, '0')));
             }
         }
         listView.EndUpdate();
     }
 }
예제 #7
0
 private void reloadList()
 {
     bluetoothList.BeginUpdate();
     bluetoothList.Clear();
     loadListTitle();
     foreach (BluetoothDeviceManager manager in resultList)
     {
         ListViewItem i1 = new ListViewItem(manager.getDeviceName());
         i1.SubItems.Add(manager.getDeviceAddress());
         i1.SubItems.Add(manager.getCOM());
         bluetoothList.Items.Add(i1);
     }
     bluetoothList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     bluetoothList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
     bluetoothList.EndUpdate();
 }
예제 #8
0
        public BluetoothList()
        {
            InitializeComponent();
            /*ListView UI*/
            this.resultList = new ArrayList();

            this.bluetoothList = bluetoothListView;
            bluetoothList.BeginUpdate();
            bluetoothList.View         = View.Details;
            bluetoothList.ItemChecked += new ItemCheckedEventHandler(CheckedState);
            loadListTitle();
            bluetoothList.EndUpdate();
            /*搜尋很久放在BackgroundWorker*/
            outputText.Text = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            runSearchDevice();
        }
예제 #9
0
 void BatchUpdateDataView(Action action)
 {
     VgcApis.Libs.UI.RunInUiThread(dataView, () =>
     {
         dataView.BeginUpdate();
         try
         {
             action?.Invoke();
         }
         catch { }
         finally
         {
             dataView.EndUpdate();
         }
     });
 }
예제 #10
0
 void BatchUpdateDataView(Action action)
 {
     dataView.Invoke((MethodInvoker) delegate
     {
         dataView.BeginUpdate();
         try
         {
             action?.Invoke();
         }
         catch { }
         finally
         {
             dataView.EndUpdate();
         }
     });
 }
예제 #11
0
 public void AddAllToListView(ListView lvw)
 {
     lvw.BeginUpdate();
     lvw.Items.Clear();
     foreach (T t in this.lst)
     {
         string[]     cols = this.ColumnsData(t);
         ListViewItem item = new ListViewItem(cols[0]);
         for (int i = 1; i < cols.Length; i++)
         {
             item.SubItems.Add(cols[i]);
         }
         lvw.Items.Add(item);
     }
     lvw.EndUpdate();
 }
예제 #12
0
        // Обработка файлов
        private void bwcmd_DoWork(object sender, DoWorkEventArgs e)
        {
            m_bFilesWorked = false;
            if (m_Fast)
            {
                m_lvResult.BeginUpdate();
            }

            switch (m_WorkMode)
            {
            case BooksWorkModeEnum.CopyCheckedBooks:
                this.Text  = "Копирование помеченных копий книг в папку " + m_TargetDir;
                this.Text += String.Format(": {0}", m_lvResult.CheckedItems.Count);
                CopyOrMoveCheckedFilesTo(ref m_bwcmd, ref e, true,
                                         m_SourceDir, m_TargetDir, m_lvResult,
                                         m_FileExistMode);
                break;

            case BooksWorkModeEnum.MoveCheckedBooks:
                this.Text  = "Перемещение помеченных копий книг в папку " + m_TargetDir;
                this.Text += String.Format(": {0}", m_lvResult.CheckedItems.Count);
                CopyOrMoveCheckedFilesTo(ref m_bwcmd, ref e, false,
                                         m_SourceDir, m_TargetDir, m_lvResult,
                                         m_FileExistMode);
                break;

            case BooksWorkModeEnum.DeleteCheckedBooks:
                this.Text  = "Удаление помеченных копий книг";
                this.Text += String.Format(": {0}", m_lvResult.CheckedItems.Count);
                DeleteCheckedFiles(ref m_bwcmd, ref e, m_lvResult);
                break;

            default:
                return;
            }

            if (!m_Fast)
            {
                // Чистка списка Групп копий книг Дубликатора от пустых итемов
                MiscListView.cleanGroupList(m_lvResult);
            }

            if (m_Fast)
            {
                m_lvResult.EndUpdate();
            }
        }
예제 #13
0
        private void AddItemList(ListView listview, List <Item> items)
        {
            int count = items.Count;

            //TODO
            listview.BeginUpdate();
            listview.Items.Clear();
            if (listview == list_items_normal)
            {
                this.tab_items_normal.Text = this.tab_items_normal.Text.Split(' ')[0] + " (" + count + ")";
            }
            else if (listview == list_items_cash)
            {
                this.tab_items_cash.Text = this.tab_items_cash.Text.Split(' ')[0] + " (" + count + ")";
            }
            else if (listview == list_items_quest)
            {
                this.tab_items_quest.Text = this.tab_items_quest.Text.Split(' ')[0] + " (" + count + ")";
            }
            else if (listview == list_items_other)
            {
                this.tab_items_other.Text = this.tab_items_other.Text.Split(' ')[0] + " (" + count + ")";
            }
            int index = -1;

            if (count >= 0)
            {
                ListViewItem[] vitems = new ListViewItem[count];
                for (int i = 0; i < count; i++)
                {
                    bool hascolor     = listview == list_items_normal || listview == list_items_cash;
                    bool has2category = listview == list_items_normal;
                    bool fullname     = listview == list_items_normal || listview == list_items_cash;
                    vitems[i] = this.GetItemView(items[i], i, listview, fullname, hascolor, has2category);

                    if ((listview == this.list_items_normal && i == NormalCurItem) || (listview == this.list_items_cash && i == CashCurItem))
                    {
                        index              = i;
                        vitems[i].Checked  = true;
                        vitems[i].Selected = true;
                    }
                }
                listview.Items.AddRange(vitems);
            }
            listview.EndUpdate();
            listview.GoToRow(index);
        }
예제 #14
0
        /* 描述:连接信息ListView添加Item函数
         * 参数:
         * addConnect----新增连接信息录入界面实例
         * lv----四种链接信息对应的ListView实例
         * serialNum----Item排序编号,传入值为成员变量_netNum,_rapidIONum,_gtxNum,_lvdsNum
         * 返回值:void
         */
        private void ConnectAddItem(BoardInitForm_AddConnect addConnect, ListView lv, ref int serialNum)
        {
            serialNum++;
            lv.BeginUpdate();
            ListViewItem lvi = new ListViewItem();

            lvi.Text = serialNum.ToString();
            lvi.SubItems.Add(addConnect.Port1_Type);
            lvi.SubItems.Add(addConnect.Port1_SN);
            lvi.SubItems.Add(addConnect.Port1_Num);
            lvi.SubItems.Add(addConnect.Port2_Type);
            lvi.SubItems.Add(addConnect.Port2_SN);
            lvi.SubItems.Add(addConnect.Port2_Num);

            lv.Items.Add(lvi);
            lv.EndUpdate();
        }
예제 #15
0
        void SetContent()
        {
            this.Clear();
            this.cbadd.Items.Clear();

            if (items != null)
            {
                lv.BeginUpdate();
                foreach (NgbhItem i in items)
                {
                    AddItemToList(i);
                }
                lv.EndUpdate();

                SetAvailableAddTypes();
            }
        }
예제 #16
0
        public static void BuildAllSQLList(ListView view, List <SQLStatement> sqls)
        {
            view.BeginUpdate();
            view.Columns.Clear();
            view.Items.Clear();

            view.Columns.Add("Line #");
            view.Columns.Add("Duration");
            view.Columns.Add("Fetches");
            view.Columns.Add("SQL_ID");
            view.Columns.Add("Full SQL");

            view.ListViewItemSorter = new ListViewItemComparer(0, true);
            /* sort the SQLs */
            //sqls.Sort(new Comparison<SQLStatement>(sort));

            foreach (var sql in sqls)
            {
                ListViewItem item = new ListViewItem();
                if (sql.IsError)
                {
                    item.BackColor = System.Drawing.Color.Red;
                }
                item.Tag  = sql;
                item.Text = sql.LineNumber.ToString();
                item.SubItems.Add(sql.Duration.ToString());
                item.SubItems.Add(sql.FetchCount.ToString());
                item.SubItems.Add(sql.SQLID);
                item.SubItems.Add(sql.Statement);

                view.Items.Add(item);
            }

            foreach (ColumnHeader header in view.Columns)
            {
                if (header.Text == "Fetches")
                {
                    header.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
                }
                else
                {
                    header.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
                }
            }
            view.EndUpdate();
        }
예제 #17
0
파일: Form4.cs 프로젝트: Diunax/C-CS-CPP
        private void button1_Click(object sender, EventArgs e)
        {
            string id, name, date, sex, tel, address;

            id      = textBox6.Text;
            name    = textBox5.Text;
            date    = textBox4.Text;
            sex     = textBox3.Text;
            tel     = textBox2.Text;
            address = textBox1.Text;
            string text = Form1.A.search(id, name, date, sex, tel, address);
            //1 2;
            int count = Form1.A.getsearchcount();

            //2
            if (text == null)
            {
                MessageBox.Show("查找失败!");
            }
            else
            {
                lv2.BeginUpdate();
                lv2.Items.Clear();
                string[] array = text.Split(' ');
                //array[0] 1
                //array[1] 2
                foreach (string c in array)
                {
                    if (c.Length != 0)
                    {
                        int          cc     = Int32.Parse(c);
                        string       result = Form1.A.print(cc);
                        string[]     array3 = result.Split(' ');
                        ListViewItem lvi    = new ListViewItem();
                        lvi.Text = cc + "";
                        foreach (string a in array3)
                        {
                            lvi.SubItems.Add(a);
                        }
                        this.lv2.Items.Add(lvi);
                    }
                }
                lv2.EndUpdate();
            }
            this.Close();
        }
예제 #18
0
        private void DisplayList()
        {
            var items = new string[3];

            lstSets.BeginUpdate();
            lstSets.Items.Clear();
            var imageIndex = -1;

            FillImageList();
            var num1 = MidsContext.Character.CurrentBuild.SetBonus.Count - 1;

            for (var index1 = 0; index1 <= num1; ++index1)
            {
                var num2 = MidsContext.Character.CurrentBuild.SetBonus[index1].SetInfo.Length - 1;
                for (var index2 = 0; index2 <= num2; ++index2)
                {
                    var setInfo = MidsContext.Character.CurrentBuild.SetBonus[index1].SetInfo;
                    var index3  = index2;
                    items[0] = DatabaseAPI.Database.EnhancementSets[setInfo[index3].SetIDX].DisplayName;
                    items[1] =
                        MidsContext.Character.CurrentBuild
                        .Powers[MidsContext.Character.CurrentBuild.SetBonus[index1].PowerIndex]
                        .NIDPowerset <= -1
                            ? ""
                            : DatabaseAPI.Database
                        .Powersets[
                            MidsContext.Character.CurrentBuild
                            .Powers[MidsContext.Character.CurrentBuild.SetBonus[index1].PowerIndex]
                            .NIDPowerset].Powers[
                            MainModule.MidsController.Toon.CurrentBuild
                            .Powers[MidsContext.Character.CurrentBuild.SetBonus[index1].PowerIndex]
                            .IDXPower].DisplayName;
                    items[2] = Convert.ToString(setInfo[index3].SlottedCount);
                    ++imageIndex;
                    lstSets.Items.Add(new ListViewItem(items, imageIndex));
                    lstSets.Items[lstSets.Items.Count - 1].Tag = setInfo[index3].SetIDX;
                }
            }

            lstSets.EndUpdate();
            if (lstSets.Items.Count > 0)
            {
                lstSets.Items[0].Selected = true;
            }
            FillEffectView();
        }
예제 #19
0
        public void DisplayList()
        {
            lvEntity.BeginUpdate();
            lvEntity.Items.Clear();
            int num = DatabaseAPI.Database.Entities.Length - 1;

            for (int Index = 0; Index <= num; ++Index)
            {
                ListAddItem(Index);
            }
            if (lvEntity.Items.Count > 0)
            {
                lvEntity.Items[0].Selected = true;
                lvEntity.Items[0].EnsureVisible();
            }
            lvEntity.EndUpdate();
        }
예제 #20
0
        public static ListView Fill_With_CheckboxCols(ref ListView listView1, List <Hashtable> rows,
                                                      string[] cols, ProgressBar progressBar1, bool ShowFirstCol, string[] checkBoxCols)//,bool ShowFirstCol=true
        {
            listView1.BeginUpdate();

            listView1.View      = System.Windows.Forms.View.Details;
            listView1.GridLines = true;

            listView1.Items.Clear();
            listView1.Columns.Clear();
            listView1.Font              = new System.Drawing.Font("tahoma", 11);
            listView1.OwnerDraw         = true;
            listView1.DrawColumnHeader += new DrawListViewColumnHeaderEventHandler(listview1_DrawListViewColHeader);
            listView1.DrawItem         += new DrawListViewItemEventHandler(listView1_DrawItem);
            listView1.DrawSubItem      += new DrawListViewSubItemEventHandler(listView1_DrawSubItem);

            Listview_AddColumns(ref listView1, cols);

            int l = rows.Count();

            if (progressBar1 != null)
            {
                progressBar1.Maximum = l;
                progressBar1.Value   = 0;
            }
            for (int i = 0; i < l; i++)
            {
                ListView_AddRow(ref listView1, rows[i]);
                if (progressBar1 != null)
                {
                    progressBar1.Value = i;
                }
            }

            listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            listView1.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
            int Id_colindex = 0;// ListViewHelper.GetColIndex(listView1, FirstColName);

            if (!ShowFirstCol)
            {
                listView1.Columns[Id_colindex].Width = 0;
            }

            listView1.EndUpdate();
            return(listView1);
        }
예제 #21
0
        public void SetItemText(int nItem, int nSubItem, string lpszText)
        {
            if (_control == null)
            {
                return;
            }

            ListView listView = (ListView)_control;

            listView.BeginUpdate();

            ListViewItem listItem = listView.Items[nItem];

            listItem.SubItems.Add(lpszText);

            listView.EndUpdate();
        }
예제 #22
0
        private void Add_To_List(string begin, string end, string
                                 ProgID, string parameter, ListView list)
        {
            list.BeginUpdate();

            ListViewItem item = new ListViewItem
            {
                Text = begin
            };

            item.SubItems.Add(end);
            item.SubItems.Add(ProgID);
            item.SubItems.Add(parameter);

            list.Items.Add(item);
            list.EndUpdate();
        }
예제 #23
0
        private void OnConfigIssuesDoWorkCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            _configIssuesListView.BeginUpdate();
            _configIssuesListView.SuspendLayout();

            try
            {
                var configIssues = e.Result as RemoteObjectCollection <PHPConfigIssue>;
                if (configIssues != null)
                {
                    foreach (var configIssue in configIssues)
                    {
                        var listViewItem = new ListViewItem(configIssue.SettingName);
                        if (String.IsNullOrEmpty(configIssue.CurrentValue))
                        {
                            listViewItem.SubItems.Add(Resources.ConfigIssueNone);
                        }
                        else
                        {
                            listViewItem.SubItems.Add(configIssue.CurrentValue);
                        }
                        listViewItem.SubItems.Add(configIssue.RecommendedValue);
                        listViewItem.Tag = new object[] { GetResourceStringByName(configIssue.IssueDescription),
                                                          GetResourceStringByName(configIssue.Recommendation),
                                                          configIssue.IssueIndex };
                        _configIssuesListView.Items.Add(listViewItem);
                    }
                }
            }
            catch (Exception ex)
            {
                DisplayErrorMessage(ex, Resources.ResourceManager);
            }
            finally
            {
                _configIssuesListView.ResumeLayout();
                _configIssuesListView.EndUpdate();
            }

            if (_configIssuesListView.Items.Count > 0)
            {
                _configIssuesListView.Focus();
                _configIssuesListView.Items[0].Selected = true;
                UpdateTaskForm();
            }
        }
예제 #24
0
        public static void LockUpdate(ListView ListView)
        {
            ListViewTagInformation lvtiTemp;

            if (ListView.Tag is ListViewTagInformation)
            {
                lvtiTemp = (ListViewTagInformation)ListView.Tag;
            }
            else
            {
                lvtiTemp = new ListViewTagInformation();
            }

            lvtiTemp.isLockedUpdate = true;
            ListView.Tag            = lvtiTemp;
            ListView.BeginUpdate();
        }
        /// <summary>
        /// Настройка объекта ListView для показа результатов.
        /// </summary>
        /// <param name="listView"></param>
        /// <param name="showCheckBoxs">true - show check-boxes, false - hide</param>
        private static void FormatListView(ListView listView, bool showCheckBoxs = false)
        {
            listView.BeginUpdate();

            listView.Columns.Clear();
            listView.Columns.Add("Имя файла", 370);     //0
            listView.Columns.Add("Размер", 90);         //1
            listView.Columns.Add("Дата создания", 115); //2
            listView.Columns.Add("MD5", 225);           //3
            listView.Columns.Add("Дубли", 50);          //4
            listView.Columns.Add("GUID", 220);          //5
            listView.CheckBoxes       = showCheckBoxs;
            listView.GridLines        = true;
            listView.Columns[5].Width = Debugger.IsAttached ? 220 : 0;

            listView.EndUpdate();
        }
예제 #26
0
        void printLog(Log type, string log)
        {
            string date = DateTime.Now.ToString();

            ListViewItem lvi = new ListViewItem(type.ToString());

            lvi.SubItems.Add(date);
            lvi.SubItems.Add(log);
            listView_.BeginUpdate();

            listView_.Items.Add(lvi);
            listView_.EnsureVisible(listView_.Items.Count - 1);

            listView_.EndUpdate();

            fileWrite(type, log);
        }
예제 #27
0
        private void Form_Load(object sender, EventArgs e)
        {
            motherTongueColumn.Text = book.MotherTongue;
            foreignLangColumn.Text  = book.ForeignLang;

            if (practiceList.Count == 1)
            {
                GroupStatistics.Text = Words.OverallOneWord + ":";
            }
            else
            {
                GroupStatistics.Text = string.Format(Words.OverallXWords, practiceList.Count) + ":";
            }


            ListView.BeginUpdate();
            ListView.GridLines = Settings.Default.GridLines;

            foreach (var practice in practiceList)
            {
                var word = practice.VocabularyWord;
                ListView.Items.Add(new ListViewItem(
                                       new[] { "", word.MotherTongue, word.ForeignLangText, practice.WrongInput },
                                       (int)practice.PracticeResult));
            }

            ListView.EndUpdate();
            ListView.Enabled = true;


            //Zahlen aktualiseren
            var results = practiceList.Select(x => x.PracticeResult);

            notPracticed  = results.Where(x => x == PracticeResult.NotPracticed).Count();
            wrong         = results.Where(x => x == PracticeResult.Wrong).Count();
            partlyCorrect = results.Where(x => x == PracticeResult.PartlyCorrect).Count();
            correct       = results.Where(x => x == PracticeResult.Correct).Count();

            TbNotPracticedCount.Text  = notPracticed.ToString();
            TbWrongCount.Text         = wrong.ToString();
            TbPartlyCorrectCount.Text = partlyCorrect.ToString();
            TbCorrectCount.Text       = correct.ToString();

            CalculateGrade();
        }
예제 #28
0
        private void UpdateListview(ListView pListView, IFeatureClass pFeatureClass)
        {
            try
            {
                pListView.Items.Clear();

                pListView.BeginUpdate();

                int      intNFlds    = 1;
                string[] strFldNames = null;
                string[] strLvNames  = null;

                string strOutputFldNM = "sp_out";
                string strOutput      = "Spatial Outlier";

                if (strOutputFldNM == null)
                {
                    return;
                }

                strFldNames    = new string[intNFlds];
                strFldNames[0] = strOutputFldNM;

                strLvNames    = new string[intNFlds];
                strLvNames[0] = strOutput;

                string[] strNewNames = UpdateFldNames(strFldNames, pFeatureClass);

                for (int i = 0; i < intNFlds; i++)
                {
                    ListViewItem lvi = new ListViewItem(strLvNames[i]);
                    lvi.UseItemStyleForSubItems = false;
                    lvi.SubItems.Add(new ListViewItem.ListViewSubItem(lvi, strNewNames[i]));

                    pListView.Items.Add(lvi);
                }

                pListView.EndUpdate();
            }
            catch (Exception ex)
            {
                frmErrorLog pfrmErrorLog = new frmErrorLog(); pfrmErrorLog.ex = ex; pfrmErrorLog.ShowDialog();
                return;
            }
        }
예제 #29
0
        /// <summary>
        /// リストの更新
        /// </summary>
        /// <param name="twitterAccount">Twitterアカウント</param>
        private void UpdateTwitterListView(Twitter.Twitter twitterAccount)
        {
            twitterListView.Items.Clear();
            twitterListView.BeginUpdate();

            twitterStatuses = null;

            if (UserSetting.CheckList == UserSetting.CheckLists.Friends)
            {
                twitterStatuses = twitterAccount.FriendTimeline();
            }
            else if (UserSetting.CheckList == UserSetting.CheckLists.Public)
            {
                twitterStatuses = twitterAccount.PublicTimeline();
            }

            foreach (Twitter.StatusInfomation statusInfomation in twitterStatuses)
            {
                string date = string.Empty;
                if (DateTime.Today <= statusInfomation.CreatedAt)
                {
                    date = statusInfomation.CreatedAt.ToString("HH':'mm");
                }
                else
                {
                    date = statusInfomation.CreatedAt.ToString("M'/'d");
                }

                string[] str = { statusInfomation.User.Name, statusInfomation.Text, date };

                ListViewItem item = new ListViewItem(str);
                if (statusInfomation.User.ProfileImageUrl != null)
                {
                    item.ImageIndex = GetProfileImage(statusInfomation.User.ProfileImageUrl);
                }
                twitterListView.Items.Add(item);
            }

            twitterListView.EndUpdate();

            if (twitterStatuses.Length == 0)
            {
                MessageBox.Show("ステータスがありません。", "情報");
            }
        }
예제 #30
0
        /// <summary>
        /// 处理控件内部的文本语言国际化
        /// </summary>
        /// <param name="parent"></param>
        public void langProcess(Control parent)
        {
            if (parent.Text != null && !parent.Text.Equals(""))
            {
                parent.Text = getText(parent.Text);
            }


            if (parent.ContextMenuStrip != null)
            {
                ContextMenuStrip menu = parent.ContextMenuStrip;

                foreach (ToolStripItem item in menu.Items)
                {
                    item.Text = Plugin.lang.getText(item.Text);
                }
            }

            //listview处理替换列头
            if (parent is ListView)
            {
                ListView listview             = (ListView)parent;
                System.Drawing.Graphics graph = listview.CreateGraphics();

                System.Drawing.Font font = new System.Drawing.Font("宋体", 9);

                listview.BeginUpdate();
                foreach (ColumnHeader li in listview.Columns)
                {
                    li.Text = getText(li.Text);

                    //计算文本长度
                    li.Width = (int)Math.Ceiling(graph.MeasureString(li.Text, font).Width) * 2;
                }
                listview.EndUpdate();

                graph.Dispose();
            }

            //递归处理子项
            foreach (Control control in parent.Controls)
            {
                langProcess(control);
            }
        }
예제 #31
0
 private void ShowItems(String text)
 {
     try
     {
         ClearListView();
         List <Brush> filteredList = brushList.Where(x => x.getName().ToLower().Contains(text.ToLower())).ToList();
         ItemListView.BeginUpdate();
         foreach (Brush brush in filteredList)
         {
             ItemListView.Items.Add(CreateListViewItem(brush));
         }
         ItemListView.EndUpdate();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #32
0
        /// <summary>
        /// Initialize and populate a listview.
        /// </summary>
        /// <param name="value"> </param>
        public void InitandFillListView(ListView value)
        {
            int colsize = (value.Width - 6) / 3;

            value.BeginUpdate();

            value.Columns.Clear();
            value.ListItems.Clear();

            value.View = System.WinForms.View.Report;
            value.CheckBoxes = showChecks;
            value.Columns.Add("File Name", colsize, HorizontalAlignment.Left);
            value.Columns.Add("Size (Bytes)", colsize, HorizontalAlignment.Right);
            value.Columns.Add("Path", colsize, HorizontalAlignment.Left);

            FillListView(value);

            value.EndUpdate();
        }
예제 #33
0
	public static void BuildList(string darkBasic, CheckedListBox ca, CheckedListBox cb, ListView lv, ArrayList al)
	{
		Cursor.Current = Cursors.WaitCursor;
		int s;
		string[] items;
		lv.BeginUpdate();
		lv.Items.Clear();
		StringBuilder sb = new StringBuilder(255);
		foreach (object ob in ca.Items)
		{
			string str = darkBasic + "plugins\\" + ob.ToString();
			uint hinst = Build.LoadLibrary(str);
			s = 1;
			int bad = 0;
			while (bad < 5)
			{
				if (Build.LoadString(hinst, s, sb, 255) > 0)
				{
					ListViewItem lvi = new ListViewItem();
					items = sb.ToString().Split("%".ToCharArray(), 2);
					lvi.Text = items[0];
					lvi.SubItems.Add(ob.ToString());
					lv.Items.Add(lvi);
					//add item to arraylist
					Search se = new Search(lvi.Text, lvi.SubItems[1].Text);
					al.Add(se);
				}
				else
				{
					bad ++;
				}
				s ++;
			}
			Build.FreeLibrary(hinst);
		}
		foreach (object ob in cb.Items)
		{
			string str = darkBasic + "plugins-user\\" + ob.ToString();
			uint hinst = Build.LoadLibrary(str);
			s = 1;
			int bad = 0;
			while (bad < 5)
			{
				if (Build.LoadString(hinst, s, sb, 255) > 0)
				{
					ListViewItem lvi = new ListViewItem();
					items = sb.ToString().Split("%".ToCharArray(), 2);
					lvi.Text = items[0];
					lvi.SubItems.Add(ob.ToString());
					lv.Items.Add(lvi);
					//add item to arraylist
					Search se = new Search(lvi.Text, lvi.SubItems[1].Text);
					al.Add(se);
				}
				else
				{
					bad ++;
				}
				s ++;
			}
			Build.FreeLibrary(hinst);
		}
		lv.EndUpdate();
		Cursor.Current = Cursors.Default;
	}
예제 #34
0
	public static void DoSearch(string term, ListView lv, ArrayList al)
	{
		//search al and put matches in lv
		Cursor.Current = Cursors.WaitCursor;
		term = term.ToUpper();
		int rel; //serach relevence, how many terms does this item match
		string[] terms = term.Split(" ".ToCharArray());
		lv.BeginUpdate();
		lv.Items.Clear();
		if (term == "")
		{
			//return all items
			foreach (Search s in al)
			{
				ListViewItem lvi = new ListViewItem();
				lvi.Text = s.method;
				lvi.SubItems.Add(s.dll);
				lv.Items.Add(lvi);
			}
		}
		else
		{
			ArrayList found = new ArrayList();
			foreach(Search s in al)
			{
				rel = 0;
				foreach(string str in terms)
				{
					if (str != "")
					{
						if (s.method.IndexOf(str) != -1)
							rel ++;
					}
				}
				if (rel > 0)
				{
					Search foundItem = new Search(s.method, s.dll);
					foundItem.Relevence = rel;
					found.Add(foundItem);
				}
			}
			if (found.Count > 0)
			{
				found.Sort();
				foreach (Search s in found)
				{
					ListViewItem lvi = new ListViewItem();
					lvi.Text = s.method;
					lvi.SubItems.Add(s.dll);
					lv.Items.Add(lvi);
				}
			}
		}
		lv.EndUpdate();
		Cursor.Current = Cursors.Default;
	}