BeginUpdate() public method

public BeginUpdate ( ) : void
return void
Esempio n. 1
0
 private void DisplayEventEntries(string logName, string machineName)
 {
     entryList.BeginUpdate();
     try {
         this.Cursor = Cursors.WaitCursor;
         // remove current items
         entryList.Items.Clear();
         // remove current columns
         entryList.Columns.Clear();
         // create necessary columns
         entryList.Columns.Add("Type", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Date", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Time", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Source", 200, HorizontalAlignment.Left);
         entryList.Columns.Add("Category", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Event", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("User", 100, HorizontalAlignment.Left);
         entryList.Columns.Add("Computer", 100, HorizontalAlignment.Left);
         // add eventlog entries
         using (EventLog eventLog = new EventLog(logName, machineName)) {
             EventLogEntryCollection entries = eventLog.Entries;
             foreach (EventLogEntry entry in entries)
             {
                 EventEntryView view = new EventEntryView(entry);
                 // most recent event log entries are at the top
                 entryList.Items.Insert(0, view.ListViewItem);
             }
         }
     } finally {
         this.Cursor = Cursors.Default;
         entryList.EndUpdate();
     }
 }
 public void change_jiedian_status_LieBiao(System.Windows.Forms.ListView listView_tt, int index_tt, int BaoJing)
 {
     if (BaoJing == 0)//正常
     {
         listView_tt.BeginUpdate();
         listView_tt.LargeImageList.Images[index_tt] = Bitmap.FromFile("jiedian_green.png");//这个列表的表头貌似是从1开始索引
         listView_tt.EndUpdate();
     }
     else if (BaoJing == 1)//报警
     {
         listView_tt.BeginUpdate();
         listView_tt.LargeImageList.Images[index_tt] = Bitmap.FromFile("jiedian_red.png");//这个列表的表头貌似是从1开始索引
         listView_tt.EndUpdate();
     }
     else if (BaoJing == 2)//故障
     {
         listView_tt.BeginUpdate();
         listView_tt.LargeImageList.Images[index_tt] = Bitmap.FromFile("jiedian_yellow.png");//这个列表的表头貌似是从1开始索引
         listView_tt.EndUpdate();
     }
     else if (BaoJing == 3)//掉线
     {
         listView_tt.BeginUpdate();
         listView_tt.LargeImageList.Images[index_tt] = Bitmap.FromFile("jiedian_gray.png");//这个列表的表头貌似是从1开始索引
         listView_tt.EndUpdate();
     }
 }
Esempio n. 3
0
        public void ClearErrors(IErrorSource source)
        {
            bool changed = false;

            _errorListView.BeginUpdate();
            try
            {
                for (int i = _errorListView.Items.Count - 1; i >= 0; i--)
                {
                    if (Object.ReferenceEquals(((ErrorItem)_errorListView.Items[i].Tag).Source, source))
                    {
                        _errorListView.Items.RemoveAt(i);
                        changed = true;
                    }
                }
            }
            finally
            {
                _errorListView.EndUpdate();
            }

            if (changed)
            {
                source.Disposed -= new EventHandler(ErrorSourceDisposed);
                _errorSources.Remove(source);
            }
        }
Esempio n. 4
0
        private void btnUp_Click(object sender, EventArgs e)
        {
            int indexFrom  = getSelectedIndex();
            var deviceFrom = indexFrom < lstNavigation.Items.Count - 1 ?
                             m_devList[indexFrom] :
                             null;

            if (deviceFrom is IUlaDevice)
            {
                return;
            }
            if (deviceFrom is IMemoryDevice)
            {
                return;
            }
            int indexTo = indexFrom - 1;

            if (indexTo < 0)
            {
                return;
            }
            var deviceTo = indexTo < lstNavigation.Items.Count - 1 ?
                           m_devList[indexTo] :
                           null;

            if (deviceTo is IUlaDevice)
            {
                return;
            }
            if (deviceTo is IMemoryDevice)
            {
                return;
            }
            int tmp = deviceFrom.BusOrder;

            deviceFrom.BusOrder = deviceTo.BusOrder;
            deviceTo.BusOrder   = tmp;

            var device = m_devList[indexFrom];

            m_devList.RemoveAt(indexFrom);
            m_devList.Insert(indexTo, device);
            var ctl = m_ctlList[indexFrom];

            m_ctlList.RemoveAt(indexFrom);
            m_ctlList.Insert(indexTo, ctl);
            var lvi = lstNavigation.Items[indexFrom];

            lstNavigation.BeginUpdate();
            lstNavigation.Items.RemoveAt(indexFrom);
            lstNavigation.Items.Insert(indexTo, lvi);
            lstNavigation.EndUpdate();
            btnUp.Enabled   = IsMoveUpAllowed();
            btnDown.Enabled = IsMoveDownAllowed();
        }
        private void SetupTeeList()
        {
            lstTees.View      = View.Details;
            lstTees.GridLines = true;
            lstTees.BeginUpdate();
            lstTees.Clear();
            lstTees.Columns.Add("Stats", 100, HorizontalAlignment.Left);
            for (int k = 0; k < (int)cmbHoles.SelectedItem; k++)
            {
                lstTees.Columns.Add((k + 1).ToString(), 50, HorizontalAlignment.Center);
            }

            ListViewItem Blue = lstTees.Items.Add("Blue Tee");

            Blue.ForeColor = Color.Blue;
            ListViewItem White = lstTees.Items.Add("White Tee");
            ListViewItem Red   = lstTees.Items.Add("Red Tee");

            Red.ForeColor = Color.Red;
            ListViewItem Par = lstTees.Items.Add("Par");

            if (cmbCourseName.SelectedItem != null)
            {
                ThisCourse = (ICourseInfo)cmbCourseName.SelectedItem;
                foreach (Tees tee in ThisCourse.Hole)
                {
                    Blue.SubItems.Add(tee.BlueDistance.ToString(), Color.Blue, Color.Linen, lstTees.Font);
                    White.SubItems.Add(tee.WhiteDistance.ToString(), Color.Black, Color.Linen, lstTees.Font);
                    Red.SubItems.Add(tee.RedDistance.ToString(), Color.Red, Color.Linen, lstTees.Font);
                    Par.SubItems.Add(tee.Par.ToString());
                }
            }
            lstTees.EndUpdate();
        }
Esempio n. 6
0
        // read list of catalog entries for the given catalog
        private void PopulateMembers(string lib, string cat)
        {
            Cursor c = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            lvMembers.BeginUpdate();
            lvMembers.Items.Clear();

            SasCatalog catalog = new SasCatalog(currentServer, lib, cat);

            foreach (SasCatalogEntry entry in catalog.GetSasCatalogEntries())
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = entry.Name;
                lvi.SubItems.Add(entry.ObjectType);
                lvi.SubItems.Add(entry.Description);
                (lvi.SubItems.Add(entry.Created.ToString())).Tag      = entry.Created;
                (lvi.SubItems.Add(entry.LastModified.ToString())).Tag = entry.LastModified;
                lvi.ImageIndex = GetImageIndexForEntry(entry.ObjectType.ToString());
                lvi.Tag        = string.Format("{0}.{1}.{2}.{3}", lib, cat, lvi.Text, entry.ObjectType);
                lvMembers.Items.Add(lvi);
            }

            lvMembers.EndUpdate();

            Cursor.Current = c;

            UpdateToolbar();
        }
Esempio n. 7
0
        public void AddChecked(IEnumerable<string> list, ListView listView)
        {
            if (list == null)
            {
                return;
            }

            ImageList imageList = new ImageList();
            imageList.ImageSize = new Size(16, 16);
            imageList.ColorDepth = ColorDepth.Depth32Bit;
            // Add a default image at position 0;
            imageList.Images.Add(Properties.Resources.Tick_16x16);

            var pagelist = list.ToArray();
            ListViewItem[] items = new ListViewItem[pagelist.Length];
            for (int i = 0; i < pagelist.Length; i++)
            {
                ListViewItem item = new ListViewItem(pagelist[i].Substring(pagelist[i].LastIndexOf('.') + 1));
                item.ImageIndex = 0;
                items[i]= item;
            }

            listView.Invoke((Action)(() =>
            {
                listView.LargeImageList = imageList;
                listView.SmallImageList = imageList;

                listView.BeginUpdate();
                listView.Items.Clear();
                listView.Items.AddRange(items);

                listView.EndUpdate();
            }));
        }
Esempio n. 8
0
        public bool reloadData()
        {
            if (criteres == null || cmFiltre.LastSelected == null)
            {
                return(false);
            }

            listView1.BeginUpdate();
            try
            {
                listView1.Items.Clear();
                Type listClass = ((comboItems)cmFiltre.LastSelected).listClass;
                System.Reflection.ConstructorInfo construc = listClass.GetConstructor(new Type[] { typeof(string[]) });
                object Items = construc.Invoke(new object[] { criteres });
                foreach (BaseRecord item in Items as ArrayList)
                {
                    listView1.Items.Add(new RepertoireListViewItem(item));
                }
                return(true);
            }
            finally
            {
                listView1.EndUpdate();
            }
        }
Esempio n. 9
0
        public TermVector(string fieldName, TermFreqVector tfv)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            lblField.Text = fieldName;

            List <TermFrequency> tvs = new List <TermFrequency>(tfv.Size());

            String[] terms = tfv.GetTerms();
            int[]    freqs = tfv.GetTermFrequencies();
            for (int i = 0; i < terms.Length; i++)
            {
                tvs.Add(new TermFrequency(terms[i], freqs[i]));
            }

            tvs.OrderBy(p => p.Term);

            listViewTVF.BeginUpdate();

            foreach (TermFrequency tf in tvs)
            {
                ListViewItem item = new ListViewItem(new string[] { tf.Frequency.ToString(), tf.Term });
                listViewTVF.Items.Add(item);
            }

            listViewTVF.EndUpdate();
        }
 private void GetList(MovieList list)
 {
     lstRentals.BeginUpdate();
     lstRentals.Items.Clear();
     lstRentals.Items.AddRange(list.Items);
     lstRentals.EndUpdate();
 }
Esempio n. 11
0
        private void BindList()
        {
            DataTable dt = Helper.Query("select * from tbSpecialOilDept where cnvcdeliverycompany like '" + CMSMData.CMSMDataAccess.SysInitial.LocalDeptNameTmp + "%'", true);

            listView1.Items.Clear();
            listView1.Columns.Clear();
            listView1.GridLines     = true;         //显示行与行之间的分隔线
            listView1.FullRowSelect = true;         //要选择就是一行
            listView1.View          = View.Details; //定义列表显示的方式
            listView1.Scrollable    = true;         //需要时候显示滚动条
            listView1.MultiSelect   = false;        // 不可以多行选择
            listView1.HeaderStyle   = ColumnHeaderStyle.Clickable;

            listView1.Columns.Add("合同编号", 200, HorizontalAlignment.Left);
            listView1.Columns.Add("单位名称", 270, HorizontalAlignment.Left);

            listView1.BeginUpdate();
            foreach (DataRow dr in dt.Rows)
            {
                Entity.SpecialOilDept so  = new SpecialOilDept(dr);
                ListViewItem          lvi = new ListViewItem(new string[] { so.cnvcContractNo, so.cnvcDeliveryCompany });
                listView1.Items.Add(lvi);
            }
            listView1.EndUpdate();
        }
Esempio n. 12
0
        /// <summary>
        /// Helper function that fills in the list of revisions.
        /// This is used from the code above and from the FormRevisionHistory.
        /// </summary>
        public static void UpdateList(ListView listRev, string input)
        {
            App.StatusBusy(true);
            string[] response = input.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            listRev.BeginUpdate();
            listRev.Items.Clear();

            foreach (string s in response)
            {
                string[] cat = s.Split('\t');

                // Convert the date/time from UNIX second based to C# date structure
                DateTime date = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Convert.ToDouble(cat[1])).ToLocalTime();
                cat[1] = String.Format("{0:yyyy/MM/dd  HH:mm:ss}", date);

                // Trim any spaces in the subject line
                cat[3] = cat[3].Trim();
                // Limit the subject line length to the length specified for that
                int c1 = Convert.ToInt32(Properties.Settings.Default.commitW1);
                if (cat[3].Length > c1)
                    cat[3] = cat[3].Substring(0, c1) + "...";

                ListViewItem li = new ListViewItem(cat);
                li.Name = cat[0];           // Used to search for a key
                li.Tag = cat[0];            // Tag contains the SHA1 of the commit
                listRev.Items.Add(li);
            }

            // Make columns auto-adjust to fit the width of the largest item
            foreach (ColumnHeader l in listRev.Columns) l.Width = -2;

            listRev.EndUpdate();
            App.StatusBusy(false);
        }
        private void FillListView()
        {
            lvwFields.Items.Clear();
            lvwFields.ListViewItemSorter = null;

            lvwFields.BeginUpdate();
            foreach (object o in _fields)
            {
                try {
                    DataFieldColumn d = (DataFieldColumn)o;

                    string       colname = d.ColumnName + ((d.PrimaryKey)?"-[PK]":"") + ((d.VerifiedField)?"-[VERIFIED]":"") + ((d.Excluded)?"-[EXCLUDED]":"");
                    ListViewItem lvi     = lvwFields.Items.Add(colname);
                    lvi.SubItems.Add(d.FieldSetupString());
                    lvi.SubItems.Add(d.FieldDataTypeString());
                    lvi.SubItems.Add(d.FieldLabel);
                    lvi.SubItems.Add(d.TabIndex.ToString());
                    lvi.Tag = d;
                }
                catch (Exception e)
                {
                    string s  = e.Message;
                    string st = e.StackTrace;
                }
            }

            lvwFields.EndUpdate();

            //sort
            Sort();
        }
Esempio n. 14
0
        private void InitList()
        {
            _listView.Items.Clear();
            StringResource sr = UsabilityPlugin.Strings;

            //ListItem
            _listView.BeginUpdate();
            foreach (ItemTag it in _itemTags)
            {
                if (IsVisibleItem(it.Item))
                {
                    ListViewItem lvi = new ListViewItem(it.Item.FullQualifiedId);
                    lvi.SubItems.Add(sr.GetString(it.TypeStringID));
                    lvi.SubItems.Add(it.ValueString);
                    if (it.IsChanged)
                    {
                        lvi.Font = _boldFont;
                    }

                    lvi.Tag = it;
                    _listView.Items.Add(lvi);
                }
            }
            _listView.EndUpdate();
        }
Esempio n. 15
0
 private void RefreshItems(bool displayThreadTimes)
 {
     AsyncProcessor[] procs = AsyncProcessor.GetAllPooledProcessors();
     _listView.BeginUpdate();
     try
     {
         _listView.Items.Clear();
         foreach (AsyncProcessor proc in procs)
         {
             ListViewItem item = new ListViewItem();
             item.Tag  = proc;
             item.Text = proc.ThreadName;
             item.SubItems.Add(proc.ThreadPriority.ToString());
             if (displayThreadTimes)
             {
                 item.SubItems.Add(proc.GetKernelTime().ToString());
                 item.SubItems.Add(proc.GetUserTime().ToString());
             }
             _listView.Items.Add(item);
         }
     }
     finally
     {
         _listView.EndUpdate();
     }
 }
Esempio n. 16
0
		private void CADDataRowChangedHandler(object sender, DataRowChangeEventArgs e)
		{
			if (e.Action == DataRowAction.Add)
			{
				GISADataset.ControloAutDicionarioRow changedCadRow = null;
				changedCadRow = (GISADataset.ControloAutDicionarioRow)e.Row;
				GISADataset.ControloAutRow changedCaRow = null;
				changedCaRow = changedCadRow.ControloAutRow;

				Debug.WriteLine("[CONTROLO AUT DICIONARIO ADDED]" + new StackFrame(true).ToString());

				Trace.Assert(e.Row is GISADataset.ControloAutDicionarioRow);

				foreach (ListViewItem item in lstVwIndexacao.Items)
				{
					GISADataset.IndexFRDCARow ifrdcaRow = null;
					ifrdcaRow = (GISADataset.IndexFRDCARow)item.Tag;

					if (changedCaRow == ifrdcaRow.ControloAutRow)
					{
						// actualizar a interface com a forma autorizada do CA em causa
						foreach (GISADataset.ControloAutDicionarioRow cadRow in GisaDataSetHelper.GetInstance().ControloAutDicionario.Select(string.Format("IDControloAut={0}", changedCaRow.ID)))
						{
							if (cadRow.TipoControloAutFormaRow.ID == Convert.ToInt64(TipoControloAutForma.FormaAutorizada))
							{
								lstVwIndexacao.BeginUpdate();
								item.SubItems[0].Text = cadRow.DicionarioRow.Termo;
								lstVwIndexacao.EndUpdate();
								break;
							}
						}
					}
				}
			}
		}
Esempio n. 17
0
        private void GetAssignedAssets()
        {
            try
            {
                if (mTaskInfo.GetHasAsset())
                {
                    TaskAsscociatedAssetsListView.Items.Clear();
                    TaskAsscociatedAssetsListView.BeginUpdate();

                    foreach (MOG_Filename mogAssetName in MOG_DBTaskAPI.GetTaskAssetLinks(mTaskInfo.GetTaskID()))
                    {
                        ListViewItem item = new ListViewItem();

                        item.Text = mogAssetName.GetAssetLabel();
                        item.SubItems.Add(mogAssetName.GetAssetClassification());
                        item.SubItems.Add(mogAssetName.GetVersionTimeStampString(""));
                        item.SubItems.Add(mogAssetName.GetEncodedFilename());
                        item.ImageIndex = MogUtil_AssetIcons.GetClassIconIndex(mogAssetName.GetEncodedFilename());

                        TaskAsscociatedAssetsListView.Items.Add(item);
                    }

                    TaskAsscociatedAssetsListView.EndUpdate();
                }
            }
            catch
            {
            }
        }
Esempio n. 18
0
        private void AddNewIdentity(UserIdentity ui)
        {
            if (ui == null)
            {
                throw new ArgumentNullException("ui");
            }

            if (string.IsNullOrEmpty(ui.Name))
            {
                ui.Name = "New";                 // SR.NewUserIdentityNameTemplate"];
            }
            if (this.userIdentities.Contains(ui.Name))
            {
                do
                {
                    unnamedUserIdentityCounter++;
                } while(this.userIdentities.Contains(ui.Name + " #" + unnamedUserIdentityCounter));
                ui.Name += " #" + unnamedUserIdentityCounter;
            }

            this.userIdentities.Add(ui.Name, ui);
            try {
                listAccounts.BeginUpdate();
                ListViewItem newItem = listAccounts.Items.Add(new ListViewItem(ui.Name, 0));
                newItem.Tag      = ui.Name;
                newItem.Selected = true;                        // cause event fired
            } finally {
                listAccounts.EndUpdate();
            }
        }
Esempio n. 19
0
    //<snippet1>
    private void InitializeListView()
    {
        this.ListView1 = new System.Windows.Forms.ListView();

        // Set properties such as BackColor and DockStyle and Location.
        this.ListView1.BackColor     = System.Drawing.SystemColors.Control;
        this.ListView1.Dock          = System.Windows.Forms.DockStyle.Top;
        this.ListView1.Location      = new System.Drawing.Point(0, 0);
        this.ListView1.Size          = new System.Drawing.Size(292, 130);
        this.ListView1.View          = System.Windows.Forms.View.Details;
        this.ListView1.HideSelection = false;

        // Allow the user to select multiple items.
        this.ListView1.MultiSelect = true;

        // Show CheckBoxes in the ListView.
        this.ListView1.CheckBoxes = true;

        //Set the column headers and populate the columns.
        ListView1.HeaderStyle = ColumnHeaderStyle.Nonclickable;

        ColumnHeader columnHeader1 = new ColumnHeader();

        columnHeader1.Text      = "Breakfast Choices";
        columnHeader1.TextAlign = HorizontalAlignment.Left;
        columnHeader1.Width     = 146;

        ColumnHeader columnHeader2 = new ColumnHeader();

        columnHeader2.Text      = "Price Each";
        columnHeader2.TextAlign = HorizontalAlignment.Center;
        columnHeader2.Width     = 142;

        this.ListView1.Columns.Add(columnHeader1);
        this.ListView1.Columns.Add(columnHeader2);

        string[] foodList = new string[] { "Juice", "Coffee",
                                           "Cereal & Milk", "Fruit Plate", "Toast & Jelly",
                                           "Bagel & Cream Cheese" };

        string[] foodPrice = new string[] { "1.09", "1.09", "2.19",
                                            "2.79", "2.09", "2.69" };

        int count;

        // Members are added one at a time, so call BeginUpdate to ensure
        // the list is painted only once, rather than as each list item is added.
        ListView1.BeginUpdate();

        for (count = 0; count < foodList.Length; count++)
        {
            ListViewItem listItem = new ListViewItem(foodList[count]);
            listItem.SubItems.Add(foodPrice[count]);
            ListView1.Items.Add(listItem);
        }

        //Call EndUpdate when you finish adding items to the ListView.
        ListView1.EndUpdate();
        this.Controls.Add(this.ListView1);
    }
Esempio n. 20
0
        private void RefreshButton_Click(object sender, System.EventArgs e)
        {
            NodeList.BeginUpdate();

            NodeList.Items.Clear();

            foreach (CrawlNode node in CrawlMap.Values)
            {
                if (node.Ack != null)
                {
                    NodeList.Items.Add(new ListViewItem(new string[]
                    {
                        Utilities.IDtoBin(node.Contact.RoutingID),
                        node.Contact.IP.ToString(),
                        node.Ack.Version,
                        (node.Ack.Source.Firewall).ToString(),
                        new TimeSpan(0, 0, 0, node.Ack.Uptime, 0).ToString(),
                        GetProxyIDs(true, node),
                        GetProxyIDs(false, node),
                        ""
                    }));
                }
            }

            NodeList.EndUpdate();
        }
Esempio n. 21
0
        private void PopulateListView()
        {
            TraceListView.BeginUpdate();
            TraceListView.Clear();
            if (checkedNodesList.Count == 0)
            {
                TraceListView.EndUpdate();
                TraceListView.Enabled = false;
                return;
            }
            else
            {
                TraceListView.Enabled = true;
            }

            if (ProcessViewBtn.Pushed)
            {
                PopulateColumns_ProcessView();
            }
            else
            {
                PopulateColumns();
            }

            // autosize the columns
            foreach (ColumnHeader ch in TraceListView.Columns)
            {
                ch.Width = -2;                  // autosize
            }
            TraceListView.EndUpdate();
        }
Esempio n. 22
0
        public TermVector(string fieldName, TermFreqVector tfv)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            lblField.Text = fieldName;
            IntPair[] tvs   = new IntPair[tfv.Size()];
            String[]  terms = tfv.GetTerms();
            int[]     freqs = tfv.GetTermFrequencies();
            for (int i = 0; i < terms.Length; i++)
            {
                IntPair ip = new IntPair(freqs[i], terms[i]);
                tvs[i] = ip;
            }
            Array.Sort(tvs, new IntPair.PairComparator(false, true));

            listViewTVF.BeginUpdate();

            for (int i = 0; i < tvs.Length; i++)
            {
                ListViewItem item = new ListViewItem(
                    new string[] { tvs[i].cnt.ToString(), tvs[i].text });
                listViewTVF.Items.Add(item);
            }

            listViewTVF.EndUpdate();
        }
Esempio n. 23
0
        //添加单行数据
        public void AddListViewData(ListView list, Dictionary<string, string> data)
        {
            if (list.InvokeRequired)//不能访问就创建委托
            {
                ListViewDelegate d = new ListViewDelegate(AddListViewData);
                list.Invoke(d, new object[] { list, data });
            }
            else
            {
                list.BeginUpdate();
                ListViewItem list_item = new ListViewItem();
                bool need_init = true;
                foreach (KeyValuePair<string, string> cell in data)
                {
                    ListViewItem.ListViewSubItem list_sub_item = new ListViewItem.ListViewSubItem();
                    if (need_init)
                    {
                        list_item.Text = cell.Value;
                        need_init = false;
                    }
                    else
                    {
                        list_sub_item.Text = cell.Value;
                        list_item.SubItems.Add(list_sub_item);
                    }
                }
                list.Items.Add(list_item);
                list.EnsureVisible(list.Items.Count - 1);
                list.EndUpdate();

            }
        }
Esempio n. 24
0
        /// <summary>
        /// puts all sky layers into the list control
        /// </summary>
        void FillLayerList(int iSelectedItem)
        {
            ListView_Layers.Items.Clear();
            ListView_Layers.SelectedItems.Clear();
            if (SkyConfig == null || SkyConfig.Layers == null)
            {
                SetButtonStates();
                return;
            }
            ListView_Layers.BeginUpdate();
            foreach (SkyLayer layer in SkyConfig.Layers)
            {
                ListView_Layers.Items.Add(layer.ToString());
            }

            // select the first layer
            if (SkyConfig.Layers.Count > 0)
            {
                if (iSelectedItem >= ListView_Layers.Items.Count)
                {
                    iSelectedItem = ListView_Layers.Items.Count - 1;
                }

                ListView_Layers.Items[iSelectedItem].Selected = true;
            }
            ListView_Layers.EndUpdate();

            // enable/disable layer buttons
            SetButtonStates();
            this.PropertyGrid_Sky.SelectedObject = _skyConfig;
        }
        private void DisplayDescriptors(SnapInDescriptor[] descriptors)
        {
            try
            {
                _listView.BeginUpdate();
                _listView.Items.Clear();
                _listView.Sorting = SortOrder.Ascending;

                foreach (SnapInDescriptor descriptor in descriptors)
                {
                    ListViewItem item = new ListViewItem(descriptor.MetaData.Title);
                    item.SubItems.Add(descriptor.MetaData.Description);
                    item.SubItems.Add((descriptor.IsStarted ? "Started" : null));
                    item.Tag = descriptor;

                    // use the descriptors image if we can
                    item.ImageIndex = _smallImageList.Images.Count;
                    _smallImageList.Images.Add(descriptor.MetaData.Image);

                    // mark those that are uninstalled
                    if (descriptor.IsUninstalled)
                    {
                        item.ForeColor = SystemColors.GrayText;
                    }

                    _listView.Items.Add(item);
                }

                _listView.EndUpdate();
            }
            catch (System.Exception systemException)
            {
                System.Diagnostics.Trace.WriteLine(systemException);
            }
        }
Esempio n. 26
0
        public void AddLoggerLines()
        {
            try
            {
                if (TiffDll_Methods.errorList != null && TiffDll_Methods.errorList.Count > 0)
                {
                    string[] sget = TiffDll_Methods.errorList.ToArray();
                    TiffDll_Methods.errorList.Clear();

                    if (sget != null && sget.Length > 0)
                    {
                        listView1.BeginUpdate();
                        foreach (string s in sget)
                        {
                            listView1.Items.Add(new ListViewItem(new string[] { DateTime.Now.ToString("[dd/MM/yyyy HH:mm:ss:fffff]"), s }));
                        }

                        listView1.EndUpdate();
                    }
                }
            }
            catch (Exception ex)
            {
                TiffDll_Methods.errorList.Add(string.Format("Error in [{0}], error: [{1}]", MethodBase.GetCurrentMethod().Name, ex.ToString()));
            }
        }
Esempio n. 27
0
        void refreshFileList()
        {
            listView1.Items.Clear();
            listView2.Items.Clear();

            if (workingDirectory == null || workingDirectory.Length == 0)
            {
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            try
            {
                string[] files      = Directory.GetFiles(workingDirectory);
                int      imageIndex = 0;
                imageList1.Images.Clear();
                SHFILEINFO shinfo = new SHFILEINFO();
                listView1.BeginUpdate();
                listView2.BeginUpdate();
                foreach (string s in files)
                {
                    FileInfo fi = new FileInfo(s);
                    if (fi.Extension.ToLower() == ".enc")
                    {
                        ListViewItem lvi = new ListViewItem(fi.Name);
                        lvi.SubItems.Add(fi.Length.ToString());
                        lvi.Tag        = fi.FullName;
                        lvi.ImageIndex = 0;
                        listView2.Items.Add(lvi);
                    }
                    else
                    {
                        //extract file icon
                        IntPtr hImgSmall = MyShell.SHGetFileInfo(s, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo),
                                                                 MyShell.SHGFI_ICON |
                                                                 MyShell.SHGFI_SMALLICON);
                        //The icon is returned in the hIcon member of the shinfo
                        //struct
                        System.Drawing.Icon myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon);
                        imageList1.Images.Add(myIcon);

                        ListViewItem lvi = new ListViewItem(fi.Name);
                        lvi.ImageIndex = imageIndex++;
                        lvi.SubItems.Add(fi.Length.ToString());
                        lvi.Tag = fi.FullName;
                        listView1.Items.Add(lvi);
                    }
                }
                listView1.EndUpdate();
                listView2.EndUpdate();
            }
            catch (IOException ex)
            {
                MessageBox.Show("Erro ao atualizar lista de arquivos: " + ex.Message);
            }
            finally
            {
                this.Cursor = Cursors.Arrow;
            }
        }
        // read list of catalog entries for the given catalog
        private void PopulateMembers(string lib, string cat)
        {
            Cursor c = Cursor.Current;

            Cursor.Current = Cursors.WaitCursor;

            lvMembers.BeginUpdate();
            lvMembers.Items.Clear();

            SAS.Workspace ws = null;
            try
            {
                ws = consumer.Workspace(currentServer) as SAS.Workspace;
            }
            catch (Exception ex)
            {
                throw new System.Exception("ISASTaskConsumer.Workspace is not usable!", ex);
            }

            if (currentServer.Length > 0 && ws != null)
            {
                // use the SAS IOM OLEDB provider to read data from the SAS workspace
                ADODB.Recordset  adorecordset = new ADODB.RecordsetClass();
                ADODB.Connection adoconnect   = new ADODB.ConnectionClass();

                try
                {
                    adoconnect.Open("Provider=sas.iomprovider.1; SAS Workspace ID=" + ws.UniqueIdentifier, "", "", 0);
                    // use the SASHELP.VCATALG view to get all of the catalog entries in the specified library/catalog
                    string selectclause = "select * from sashelp.vcatalg where libname='" + lib + "' and memname = '" + cat + "'";
                    adorecordset.Open(selectclause, adoconnect, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText);

                    while (!adorecordset.EOF)
                    {
                        ListViewItem lvi = new ListViewItem();
                        lvi.Text = adorecordset.Fields["objname"].Value.ToString();
                        lvi.SubItems.Add(adorecordset.Fields["objtype"].Value.ToString());
                        lvi.SubItems.Add(adorecordset.Fields["objdesc"].Value.ToString());
                        lvi.SubItems.Add(ConvertSASDate(adorecordset.Fields["created"].Value.ToString()));
                        lvi.SubItems.Add(ConvertSASDate(adorecordset.Fields["modified"].Value.ToString()));
                        lvi.ImageIndex = GetImageIndexForEntry(adorecordset.Fields["objtype"].Value.ToString());
                        lvi.Tag        = string.Format("{0}.{1}.{2}.{3}", lib, cat, lvi.Text, adorecordset.Fields["objtype"].Value.ToString());
                        lvMembers.Items.Add(lvi);
                        adorecordset.MoveNext();
                    }
                }
                catch {}
                finally
                {
                    adoconnect.Close();
                }
            }

            lvMembers.EndUpdate();

            Cursor.Current = c;

            UpdateToolbar();
        }
Esempio n. 29
0
 public void InitialListView(ListView listView)
 {
     listView.Clear();
     InsertAllColumns(listView);
     listView.BeginUpdate();
     AddFlowItem(listView);
     listView.EndUpdate();
 }
Esempio n. 30
0
        /// <summary>
        /// 用于在listview中显示对应Ip是否在线
        /// </summary>
        /// <param name="lvi">绑定的控件</param>
        /// <param name="text">在线信息</param>
        public void ShwMsgforView(ListView lvi, string[] text)
        {
            if (lvi.InvokeRequired)
            {
                ShwMsgforViewCallBack shwMsgforViewCallBack = ShwMsgforView;
                lvi.Invoke(shwMsgforViewCallBack, new object[] { lvi, text });
                int count = lvi.Items.Count;
                int rownum = IsExistsItem(text[1], lvi);
                if (rownum >= 0)
                {
                    lvi.BeginUpdate();
                    lvi.Items[rownum].SubItems[1].Text = text[1];
                    lvi.Items[rownum].SubItems[2].Text = text[0];
                    //------------------记录
                    lvi.EndUpdate();

                }
                else
                {
                    string[] str = new string[]{
                       (count+1).ToString(),
                       text[1],
                         text[0],
                         " ",
                        " ",
                        " ",
                          " ",
                        " ",
                          " ",
                        " ",
                          " ",
                          " "
                    };

                    ListViewItem lit = new ListViewItem(str);
                    lvi.BeginUpdate();
                    lvi.Items.Add(lit);
                    lvi.EndUpdate();
                }

            }
            else
            {

            }
        }
Esempio n. 31
0
        /// <summary>Filters an Experiments listview control, using filter text and type</summary>
        /// <param name="lv">Experiments ListView to filter</param>
        /// <param name="text">Text to look for</param>
        /// <param name="type">The filter type (i.e. column to filter)</param>
        public static void FilterExperimentsListView(ListView lv, string text, ComboBox type)
        {
            int column = MainForm.COL_INDEX_NAME;
            string filterType = type.SelectedItem == null ? "Name" : type.SelectedItem.ToString();

            switch (filterType)
            {
                case "Name":
                    // set by default
                    break;
                case "Institute":
                    column = MainForm.COL_INDEX_INSTITUTE;
                    break;
                case "Dataset":
                    column = MainForm.COL_INDEX_DATASET;
                    break;
                case "Tags":
                    column = MainForm.COL_INDEX_TAGS;
                    break;
            }

            lv.BeginUpdate();

            for (int i = lv.Items.Count - 1; i >= 0; i--)
            {
                ListViewItem lvi = lv.Items[i];

                if (column != MainForm.COL_INDEX_TAGS)
                {
                    ListViewItem.ListViewSubItem lvsi = lvi.SubItems[column];
                    if (!lvsi.Text.Contains(text))
                    {
                        lv.Items.Remove(lvi);
                    }
                }
                else
                {
                    string[] tags = text.Split(',');
                    bool containsTag = false;
                    ListViewItem.ListViewSubItem lvsi = lvi.SubItems[column];

                    foreach (string tag in tags)
                    {
                        if (lvsi.Text.Contains(tag))
                        {
                            containsTag = true;
                        }
                    }

                    if (!containsTag)
                    {
                        lv.Items.Remove(lvi);
                    }
                }
            }

            lv.EndUpdate();
        }
Esempio n. 32
0
        public SyncLatestSummaryForm(MOG_Ini summary)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            mSummary = summary;

            SummaryListView.SmallImageList = MogUtil_AssetIcons.Images;

            int totalCopied  = 0;
            int totalSkipped = 0;
            int totalDeleted = 0;

            SummaryListView.BeginUpdate();

            totalSkipped += AppendSummary("Files.Skipped", "Skipped", Color.Purple);

            totalCopied  += AppendSummary("Files.New", "New", Color.Green);
            totalCopied  += AppendSummary("Files.Copied", "Updated", Color.Green);
            totalCopied  += AppendSummary("Files.Restored", "Restored", Color.ForestGreen);
            totalCopied  += AppendSummary("Files.Reverted", "Reverted", Color.DarkGreen);
            totalDeleted += AppendSummaryNonExistant("Files.Removed", "Removed", Color.OrangeRed);
            totalCopied  += AppendSummary("Files.Up-to-date", "Up-to-date", Color.Black);
            totalCopied  += AppendSummary("Files.Restamped", "Restamped", Color.ForestGreen);

            totalCopied += AppendSummary("Assets.Canceled", "Canceled", Color.Firebrick);

            totalCopied += AppendSummary("Files.Missing", "Missing", Color.Firebrick);
            totalCopied += AppendSummary("Assets.Missing", "Missing", Color.Firebrick);
            totalCopied += AppendSummary("Files.RemoveError", "Remove Failed", Color.Firebrick);
            totalCopied += AppendSummary("Files.CopyError", "Copy Failed", Color.Firebrick);

            TotalCopiedLabel.Text  = TotalCopiedLabel.Text + " " + totalCopied.ToString();
            TotalSkippedLabel.Text = TotalSkippedLabel.Text + " " + totalSkipped.ToString();
            TotalDeletedLabel.Text = TotalDeletedLabel.Text + " " + totalDeleted.ToString();

            if (SummaryListView.Items.Count == 0)
            {
                // Check if the user canceled?
                if (mSummary.SectionExist("Assets.Canceled"))
                {
                    SummaryListView.Items.Add("User Canceled!");
                }
                else
                {
                    SummaryListView.Items.Add("All assets current!");
                }
            }

            SummaryListView.EndUpdate();

            // Initialize sorting columns
            mSortManager = new ListViewSortManager(SummaryListView, new Type[] { typeof(ListViewTextCaseInsensitiveSort),
                                                                                 typeof(ListViewDateSort),
                                                                                 typeof(ListViewTextCaseInsensitiveSort) });
        }
Esempio n. 33
0
        private void CopyMessagesToClipboard()
        {
            try
            {
                IEnumerable items = default(IEnumerable);
                if (lvErrorCollector.SelectedItems.Count > 0)
                {
                    items = lvErrorCollector.SelectedItems;
                }
                else
                {
                    items = lvErrorCollector.Items;
                }

                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine("----------");

                lvErrorCollector.BeginUpdate();

                Messages.Message message = default(Messages.Message);
                foreach (ListViewItem item in items)
                {
                    message = item.Tag as Messages.Message;
                    if (message == null)
                    {
                        continue;
                    }

                    stringBuilder.AppendLine(message.MsgClass.ToString());
                    stringBuilder.AppendLine(message.MsgDate.ToString());
                    stringBuilder.AppendLine(message.MsgText);
                    stringBuilder.AppendLine("----------");
                }

                Clipboard.SetText(stringBuilder.ToString());
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, "UI.Window.ErrorsAndInfos.CopyMessagesToClipboard() failed." + Environment.NewLine + ex.Message, true);
            }
            finally
            {
                lvErrorCollector.EndUpdate();
            }
        }
Esempio n. 34
0
        InitDatabaseTab()
        {
            m_lvDb.BeginUpdate();

            m_snoopCollector.Collect(m_db);
            Snoop.Utils.Display(m_lvDb, m_snoopCollector);

            m_lvDb.EndUpdate();
        }
Esempio n. 35
0
 private void BMRefresh(object o, EventArgs e)
 {
     lock (BatchManagerList)
     {
         BatchManagerList.BeginUpdate();
         long selectedid = 0;
         if (BatchManagerList.SelectedItems.Count == 1)
         {
             selectedid = Convert.ToInt64(BatchManagerList.SelectedItems[0].Tag);
         }
         try
         {
             BatchManagerList.Items.Clear();
             long [] ids = BMSrv.Operations;
             foreach (long id in ids)
             {
                 try
                 {
                     ListViewItem li = BatchManagerList.Items.Add(id.ToString());
                     li.Tag = id;
                     SySal.DAQSystem.Drivers.BatchSummary binfo = BMSrv.GetSummary(id);
                     if (binfo == null)
                     {
                         continue;
                     }
                     li.SubItems.Add(binfo.Executable);
                     li.SubItems.Add(binfo.MachineId.ToString());
                     li.SubItems.Add(binfo.BrickId == 0 ? "" : binfo.BrickId.ToString());
                     li.SubItems.Add(binfo.PlateId == 0 ? "" : binfo.PlateId.ToString());
                     li.SubItems.Add(binfo.DriverLevel.ToString());
                     if (binfo.OpStatus == SySal.DAQSystem.Drivers.Status.Running)
                     {
                         li.SubItems.Add((binfo.Progress * 100.0).ToString("F1") + "% ETR: " + binfo.ExpectedFinishTime.ToString("HH:mm:ss"));
                     }
                     else
                     {
                         li.SubItems.Add(binfo.OpStatus.ToString());
                     }
                     if (id == selectedid)
                     {
                         li.Selected = true;
                     }
                 }
                 catch (Exception x)
                 {
                     MessageBox.Show(x.ToString(), x.Message);
                 }
             }
         }
         catch (Exception)
         {
         }
         BatchManagerList.EndUpdate();
     }
 }
Esempio n. 36
0
        /// Insert a new row into the list view.
        private void InsertRow(
            int aMessageID,
            string aMessageName,
            int aSize,
            string aData,
            RowType aType
            )
        {
            string lIDStr = string.Empty;

            switch (aType)
            {
            case RowType.Data:
            {
                lIDStr = "D: " + aMessageID.ToString();
                break;
            }

            case RowType.Event:
            {
                lIDStr = "Ev: " + aMessageID.ToString();
                break;
            }

            case RowType.Error:
            {
                lIDStr = "Err: " + aMessageID.ToString();
                break;
            }

            case RowType.Command:
            {
                lIDStr = "Command";
                break;
            }

            case RowType.CommandResponse:
            {
                lIDStr = "Response";
                break;
            }
            }

            listViewMessages.BeginUpdate();

            ListViewItem item = listViewMessages.Items.Add(lIDStr);

            item.SubItems.Add(aMessageName);
            item.SubItems.Add(aSize.ToString());
            item.SubItems.Add(aData);

            listViewMessages.EndUpdate();

            item.EnsureVisible();
        }
Esempio n. 37
0
 public static void FillListView(ListView _listView, List<IBaseElement> _listEl)
 {
     _listView.Clear();
     _listView.BeginUpdate();
     foreach (IBaseElement row in _listEl)
     {
         var item = new ListViewItem(row.name);
         _listView.Items.Add(item);
     }
     _listView.EndUpdate();
 }
Esempio n. 38
0
 public static void ListViewFixColumns(ListView lst)
 {
     lst.BeginUpdate();
     for (int i = 0; i < lst.Columns.Count; i++)
     {
         lst.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
         int width = lst.Columns[i].Width;
         lst.Columns[i].AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
         lst.Columns[i].Width = System.Math.Max(width, lst.Columns[i].Width);
     }
     lst.EndUpdate();
 }
Esempio n. 39
0
        public void AddPackages(IEnumerable<IPackage> list, ListView listView)
        {
            ImageList imageList = new ImageList();
            imageList.ImageSize = new Size(32, 32);
            imageList.ColorDepth = ColorDepth.Depth32Bit;
            // Add a default image at position 0;
            imageList.Images.Add(DotSpatial.Plugins.ExtensionManager.Properties.Resources.box_closed_32x32);

            var tasks = new List<Task<Image>>();

            listView.BeginUpdate();
            listView.Items.Clear();
            foreach (var package in list)
            {
                ListViewItem item = new ListViewItem(package.Id);

                string description = null;
                if (package.Description.Length > 56)
                {
                    description = package.Description.Substring(0, 53) + "...";
                }
                else
                {
                    description = package.Description;
                }
                item.SubItems.Add(description);
                item.ImageIndex = 0;

                listView.Items.Add(item);
                item.Tag = package;

                var task = BeginGetImage(package.IconUrl.ToString());
                tasks.Add(task);
            }
            listView.EndUpdate();

            Task<Image>[] taskArray = tasks.ToArray();
            if (taskArray.Count() == 0) return;

            Task.Factory.ContinueWhenAll(taskArray, t =>
            {
                for (int i = 0; i < taskArray.Length; i++)
                {
                    if (taskArray[i].Result != null)
                    {
                        imageList.Images.Add(taskArray[i].Result);
                        listView.Items[i].ImageIndex = imageList.Images.Count - 1;
                    }
                }
            }, new System.Threading.CancellationToken(), TaskContinuationOptions.None, TaskScheduler.FromCurrentSynchronizationContext());

            listView.LargeImageList = imageList;
        }
Esempio n. 40
0
		public SelectionChangeTester (ListViewDescriptor descriptor)
		{
			this.descriptor = descriptor;

			lv = new ListView ();
			lv.View = descriptor.View;

			lv.BeginUpdate ();
			for (int i = 0; i < descriptor.ItemCount; i++)
				lv.Items.Add ("Item " + i);
			lv.EndUpdate ();
		}
Esempio n. 41
0
 /// <summary>
 /// Czyszczenie listView.
 /// </summary>
 /// <param name="listView">Element ListView do wyczyszczenie.</param>
 /// <returns>Zwracanie czystej ListView.</returns> 
 public static ListView ClearListView(ListView listView)
 {
     if (listView.InvokeRequired)
     {
         InvokeClearLV del = new InvokeClearLV(ClearListView);
         listView.Invoke(del, listView);
         return listView;
     }
     listView.BeginUpdate();
     listView.Items.Clear();
     listView.EndUpdate();
     return listView;
 }
Esempio n. 42
0
 public OrderView(string order_id, string path)
 {
     InitializeComponent();
     this.orderID = order_id;
     this.outPath = path;
     this.resultList = new ArrayList();
     this.bluetoothList = bluetoothListView;
     bluetoothList.BeginUpdate();
     bluetoothList.View = View.Details;
     loadListTitle();
     bluetoothList.EndUpdate();
     getOrderView();
 }
Esempio n. 43
0
      Display(ListView lvCur, Snoop.Collectors.Collector snoopCollector)
      {
         lvCur.BeginUpdate();
         lvCur.Items.Clear();

         Font oldFont = lvCur.Font;
         FontStyle newStyle = lvCur.Font.Style ^ FontStyle.Bold;
         Font boldFont = new Font(oldFont, newStyle);

         for (int i = 0; i < snoopCollector.Data().Count; i++)
         {
            Snoop.Data.Data tmpSnoopData = (Snoop.Data.Data)snoopCollector.Data()[i];

            // if it is a class separator, then color the background differently
            // and don't add a SubItem for the "Field" value
            if (tmpSnoopData.IsSeparator)
            {
               ListViewItem lvItem = new ListViewItem(tmpSnoopData.StrValue());

               if (tmpSnoopData is Snoop.Data.ClassSeparator)
                  lvItem.BackColor = System.Drawing.Color.LightBlue;
               else
                  lvItem.BackColor = System.Drawing.Color.Khaki;

               lvItem.Tag = tmpSnoopData;
               lvCur.Items.Add(lvItem);
            }
            else
            {
               ListViewItem lvItem = new ListViewItem(tmpSnoopData.Label);
               lvItem.SubItems.Add(tmpSnoopData.StrValue());

               if (tmpSnoopData.IsError)
               {
                  ListViewItem.ListViewSubItem sItem = (ListViewItem.ListViewSubItem)lvItem.SubItems[0];
                  sItem.ForeColor = System.Drawing.Color.Red;
               }

               if (tmpSnoopData.HasDrillDown)
               {
                  ListViewItem.ListViewSubItem sItem = (ListViewItem.ListViewSubItem)lvItem.SubItems[0];
                  sItem.Font = boldFont;
               }

               lvItem.Tag = tmpSnoopData;
               lvCur.Items.Add(lvItem);
            }
         }

         lvCur.EndUpdate();
      }
Esempio n. 44
0
 public OrderList(string path,Boolean isc)
 {
     InitializeComponent();
     this.isClient = isc;
     this.outPath = path;
     this.resultList = new ArrayList();
     this.bluetoothList = bluetoothListView;
     this.bluetoothList = bluetoothListView;
     bluetoothList.BeginUpdate();
     bluetoothList.View = View.Details;
     loadListTitle();
     bluetoothList.EndUpdate();
     getOrderList();
 }
Esempio n. 45
0
        /*ListView Initialize*/
        public FileListUtils(ListView _list)
        {
            this.fileNameList   = new ArrayList();

            this.fileList       = _list;

            fileList.BeginUpdate();

            fileList.View = View.Details;

            loadListTitle();

            fileList.EndUpdate();
        }
Esempio n. 46
0
        /*ListView Initialize*/
        public RangeListUtils(ListView _list)
        {
            this.fRangeList = new ArrayList();
            this.lRangeList = new ArrayList();
            this.nRangeList = new ArrayList();
            this.rangeList       = _list;

            rangeList.BeginUpdate();

            rangeList.View = View.Details;

            loadListTitle();

            rangeList.EndUpdate();
        }
Esempio n. 47
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();
        }
Esempio n. 48
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();
			}
		}
Esempio n. 49
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();
        }
Esempio n. 50
0
		public override void LoadPanelContents()
		{
			SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.TaskListOptions.xfrm"));
			
			string[] tokens = PropertyService.Get("SharpDevelop.TaskListTokens", ParserService.DefaultTaskListTokens);
			taskList = (ListView)ControlDictionary[taskListView];
			taskList.BeginUpdate();
			foreach (string token in tokens) {
				taskList.Items.Add(token);
			}
			taskList.EndUpdate();
			taskList.SelectedIndexChanged += new EventHandler(TaskListViewSelectedIndexChanged);
			
			ControlDictionary[changeButton].Click += new EventHandler(ChangeButtonClick);
			ControlDictionary[removeButton].Click += new EventHandler(RemoveButtonClick);
			ControlDictionary[addButton].Click    += new EventHandler(AddButtonClick);
			
			TaskListViewSelectedIndexChanged(this, EventArgs.Empty);
		}
Esempio n. 51
0
        /// <summary>
        /// Helper function that fills in the list of revisions.
        /// This is used from the code above and from the FormRevisionHistory.
        /// </summary>
        public static void UpdateList(ListView listRev, string input, bool prefixRevId)
        {
            App.StatusBusy(true);
            string[] response = input.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            listRev.BeginUpdate();
            listRev.Items.Clear();
            int id = response.Length;

            foreach (string s in response)
            {
                string[] cat = s.Split('\t');
                if (s.Length < 2) continue; // Handle empty results (single empty string) correctly

                // Convert the date/time from UNIX second based to C# date structure
                DateTime date = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Convert.ToDouble(cat[1])).ToLocalTime();
                cat[1] = String.Format("{0:yyyy/MM/dd  HH:mm:ss}", date);

                // Trim any spaces in the subject line
                cat[3] = cat[3].Trim();
                // Limit the subject line length to the length specified for that
                int c1 = Convert.ToInt32(Properties.Settings.Default.commitW1);
                if (cat[3].Length > c1)
                    cat[3] = cat[3].Substring(0, c1) + "...";

                ListViewItem li = new ListViewItem(cat);
                if (prefixRevId) // Prefix is used with file revision history dialog: a simple count-down index
                    li.SubItems.Insert(0, new ListViewItem.ListViewSubItem() { Text = string.Format("{0,4}", id) });
                id--;
                li.Name = cat[0];           // Used to search for a key
                li.Tag = cat[0];            // Tag contains the SHA1 of the commit
                listRev.Items.Add(li);
            }

            // Make columns auto-adjust to fit the width of the largest item
            foreach (ColumnHeader l in listRev.Columns) l.Width = -2;

            listRev.EndUpdate();
            App.StatusBusy(false);
        }
Esempio n. 52
0
		/// <summary>
		/// Adds Players contained in the supplied DataView to the ListView
		/// </summary>
		/// <param name="lvPlayers"></param>
		/// <param name="dvPlayers"></param>
		/// <param name="filter"></param>
		/// <param name="sort"></param>
		public static void PopulatePlayersView(ListView lvPlayers, DataView dvPlayers, string filter, string sort)
		{
			lvPlayers.BeginUpdate();
			lvPlayers.Items.Clear();
			
			if (globalfilter != null && filter.Length > 0)
			{
				filter = globalfilter + " AND " + filter;
			}
			else if (globalfilter != null)
			{
				filter = globalfilter;
			}

			FormatFilter(ref filter);
			dvPlayers.RowFilter = filter;

			dvPlayers.Sort = sort;
			dvPlayers.RowStateFilter = DataViewRowState.CurrentRows;

			//use a hash table to make sure there are only unique entries
			Hashtable hash = new Hashtable();
			int index = 1;
			foreach (DataRowView dvr in dvPlayers)
			{
				if (!hash.ContainsKey(dvr["Player"]))
				{
					ListViewItem item = 
						new ListViewItem(new string[] {index.ToString(), 
														  dvr["Player"].ToString(), 
														  dvr["Games"].ToString()});

					lvPlayers.Items.Add(item);
					hash.Add(dvr["Player"], null);
					index++;
				}
			}

			lvPlayers.EndUpdate();
		}
Esempio n. 53
0
        public static void BindResultSet(ResultSet resultSet, ListView listView) {
            listView.BeginUpdate();
            try {
                listView.Clear();

                listView.Columns.Add("No");

                foreach(var name in resultSet.FieldNames)
                    listView.Columns.Add(name);

                var i = 0;
                foreach(var row in resultSet) {
                    var item = new ListViewItem(i.ToString());
                    foreach(var name in resultSet.FieldNames)
                        item.SubItems.Add(row[name].AsText());

                    listView.Items.Add(item);
                    i++;
                }
            }
            finally {
                listView.EndUpdate();
            }
        }
Esempio n. 54
0
        private void FilterListView(ListView list, List<DirectoryEntry> source, string filter)
        {
            list.BeginUpdate();

            list.Items.Clear();

            List<DirectoryEntry> filteredList = source;

            if (!string.IsNullOrEmpty(filter))
            {
                filteredList = source.Where(x => x.Name.Contains(filter) || x.Number.Contains(filter)).ToList();
            }

            foreach (var item in filteredList)
            {
                list.Items.Add(new ListViewItem(new string[] { item.Name, item.Number }));
            }

            list.EndUpdate();
        }
        private static void RemoveLayout(ListViewItem lstItem, ListView listView, List<string> names)
        {
            try
            {
                listView.BeginUpdate();

                names.Remove(lstItem.Text);
                listView.Items.Remove(lstItem);
            }
            finally
            {
                listView.EndUpdate();
            }
        }
        private static void AddLayout(string name, ListView listView, List<string> names)
        {
            try
            {
                listView.BeginUpdate();

                names.Add(name);

                var lstItem = new ListViewItem(name) {Tag = new LayoutTag(name)};
                listView.Items.Add(lstItem);
            }
            finally
            {
                listView.EndUpdate();
            }
        }
        void ShiftItem (ListView listView, int shift)
        {
            if (listView.SelectedIndices.Count == 0)
                return;

            int selectedIndex = listView.SelectedIndices[0];
            int newIndex = selectedIndex + shift;
            if (newIndex < 0 || newIndex >= listView.Items.Count)
                return;

            listView.BeginUpdate ();

            var item = listView.Items[selectedIndex];
            listView.Items.RemoveAt (selectedIndex);
            listView.Items.Insert (newIndex, item);
            item.Selected = true;

            listView.EndUpdate ();
        }
        private void PopulateListView(NodeIdWrapper parentNodeId, ListView listView)
        {
            listView.BeginUpdate();
              try
              {
            int itemCount = wbOverview.count_children(parentNodeId);
            ListViewItem[] items = new ListViewItem[itemCount];

            int detail_fields_count = wbOverview.get_details_field_count(parentNodeId);

            for (int i = 0; i < itemCount; i++)
            {
              NodeIdWrapper itemNodeId = wbOverview.get_child(parentNodeId, i);
              string caption;

              wbOverview.get_field(itemNodeId, (int)Overview.Columns.Label, out caption);
              ListViewItem item = new ListViewItem(caption, FindImageIndex(itemNodeId, listView.View));
              item.Tag = CreateIdentifier(itemNodeId);
              item.ToolTipText = caption;

              // Add details for that item, if available.
              for (int counter = 0; counter < detail_fields_count; counter++)
              {
            String detailText;
            wbOverview.get_field(itemNodeId, (int)Overview.Columns.FirstDetailField + counter, out detailText);
            item.SubItems.Add(detailText.Replace(Environment.NewLine, " / "));
              }

              items[i] = item;
            }
            listView.Items.Clear();
            listView.Items.AddRange(items);

            // Setting the sorter also starts sorting.
            listView.ListViewItemSorter = new InsensitiveListviewComparer(0, SortOrder.Ascending);
            Win32.SetSortIcon(listView, 0, SortOrder.Ascending);

            // select stuff
            List<int> selected = wbOverview.get_selected_children(parentNodeId);
            foreach (int i in selected)
              listView.SelectedIndices.Add(i);
              }
              finally
              {
            listView.EndUpdate();
            listView.PerformLayout();
              };
        }
Esempio n. 59
-1
        public static void Popola(ref ListView aListView, IList aListOfData)
        {
            aListView.SuspendLayout();
            aListView.BeginUpdate();
            aListView.Items.Clear();

            if (ListUtils.isNotEmpty(aListOfData))
            {
                foreach (object item in aListOfData)
                {
                    if (item is IListViewItemable)
                    {
                        aListView.Items.Add(((IListViewItemable)item).toListViewItem());
                    }
                    else if (item is DateTime)
                    {
                        ListViewItem dateItem = new ListViewItem(item.ToString());
                        dateItem.Tag = item;

                        aListView.Items.Add(dateItem);
                    }
                    else
                    {
                        aListView.Items.Add(((IListViewItemable)item).ToString());
                    }
                }
            }

            aListView.EndUpdate();
            aListView.ResumeLayout();
        }
 void PopulateListView(ListView lv, List<KeyValuePair<string, Type>> map, Predicate<KeyValuePair<string, Type>> match)
 {
     lv.Visible = false;
     lv.BeginUpdate();
     lv.Items.Clear();
     string fmt = "{0:D" + (map.Count.ToString().Length) + "}";
     int order = 0;
     foreach (var kvp in map)
     {
         order++;
         if (!match(kvp)) continue;
         string tag = getTag(kvp.Key);
         string wrapper = kvp.Value.Name;
         string file = System.IO.Path.GetFileName(kvp.Value.Assembly.Location);
         string title = GetAttrValue(kvp.Value.Assembly, typeof(System.Reflection.AssemblyTitleAttribute), "Title");
         string description = GetAttrValue(kvp.Value.Assembly, typeof(System.Reflection.AssemblyDescriptionAttribute), "Description");
         string company = GetAttrValue(kvp.Value.Assembly, typeof(System.Reflection.AssemblyCompanyAttribute), "Company");
         string product = GetAttrValue(kvp.Value.Assembly, typeof(System.Reflection.AssemblyProductAttribute), "Product");
         ListViewItem lvi = new ListViewItem(new string[] { String.Format(fmt, order), tag, kvp.Key, wrapper, file, title, description, company, product, });
         lvi.Tag = kvp;
         lv.Items.Add(lvi);
     }
     if (lv.Items.Count > 0)
         lv.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
     lv.EndUpdate();
     lv.Visible = true;
 }