Beispiel #1
0
        private void PopulateVersionInfo( string libraryUrl, string documentName, Proxy.NavigatorRef.ItemKind kind )
        {
            this.Items.Clear( );
            FileIconManager iconManager = new FileIconManager( this.SmallImageList, this.LargeImageList );

            int versionCount = Proxy.ArtifactProxy.GetVersionCount( libraryUrl, documentName );
            int i = 0;
            for( i = 0; i < versionCount; ++i )
            {
                string versionLabel = Proxy.ArtifactProxy.GetVersionLabel( libraryUrl, documentName, i );

                VersionInfo info = new VersionInfo( i, versionLabel );

                ListViewItem item = new ListViewItem( documentName );
                ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem( item, versionLabel );

                item.Tag = info;
                SetIcon( iconManager, item, documentName, kind );
                item.SubItems.Add( subItem );
                this.versionInfo = info;
                this.Items.Add( item );
            }

            this.Items[ i - 1 ].Selected = true;
        }
Beispiel #2
0
        public void table(ListView listView1, string otprv, string nazn, string date)
        {
            s_el = parse_el.list("http://rasp.yandex.ru/search/suburban/?fromName=" + otprv + "&fromId=&toName=" + nazn + "&&toId=&when=" + date);
            int number = 1;

            while (1 > 0)
            {
                lv1 = new ListViewItem();
                lv2 = new ListViewItem.ListViewSubItem();
                lv3 = new ListViewItem.ListViewSubItem();
                lv4 = new ListViewItem.ListViewSubItem();
                lv5 = new ListViewItem.ListViewSubItem();
                lv6 = new ListViewItem.ListViewSubItem();

                lv1.Text = Convert.ToString(number);

                //рейсы
                begin_reis[number] = s_el.IndexOf(begin_1, end_reis[number - 1]);
                if (begin_reis[number] < 0) { break; }
                sered_reis[number] = s_el.IndexOf(sered_1, begin_reis[number]);
                end_reis[number] = s_el.IndexOf(end_1, sered_reis[number]);
                lv2.Text = s_el.Substring(begin_reis[number] + begin_1.Length, sered_reis[number] - begin_reis[number] - begin_1.Length) + " - " + s_el.Substring(sered_reis[number] + sered_1.Length, end_reis[number] - sered_reis[number] - sered_1.Length);

                //отправление

                otshet_otpr[number] = s_el.IndexOf(otshet_2, end_otpr[number - 1]);
                begin_otpr[number] = s_el.IndexOf(begin_2, otshet_otpr[number]);
                end_otpr[number] = s_el.IndexOf(end_2, begin_otpr[number]);
                lv3.Text = s_el.Substring(begin_otpr[number] + begin_2.Length, end_otpr[number] - begin_otpr[number] - begin_2.Length);

                time_srvn tsrv = new time_srvn();
                bool time = tsrv.srvn(lv3.Text);
                if (time == true)
                {
                    lv1.BackColor = Color.Gray;
                }

                //прибытие

                otshet_pr[number] = s_el.IndexOf(otshet_3, end_pr[number - 1]);
                begin_pr[number] = s_el.IndexOf(begin_3, otshet_pr[number]);
                end_pr[number] = s_el.IndexOf(end_3, begin_pr[number]);
                lv4.Text = s_el.Substring(begin_pr[number] + begin_3.Length, end_pr[number] - begin_pr[number] - begin_3.Length);

                //остановки

                begin_ost[number] = s_el.IndexOf(begin_4, end_ost[number - 1]);
                end_ost[number] = s_el.IndexOf(end_4, begin_ost[number]);
                lv5.Text = s_el.Substring(begin_ost[number] + begin_4.Length, end_ost[number] - begin_ost[number] - begin_4.Length);

                lv1.SubItems.Add(lv2);
                lv1.SubItems.Add(lv3);
                lv1.SubItems.Add(lv4);
                lv1.SubItems.Add(lv5);
                string rezult = lv2.Text + lv2.Text + lv2.Text + lv2.Text;

                listView1.Items.Add(lv1);
                number += 1;
            }
        }
Beispiel #3
0
        private void AddFilterProperty(string name, object value, Exception exception)
        {
            //If this property has a value, show that, otherwise show the exception
            ListViewItem item = new ListViewItem();

            item.Text = name;

            ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem();
            if (exception != null)
            {
                subItem.Text = String.Format("ERROR: {0}", exception.Message);
            }
            else if (value != null)
            {
                subItem.Text = value.ToString();
            }
            else
            {
                subItem.Text = "[No value]";
            }

            item.SubItems.Add(subItem);

            filterDetailsListView.Items.Add(item);
        }
        private void InitForm()
        {
            using (new SimpleUtils.SimpleWaitCursor())
            {
                List<GacInterop.AssemblyListEntry> list = GacInterop.GetAssemblyList();

                ListViewItem lvi;
                ListViewItem.ListViewSubItem lvsi;

                foreach (GacInterop.AssemblyListEntry le in list)
                {
                    lvi = new ListViewItem();
                    lvi.Text = le.Name;
                    lvi.Tag = le.FullName;
                    lvi.ToolTipText = le.FullName;
                    lvi.Group = listView1.Groups[ListViewGroupFiltered];

                    lvsi = new ListViewItem.ListViewSubItem();
                    lvsi.Text = le.Version;
                    lvi.SubItems.Add(lvsi);

                    lvsi = new ListViewItem.ListViewSubItem();
                    lvsi.Text = le.PublicKeyToken;
                    lvi.SubItems.Add(lvsi);

                    listView1.Items.Add(lvi);
                }
            }            
        }
Beispiel #5
0
 private void AddItems(OperationInfo[] ops, int i = -1)
 {
     lvItems.BeginUpdate();
     foreach(OperationInfo op in ops)
     {
         ListViewItem item = new ListViewItem(op.from);
         item.Tag = op;
         if (op.operation == Operation.Download)
             item.ImageIndex = 1;
         else
             item.ImageIndex = 0;
         ListViewItem.ListViewSubItem subitem = new ListViewItem.ListViewSubItem(item, op.to);
         item.SubItems.Add(subitem);
         subitem = new ListViewItem.ListViewSubItem(item, GetSizeText(op));
         item.SubItems.Add(subitem);
         ProgressListview.ProgressSubItem progress = new ProgressListview.ProgressSubItem(item, GetStatusText(op));
         progress.Owner = item;
         progress.ProgressMaxValue = op.totalSize;
         progress.ProgressValue = op.doneSize;
         progress.ShowProgress = false;
         progress.ForeColor = GetStatusColor(op);
         progress.Tag = op;
         op.Tag = progress;
         item.SubItems.Add(progress);
         if (i >= 0)
             lvItems.Items.Insert(i, item);
         else
             lvItems.Items.Add(item);
         Statistics(op, 1);
     }
     lvItems.EndUpdate();
 }
Beispiel #6
0
        //Adiciona as Categorias e orçamentos
        public void adicionaCat()
        {
            listViewCategorias.Items.Clear();
            float gasto = 0;
            DataRow[] registroCat = dados.Tables["Categoria"].Select("CodigoCat > 0");
            DataRow[] registro = dados.Tables["Registros"].Select("Codigo > 0");

            foreach (DataRow categoria in dados.Tables["Categoria"].Rows)
            {
                ListViewItem item = new ListViewItem(categoria["DescricaoCat"].ToString());
                item.UseItemStyleForSubItems = false;
                ListViewItem.ListViewSubItem subItemOrcamento = new ListViewItem.ListViewSubItem(item, categoria["Orcamento"].ToString());

                for (int i = 0; i < registro.Length; i++)
                    if (float.Parse(registro[i]["Valor"].ToString()) < 0)
                        if (registro[i]["Categoria"].ToString() == categoria["CodigoCat"].ToString())
                            gasto += float.Parse(registro[i]["Valor"].ToString());
                gasto *= -1;
               ListViewItem.ListViewSubItem subItemConta = new ListViewItem.ListViewSubItem(item, gasto.ToString());
               if (gasto > float.Parse(categoria["Orcamento"].ToString()))
                   subItemConta.ForeColor = Color.Red;
               else
                   subItemConta.ForeColor = Color.Blue;
               item.SubItems.Add(subItemOrcamento);
               item.SubItems.Add(subItemConta);
               listViewCategorias.Items.Add(item);
               gasto = 0;
            }
        }
Beispiel #7
0
        public void UpdateChangesDialog(List<KeyValuePair<GUIMod, GUIModChangeType>> changeset, BackgroundWorker installWorker)
        {
            m_Changeset = changeset;
            m_InstallWorker = installWorker;
            ChangesListView.Items.Clear();

            if (changeset == null)
            {
                return;
            }

            foreach (var change in changeset)
            {
                if (change.Value == GUIModChangeType.None)
                {
                    continue;
                }

                var item = new ListViewItem {Text = String.Format("{0} {1}", change.Key.Name, change.Key.Version)};

                var sub_change_type = new ListViewItem.ListViewSubItem {Text = change.Value.ToString()};

                item.SubItems.Add(sub_change_type);
                ChangesListView.Items.Add(item);
            }
        }
Beispiel #8
0
        /// <summary>
        /// Добавить элемент на форму для редактирования
        /// </summary>
        /// <param name="item">Добавляемый элемент</param>
        private void InsertElement(PanelItem item)
        {
            try
            {
                int number = listView1.Items.Count + 1;

                ListViewItem l_item = new ListViewItem(number.ToString());

                ListViewItem.ListViewSubItem n_item = new ListViewItem.ListViewSubItem(l_item, item.Description);
                ListViewItem.ListViewSubItem f_item = new ListViewItem.ListViewSubItem(l_item, string.Format("{0};{1} pt", item.Font.Name, item.Font.SizeInPoints));

                l_item.SubItems.Add(n_item);
                l_item.SubItems.Add(f_item);

                ItemOpt i_opt = new ItemOpt();

                i_opt.item = item;

                i_opt.i_color = item.Color;
                i_opt.i_font = new System.Drawing.Font(item.Font, item.Font.Style);

                l_item.Tag = i_opt;
                listView1.Items.Add(l_item);
            }
            catch { }
        }
Beispiel #9
0
        /// <summary>
        /// Настроить таблицу
        /// </summary>
        protected void InitializeTable()
        {
            for (int i = 0; i < 56; i++)
            {
                if (i > -1 && i < _app.Technology.Parameters.Length)
                {
                    TParameter parameter = _app.Technology.Parameters[i];
                    if (parameter != null)
                    {
                        ListViewItem item = new ListViewItem(parameter.Name);
                        //Parameter par = _app.GetParameter(parameter.PNumber);
                        Parameter par = _app.GetParameter(parameter.Identifier);

                        if (par != null)
                        {
                            ListViewItem.ListViewSubItem sub = new ListViewItem.ListViewSubItem(item, par.Name);
                            item.SubItems.Add(sub);
                        }
                        else
                        {
                            ListViewItem.ListViewSubItem sub = new ListViewItem.ListViewSubItem(item, "не определен");
                            item.SubItems.Add(sub);
                        }

                        item.Tag = parameter;
                        listView1.Items.Add(item);
                    }
                }
            }
        }
Beispiel #10
0
 private void button2_Click(object sender, EventArgs e)
 {
     ListViewItem entry;
     ListViewItem.ListViewSubItem sentry;
     sock.Send(Encoding.ASCII.GetBytes("::dirlist\n\n"), SocketFlags.None);
     string buffer=null;
     string delimiter="\n";
     try
     {
         do
         {
             buffer = Framer.nextFrame(sock, delimiter);
             entry = new ListViewItem();
             entry.Text = buffer;
             sentry = new ListViewItem.ListViewSubItem();
             buffer = Framer.nextFrame(sock, delimiter);
             sentry.Text = buffer;
             entry.SubItems.Add(sentry);
             sentry = new ListViewItem.ListViewSubItem();
             buffer = Framer.nextFrame(sock, delimiter);
             sentry.Text = buffer;
             entry.SubItems.Add(sentry);
             listView1.Items.Add(entry);
             listView1.Refresh();
         }
         while (buffer.EndsWith("\n")==false);
     }
     catch (SocketException excep)
     {
         MessageBox.Show(excep.Message);
     }
 }
Beispiel #11
0
        /// <summary>
        /// Добавить цифровой параметр в список
        /// </summary>
        /// <param name="parameter">Добавляемый параметр</param>
        protected void InsertNumericParameter(VPanelParameter parameter)
        {
            try
            {
                ListViewItem item = new ListViewItem((listView1.Items.Count + 1).ToString());

                //Parameter par = _app.GetParameter(parameter.PNumber);
                Parameter par = _app.GetParameter(parameter.Identifier);

                if (par != null)
                {
                    ListViewItem.ListViewSubItem name = new ListViewItem.ListViewSubItem(item, par.Name);

                    item.Tag = parameter;
                    item.SubItems.Add(name);

                    listView1.Items.Add(item);
                }
                else
                {
                    /*MessageBox.Show(this, "Данный параметр не может быть добавлен на панель", "Сообщение",
                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    return;*/
                }

            }
            catch { }
        }
Beispiel #12
0
        void TreeV_NodeMouseClick(object sender,
            TreeNodeMouseClickEventArgs e)
        {
            TreeNode newSelected = e.Node;
            listV.Items.Clear();
            DirectoryInfo nodeDirInfo = (DirectoryInfo)newSelected.Tag;
            ListViewItem.ListViewSubItem[] subItems;
            ListViewItem item = null;

            foreach (DirectoryInfo dir in nodeDirInfo.GetDirectories())
            {
                item = new ListViewItem(dir.Name, 0);
                subItems = new ListViewItem.ListViewSubItem[]
                    {new ListViewItem.ListViewSubItem(item, "Directory"),
                     new ListViewItem.ListViewSubItem(item,
                        dir.LastAccessTime.ToShortDateString())};
                item.SubItems.AddRange(subItems);
                listV.Items.Add(item);
            }
            foreach (FileInfo file in nodeDirInfo.GetFiles())
            {
                item = new ListViewItem(file.Name, 1);
                subItems = new ListViewItem.ListViewSubItem[]
                    { new ListViewItem.ListViewSubItem(item, "File"),
                     new ListViewItem.ListViewSubItem(item,
                        file.LastAccessTime.ToShortDateString())};

                item.SubItems.AddRange(subItems);
                listV.Items.Add(item);
            }

            listV.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
        }
Beispiel #13
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();

            }
        }
Beispiel #14
0
 private void PrintHostInfo(string host)
 {
     try
     {
         IPHostEntry hostInfo;
         listView1.Items.Clear();
         hostInfo = Dns.GetHostEntry(host);
         ListViewItem item;
         ListViewItem.ListViewSubItem sitem;
         int AList = hostInfo.AddressList.Length;
         int AlList = hostInfo.Aliases.Length;
         listView1.BeginUpdate();
         for(int i = 0;i<(AList>AlList?AList:AlList);i++)
         {
             item = new ListViewItem();
             if (i < AList)
                 item.Text = hostInfo.AddressList.ElementAt(i).ToString();
             if (i < AlList)
             {
                 sitem = new ListViewItem.ListViewSubItem();
                 sitem.Text = hostInfo.Aliases.ElementAt(i);
                 item.SubItems.Add(sitem);
             }
             listView1.Items.Add(item);
         }
         textBox2.Text = "Resolved Successfully!";
         listView1.EndUpdate();
     }
     catch (Exception)
     {
         textBox2.Text = "Unable to Resolve Host!";
     }
 }
Beispiel #15
0
 private void InitializeSpecialItems()
 {
     NewProfileItem = new ListViewItem(Resources.Label_UI_ProfileListView_NewProfile, NewProfileIconName);
     ListViewItem.ListViewSubItem NewProfileItemSub1 = new ListViewItem.ListViewSubItem(NewProfileItem, Resources.Label_UI_ProfileListView_NewProfile_Description);
     NewProfileItemSub1.ForeColor = SystemColors.ControlDark;
     NewProfileItem.SubItems.Add(NewProfileItemSub1);
 }
Beispiel #16
0
        private void AddBackupToListView(string fileName)
        {
            string displayDate = Path.GetFileName(fileName).Substring(0, 19).Replace('_', ' ');
            displayDate = displayDate.Remove(13, 1).Insert(13, ":");
            displayDate = displayDate.Remove(16, 1).Insert(16, ":");

            string displayName = Path.GetFileName(fileName).Remove(0, 20);

            if (displayName == "srt")
                displayName = "Untitled.srt";

            var item = new ListViewItem(displayDate);
            item.UseItemStyleForSubItems = false;
            item.Tag = fileName;

            var subItem = new ListViewItem.ListViewSubItem(item, Path.GetFileNameWithoutExtension(displayName));
            item.SubItems.Add(subItem);

            subItem = new ListViewItem.ListViewSubItem(item, Path.GetExtension(fileName));
            item.SubItems.Add(subItem);

            try
            {
                FileInfo fi = new FileInfo(fileName);
                subItem = new ListViewItem.ListViewSubItem(item, fi.Length + " bytes");
                item.SubItems.Add(subItem);
            }
            catch
            {
            }

            listViewBackups.Items.Add(item);
        }
Beispiel #17
0
        private void addRow2List(object[] row1, object[] row2, List<ListViewItem> tItems, int flag, List<int> sI, List<int> cI)
        {
            ListViewItem lvi = new ListViewItem();
            lvi.UseItemStyleForSubItems = false;
            int j = 0;
            for (int i = 0; i < row1.Length || i < row2.Length; i++)
            {
                if (!sI.Contains(i))
                {
                    if (cI == null || cI.Count == 0)
                        lvi.BackColor = Color.LightGreen;
                    else
                        lvi.BackColor = Color.LightPink;

                    ListViewItem.ListViewSubItem lvsi1 = new ListViewItem.ListViewSubItem();
                    ListViewItem.ListViewSubItem lvsi2 = new ListViewItem.ListViewSubItem();

                    if (flag == 1)                                                       //1 or 2 row null
                    {
                        if (row1 != null && row2 == null)
                            lvsi1.Text = row1[i].ToString();
                        if (row1 == null && row2 != null)
                            lvsi2.Text = row2[i].ToString();
                        lvsi1.BackColor = Color.LightPink;
                        lvsi2.BackColor = Color.LightPink;
                    }
                    else
                    {
                        lvsi1.Text = row1[i].ToString();
                        lvsi2.Text = row2[i].ToString();
                        if (cI == null || !cI.Contains(i))
                            if (flag == 2)
                            {
                                lvsi1.BackColor = Color.Yellow;
                                lvsi2.BackColor = Color.Yellow;
                            }
                            else
                            {
                                lvsi2.BackColor = Color.LightGreen;
                                lvsi1.BackColor = Color.LightGreen;
                            }
                        else
                        {
                            lvsi1.BackColor = Color.LightGreen;
                            lvsi2.BackColor = Color.LightGreen;
                        }
                    }
                    if (j == 0)
                    {
                        lvi.SubItems[0] = lvsi1;
                    }
                    else
                        lvi.SubItems.Insert(j, lvsi1);
                    lvi.SubItems.Add(lvsi2);

                    j++;
                }
            }
            tItems.Add(lvi);
        }
        ListViewItem CreateListItem()
        {
            var lvi = new ListViewItem { UseItemStyleForSubItems = false };

            if (_columns.Columns.Length > 0)
            {
                var first = _columns.Columns[0];
                lvi.Text = first.GetText(WorkItem);
                lvi.ForeColor = first.GetForeColor(WorkItem, lvi.ForeColor);
                lvi.BackColor = first.GetBackColor(WorkItem, lvi.BackColor);
                lvi.Font = first.GetFont(WorkItem, lvi.Font);
                //lvi.ImageKey
                //lvi.IndentCount
                //lvi.StateImageIndex
                //lvi.Tag =
                //lvi.ToolTipText

                for (int i = 1; i < _columns.Columns.Length; i++)
                {
                    var column = _columns.Columns[i];
                    var lvis = new ListViewItem.ListViewSubItem(lvi, column.GetText(WorkItem));
                    lvis.ForeColor = column.GetForeColor(WorkItem, lvis.ForeColor);
                    lvis.BackColor = column.GetBackColor(WorkItem, lvis.BackColor);
                    lvis.Font = column.GetFont(WorkItem, lvis.Font);

                    lvi.SubItems.Add(lvis);
                }
            }

            return lvi;
        }
        private void WriteList() {
            //Clear existing items
            lstFiles.Items.Clear();

            foreach (FileInfo file in _files) {
                //Create list view item
                ListViewItem item = new ListViewItem(file.Name);
                item.Checked = true;

                //Create list view sub item
                ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem(item, file.DirectoryName);
                item.SubItems.Add(subItem);

                //Add item to list;
                lstFiles.Items.Add(item);
            }

            //Refresh column sizes
            lstFiles.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            lstFiles.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);

            //Sort items by file name column
            lstSorter.SortColumn = 0;
            lstSorter.Order = SortOrder.Ascending;
            lstFiles.Sort();
        }
        public SolutionSettings(Solution sol)
        {
            InitializeComponent();

            this.sol = sol;
            textBox_solutionname.Text = sol.details.name;
            textBox_solutionrootfolder.Text = sol.details.basefolder;
            textBox_ramstart.Text = sol.details.ramstart.ToString();

            foreach(file f in sol.details.files)
            {

                ListViewItem p = new ListViewItem(f.name);

                ListViewItem.ListViewSubItem si = new ListViewItem.ListViewSubItem(p, f.assemblefile.ToString());
                p.SubItems.Add(si);

                if (f.assemblefile == true)
                {
                    si = new ListViewItem.ListViewSubItem(p, f.order.ToString());
                    p.SubItems.Add(si);
                }
                else
                {
                    si = new ListViewItem.ListViewSubItem(p, "");
                    p.SubItems.Add(si);
                }

                listView_filelist.Items.Add(p);

                lvwColumnSorter = new ListViewColumnSorter();
                listView_filelist.ListViewItemSorter = lvwColumnSorter;

            }
        }
Beispiel #21
0
 void AddFile(File f)
 {
     listView1.Invoke((MethodInvoker)delegate
     {
         ListViewItem li = new ListViewItem(f.Name);
         li.Tag = f;
         ListViewItem.ListViewSubItem l1 = new ListViewItem.ListViewSubItem(li, f.EntryType);
         ListViewItem.ListViewSubItem l2 = new ListViewItem.ListViewSubItem(li, f.SizeFriendly);
         ListViewItem.ListViewSubItem l3 = new ListViewItem.ListViewSubItem(li, f.ModifiedDate.ToString());
         li.SubItems.Add(l1);
         li.SubItems.Add(l2);
         li.SubItems.Add(l3);
         if (stfsInfo.Checked && f.IsSTFSPackage())
         {
             ListViewItem.ListViewSubItem lsi = new ListViewItem.ListViewSubItem(li, f.ContentName());
             li.SubItems.Add(lsi);
         }
         else
         {
             ListViewItem.ListViewSubItem lsi = new ListViewItem.ListViewSubItem(li, "");
             li.SubItems.Add(lsi);
         }
         ListViewItem.ListViewSubItem l4 = new ListViewItem.ListViewSubItem(li, f.FullPath);
         li.SubItems.Add(l4);
         listView1.Invoke((MethodInvoker)delegate { listView1.Items.Add(li); });
     });
 }
        private void InitData()
        {
            var list = Model.Create();
            this.listView1.SuspendLayout();
            int i = 1;
            foreach (var item in list)
            {
                var viewItem = new ListViewItem();
                viewItem.Tag = item;
                viewItem.Text = item.Num;
                var subItem = new ListViewItem.ListViewSubItem();
                subItem.Text = item.Number;
                viewItem.SubItems.Add(subItem);
                subItem = new ListViewItem.ListViewSubItem();
                subItem.Text = item.Price;
                viewItem.SubItems.Add(subItem);
                subItem = new ListViewItem.ListViewSubItem();
                subItem.Text = item.Date;
                viewItem.SubItems.Add(subItem);

                if (i == 1)
                {
                    viewItem.ForeColor = Color.Red;
                }
                if (i % 2 == 0)
                {
                    viewItem.ForeColor = Color.Green;
                }
                i++;
                this.listView1.Items.Add(viewItem);
            }
            this.listView1.ResumeLayout();
        }
        private void ScriptVersionPopup_Load(object sender, EventArgs e)
        {
            if (!DesignMode) {
                sourceNameLabel.Text = source.Provider.Name;

                // populate the list
                foreach (DBScriptInfo currScript in source.Scripts) {
                    ListViewItem currItem = new ListViewItem(currScript.Provider.Version);
                    ListViewItem.ListViewSubItem publishedItem;
                    if (currScript.Provider.Published != null)
                        publishedItem = new ListViewItem.ListViewSubItem(currItem, currScript.Provider.Published.Value.ToShortDateString());
                    else
                        publishedItem = new ListViewItem.ListViewSubItem(currItem, "");

                    currItem.SubItems.Add(publishedItem);

                    currItem.Tag = currScript;
                    this.listView.Items.Add(currItem);

                    // select the currently active version
                    if (currItem.Tag == source.SelectedScript)
                        currItem.Selected = true;
                }
            }

            center();
        }
Beispiel #24
0
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (kiemtraThongBao_GUI() == true)
     {
         ThongBao thongbao = layThongBao_Tu_GUI();
         thongbao_BUS.taoThongBao_BUS(thongbao);
         tbxTenThongBao.Text = "";
         tbxNoiDungThongBao.Text = "";
         lvThongBao.Items.Clear();
         ThongBao[] dsThongBao = thongbao_BUS.layTatCaThongBao_BUS();
         for (int i = 0; i < dsThongBao.Length; i++)
         {
             ListViewItem ma = new ListViewItem(dsThongBao[i].MaThongBao.ToString());
             ListViewItem.ListViewSubItem ten = new ListViewItem.ListViewSubItem(ma, dsThongBao[i].TenThongBao);
             ListViewItem.ListViewSubItem noidung = new ListViewItem.ListViewSubItem(ma, dsThongBao[i].NoiDungThongBao);
             ListViewItem.ListViewSubItem ngay = new ListViewItem.ListViewSubItem(ma, dsThongBao[i].NgayThongBao.ToShortDateString());
             ma.SubItems.Add(ten);
             ma.SubItems.Add(noidung);
             ma.SubItems.Add(ngay);
             lvThongBao.Items.Add(ma);
         }
     }
     else
     {
         MessageBox.Show("Nhập thiếu thông tin! Vui lòng nhập lại ");
     }
 }
Beispiel #25
0
        private void buttonAdicionar_Click(object sender, EventArgs e)
        {
            // Validação dos campos Nome, Local e Gênero. Criação do novo item e suitem formando quatro colunas "Nome do filme, Gênero do Filme, Local que foi Assistido e Data", no final são adicionados os subitens ao item e o item ao ListView

            if (textBoxNome.Text == "" || textBoxLocal.Text == "" || comboBoxGen.SelectedIndex == 0)
                MessageBox.Show("Favor preencher todos os campos", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);

            else
            {
                novoItem = new ListViewItem();
                novoItem.Text = textBoxNome.Text;

                ListViewItem.ListViewSubItem SubitemGenero = new ListViewItem.ListViewSubItem();
                SubitemGenero.Text = comboBoxGen.SelectedItem.ToString();

                ListViewItem.ListViewSubItem SubitemLocal = new ListViewItem.ListViewSubItem();
                SubitemLocal.Text = textBoxLocal.Text;

                ListViewItem.ListViewSubItem SubitemData = new ListViewItem.ListViewSubItem();
                SubitemData.Text = dateTimePickerData.Value.Date.ToString("dd/MM/yyyy");

                novoItem.SubItems.Add(SubitemGenero);
                novoItem.SubItems.Add(SubitemLocal);
                novoItem.SubItems.Add(SubitemData);

                listViewFilmes.Items.Add(novoItem);
                ResetForm();
                buttonPesquisar.Visible = true;
            }
        }
		public ListViewHitTestInfo(ListViewItem hitItem, ListViewItem.ListViewSubItem hitSubItem,
			ListViewHitTestLocations hitLocation)
		{
			item = hitItem;
			subItem = hitSubItem;
			location = hitLocation;
		}
Beispiel #27
0
        private void ListFill(float minAr = 0, int p = 0)
        {

            for (int i = p; i < oldalid * 40; i++)
            {




                if (!idk.Contains(pagemaps[i].id))
                    if (pagemaps[i].maximumAr >= minAr)
                    {
                        {
                            lvi = new ListViewItem();
                            lvi.Text = pagemaps[i].id; //ID hozzáadása

                            ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem(lvi, "Title");      //Címek hozzáadása   
                            subItem.Text = pagemaps[i].title;
                            lvi.SubItems.Add(subItem);

                            ListViewItem.ListViewSubItem subItem2 = new ListViewItem.ListViewSubItem(lvi, "AR");


                            string arek = "";

                            arek += pagemaps[i].minimumAr + "  -  ";

                            arek += pagemaps[i].maximumAr;



                            subItem2.Text = arek;
                            lvi.SubItems.Add(subItem2);


                            ListViewItem.ListViewSubItem subItem3 = new ListViewItem.ListViewSubItem(lvi, "Length");

                            string hossz = "";
                            if (double.Parse(pagemaps[i].beatmaps[0].length) / 60 >= 1)
                                hossz = (double.Parse(pagemaps[i].beatmaps[0].length) / 60).ToString("##.##") + " mins";
                            else
                                hossz = pagemaps[i].beatmaps[0].length + " s ";


                            subItem3.Text = hossz;
                            lvi.SubItems.Add(subItem3);


                            listView1.Items.Add(lvi);

                        }

                    }

            }



        }
Beispiel #28
0
        /// <summary>
        /// Constructor</summary>
        public AboutSysInfoDialog()
        {
            // Required for Windows Form Designer support
            InitializeComponent();

            m_subItemComparer = new SubItemComparer(assemblyListView);
            assemblyListView.ListViewItemSorter = m_subItemComparer;
            assemblyListView.ColumnClick += assemblyListView_ColumnClick;

            // Fill in assembly list
            try 
            {
                // Get all modules
                foreach (ProcessModule module in Process.GetCurrentProcess().Modules)
                {
                    // Get version info
                    string versionString = "0.0"; //the default of Version()
                    try
                    {
                        FileVersionInfo fileVersionInfo = module.FileVersionInfo;
                        if (!String.IsNullOrEmpty(fileVersionInfo.FileVersion))
                        {
                            versionString = String.Format("{0}.{1}.{2}.{3}",
                                fileVersionInfo.FileMajorPart,
                                fileVersionInfo.FileMinorPart,
                                fileVersionInfo.FileBuildPart,
                                fileVersionInfo.FilePrivatePart);
                        }
                    }
                    catch (FileNotFoundException)
                    {
                        //detour.dll from nVidia caused this exception on a Windows 8 laptop
                    }

                    var item = new ListViewItem();
                    item.Text = module.ModuleName;


                    var subItem = new ListViewItem.ListViewSubItem(item, versionString);
                    subItem.Tag = new Version(versionString);
                    item.SubItems.Add(subItem);

                    // Get file date info
                    DateTime lastWriteDate = File.GetLastWriteTime(module.FileName);
                    string dateStr = lastWriteDate.ToString("g");

                    subItem = new ListViewItem.ListViewSubItem(item, dateStr);
                    subItem.Tag = lastWriteDate;
                    item.SubItems.Add(subItem);

                    assemblyListView.Items.Add(item);
                }
            }
            catch (Exception e)
            {
                Outputs.WriteLine(OutputMessageType.Error,e.Message);
            }
        }
        private void AddToListViewNames(string name)
        {
            var item = new ListViewItem(string.Empty) {Checked = true};

            var subItem = new ListViewItem.ListViewSubItem(item, name);
            item.SubItems.Add(subItem);

            listViewNames.Items.Add(item);
        }
Beispiel #30
0
 private void AddNewElementToList(string key)
 {
     ListViewItem listViewItem = new ListViewItem();
     ListViewItem.ListViewSubItem listViewSubItem = new ListViewItem.ListViewSubItem();
     listViewItem.Text = key;
     listViewSubItem.Text = frequencies[key].ToString();
     listViewItem.SubItems.Add(listViewSubItem);
     listView.Items.Add(listViewItem);
 }
        /// <devdoc>
        /// Converts the given object to another type. The most common types to convert
        /// are to and from a string object. The default implementation will make a call
        /// to ToString on the object if the object is valid and if the destination
        /// type is string. If this cannot convert to the desitnation type, this will
        /// throw a NotSupportedException.
        /// </devdoc>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == null)
            {
                throw new ArgumentNullException(nameof(destinationType));
            }

            if (destinationType == typeof(InstanceDescriptor) && value is ListViewItem item)
            {
                ConstructorInfo ctor;
                // Should we use the subitem constructor?
                for (int i = 1; i < item.SubItems.Count; ++i)
                {
                    if (item.SubItems[i].CustomStyle)
                    {
                        if (!string.IsNullOrEmpty(item.ImageKey))
                        {
                            ctor = typeof(ListViewItem).GetConstructor(new Type[] { typeof(ListViewItem.ListViewSubItem[]), typeof(string) });
                            Debug.Assert(ctor != null, "Expected the constructor to exist.");
                            ListViewItem.ListViewSubItem[] subItemArray = new ListViewItem.ListViewSubItem[item.SubItems.Count];
                            ((ICollection)item.SubItems).CopyTo(subItemArray, 0);
                            return(new InstanceDescriptor(ctor, new object[] { subItemArray, item.ImageKey }, false));
                        }
                        else
                        {
                            ctor = typeof(ListViewItem).GetConstructor(new Type[] { typeof(ListViewItem.ListViewSubItem[]), typeof(int) });
                            Debug.Assert(ctor != null, "Expected the constructor to exist.");
                            ListViewItem.ListViewSubItem[] subItemArray = new ListViewItem.ListViewSubItem[item.SubItems.Count];
                            ((ICollection)item.SubItems).CopyTo(subItemArray, 0);
                            return(new InstanceDescriptor(ctor, new object[] { subItemArray, item.ImageIndex }, false));
                        }
                    }
                }

                // Convert SubItem array to string array
                string[] subItems = new string[item.SubItems.Count];
                for (int i = 0; i < subItems.Length; ++i)
                {
                    subItems[i] = item.SubItems[i].Text;
                }

                // ForeColor, BackColor or ItemFont set
                if (item.SubItems[0].CustomStyle)
                {
                    if (!string.IsNullOrEmpty(item.ImageKey))
                    {
                        ctor = typeof(ListViewItem).GetConstructor(new Type[]
                        {
                            typeof(string[]),
                            typeof(string),
                            typeof(Color),
                            typeof(Color),
                            typeof(Font)
                        });
                        Debug.Assert(ctor != null, "Expected the constructor to exist.");
                        return(new InstanceDescriptor(ctor, new object[]
                        {
                            subItems,
                            item.ImageKey,
                            item.SubItems[0].CustomForeColor ? item.ForeColor : Color.Empty,
                            item.SubItems[0].CustomBackColor ? item.BackColor : Color.Empty,
                            item.SubItems[0].CustomFont ? item.Font : null
                        }, false));
                    }
                    else
                    {
                        ctor = typeof(ListViewItem).GetConstructor(new Type[]
                        {
                            typeof(string[]),
                            typeof(int),
                            typeof(Color),
                            typeof(Color),
                            typeof(Font)
                        });
                        Debug.Assert(ctor != null, "Expected the constructor to exist.");
                        return(new InstanceDescriptor(ctor, new object[]
                        {
                            subItems,
                            item.ImageIndex,
                            item.SubItems[0].CustomForeColor ? item.ForeColor : Color.Empty,
                            item.SubItems[0].CustomBackColor ? item.BackColor : Color.Empty,
                            item.SubItems[0].CustomFont ? item.Font : null
                        }, false));
                    }
                }

                // Text
                if (item.ImageIndex == -1 && string.IsNullOrEmpty(item.ImageKey) && item.SubItems.Count <= 1)
                {
                    ctor = typeof(ListViewItem).GetConstructor(new Type[] { typeof(string) });
                    Debug.Assert(ctor != null, "Expected the constructor to exist.");
                    return(new InstanceDescriptor(ctor, new object[] { item.Text }, false));
                }

                // Text and Image
                if (item.SubItems.Count <= 1)
                {
                    if (!string.IsNullOrEmpty(item.ImageKey))
                    {
                        ctor = typeof(ListViewItem).GetConstructor(new Type[]
                        {
                            typeof(string),
                            typeof(string)
                        });
                        Debug.Assert(ctor != null, "Expected the constructor to exist.");
                        return(new InstanceDescriptor(ctor, new object[] { item.Text, item.ImageKey }, false));
                    }
                    else
                    {
                        ctor = typeof(ListViewItem).GetConstructor(new Type[]
                        {
                            typeof(string),
                            typeof(int)
                        });
                        Debug.Assert(ctor != null, "Expected the constructor to exist.");
                        return(new InstanceDescriptor(ctor, new object[] { item.Text, item.ImageIndex }, false));
                    }
                }

                // Text, Image and SubItems
                if (!string.IsNullOrEmpty(item.ImageKey))
                {
                    ctor = typeof(ListViewItem).GetConstructor(new Type[]
                    {
                        typeof(string[]),
                        typeof(string)
                    });
                    Debug.Assert(ctor != null, "Expected the constructor to exist.");
                    return(new InstanceDescriptor(ctor, new object[] { subItems, item.ImageKey }, false));
                }
                else
                {
                    ctor = typeof(ListViewItem).GetConstructor(new Type[]
                    {
                        typeof(string[]),
                        typeof(int)
                    });
                    return(new InstanceDescriptor(ctor, new object[] { subItems, item.ImageIndex }, false));
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Beispiel #32
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (value is ListViewItem && destinationType == typeof(InstanceDescriptor))
            {
                ConstructorInfo constructorInfo;

                Type[]   constructorTypes;
                object[] arguments;

                ListViewItem item = value as ListViewItem;
                for (int i = 1; i < item.SubItems.Count; i++)
                {
                    if (item.SubItems[i].properties != null)
                    {
                        constructorTypes = new Type[] { typeof(ListViewItem.ListViewSubItem[]), typeof(int) };
                        constructorInfo  = typeof(ListViewItem).GetConstructor(constructorTypes);
                        if (constructorInfo != null)
                        {
                            ListViewItem.ListViewSubItem[] listViewSubItems = new ListViewItem.ListViewSubItem[item.SubItems.Count];
                            (item.SubItems as ICollection).CopyTo(listViewSubItems, 0);
                            arguments = new object[] { listViewSubItems, item.ImageIndex };
                            return(new InstanceDescriptor(constructorInfo, (ICollection)arguments, false));
                        }
                        break;
                    }
                }
                string[] strs = new string[item.SubItems.Count];
                for (int i = 0; i < strs.Length; i++)
                {
                    strs[i] = item.SubItems[i].Text;
                }
                ListViewItem.ListViewSubItem subItem = item.SubItems[0];
                if (subItem.properties != null)
                {
                    constructorTypes = new Type[] { typeof(string[]), typeof(int), typeof(Color), typeof(Color), typeof(Font) };
                    constructorInfo  = typeof(ListViewItem).GetConstructor(constructorTypes);
                    if (constructorInfo != null)
                    {
                        Color foreColor = subItem.properties.foreColor;
                        if (foreColor == Color.Empty)
                        {
                            foreColor = item.ForeColor;
                        }
                        Color backColor = subItem.properties.backColor;
                        if (backColor == Color.Empty)
                        {
                            backColor = item.BackColor;
                        }
                        Font font = subItem.properties.font;
                        if (font == null)
                        {
                            font = item.Font;
                        }
                        arguments = new object[] { strs, item.ImageIndex, foreColor, backColor, font };
                        return(new InstanceDescriptor(constructorInfo, (ICollection)arguments, false));
                    }
                }
                if (item.SubItems.Count <= 1)
                {
                    if (item.ImageIndex == -1)
                    {
                        constructorTypes = new Type[] { typeof(string) };
                        constructorInfo  = typeof(ListViewItem).GetConstructor(constructorTypes);
                        if (constructorInfo != null)
                        {
                            arguments = new object[] { item.Text };
                            return(new InstanceDescriptor(constructorInfo, (ICollection)arguments, false));
                        }
                    }
                    else
                    {
                        constructorTypes = new Type[] { typeof(string), typeof(int) };
                        constructorInfo  = typeof(ListViewItem).GetConstructor(constructorTypes);
                        if (constructorInfo != null)
                        {
                            arguments = new object[] { item.Text, item.ImageIndex };
                            return(new InstanceDescriptor(constructorInfo, (ICollection)arguments, false));
                        }
                    }
                }
                constructorTypes = new Type[] { typeof(string[]), typeof(int) };
                constructorInfo  = typeof(ListViewItem).GetConstructor(constructorTypes);
                if (constructorInfo != null)
                {
                    arguments = new object[] { strs, item.ImageIndex };
                    return(new InstanceDescriptor(constructorInfo, (ICollection)arguments, false));
                }
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, System.Type destinationType)
 {
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if ((destinationType == typeof(InstanceDescriptor)) && (value is ListViewItem))
     {
         ConstructorInfo constructor;
         ListViewItem    item = (ListViewItem)value;
         for (int i = 1; i < item.SubItems.Count; i++)
         {
             if (item.SubItems[i].CustomStyle)
             {
                 if (string.IsNullOrEmpty(item.ImageKey))
                 {
                     constructor = typeof(ListViewItem).GetConstructor(new System.Type[] { typeof(ListViewItem.ListViewSubItem[]), typeof(int) });
                     if (constructor != null)
                     {
                         ListViewItem.ListViewSubItem[] array = new ListViewItem.ListViewSubItem[item.SubItems.Count];
                         ((ICollection)item.SubItems).CopyTo(array, 0);
                         return(new InstanceDescriptor(constructor, new object[] { array, item.ImageIndex }, false));
                     }
                 }
                 else
                 {
                     constructor = typeof(ListViewItem).GetConstructor(new System.Type[] { typeof(ListViewItem.ListViewSubItem[]), typeof(string) });
                     if (constructor != null)
                     {
                         ListViewItem.ListViewSubItem[] itemArray = new ListViewItem.ListViewSubItem[item.SubItems.Count];
                         ((ICollection)item.SubItems).CopyTo(itemArray, 0);
                         return(new InstanceDescriptor(constructor, new object[] { itemArray, item.ImageKey }, false));
                     }
                 }
                 break;
             }
         }
         string[] strArray = new string[item.SubItems.Count];
         for (int j = 0; j < strArray.Length; j++)
         {
             strArray[j] = item.SubItems[j].Text;
         }
         if (item.SubItems[0].CustomStyle)
         {
             if (!string.IsNullOrEmpty(item.ImageKey))
             {
                 constructor = typeof(ListViewItem).GetConstructor(new System.Type[] { typeof(string[]), typeof(string), typeof(Color), typeof(Color), typeof(Font) });
                 if (constructor != null)
                 {
                     return(new InstanceDescriptor(constructor, new object[] { strArray, item.ImageKey, item.SubItems[0].CustomForeColor ? item.ForeColor : Color.Empty, item.SubItems[0].CustomBackColor ? item.BackColor : Color.Empty, item.SubItems[0].CustomFont ? item.Font : null }, false));
                 }
             }
             else
             {
                 constructor = typeof(ListViewItem).GetConstructor(new System.Type[] { typeof(string[]), typeof(int), typeof(Color), typeof(Color), typeof(Font) });
                 if (constructor != null)
                 {
                     return(new InstanceDescriptor(constructor, new object[] { strArray, item.ImageIndex, item.SubItems[0].CustomForeColor ? item.ForeColor : Color.Empty, item.SubItems[0].CustomBackColor ? item.BackColor : Color.Empty, item.SubItems[0].CustomFont ? item.Font : null }, false));
                 }
             }
         }
         if (((item.ImageIndex == -1) && string.IsNullOrEmpty(item.ImageKey)) && (item.SubItems.Count <= 1))
         {
             constructor = typeof(ListViewItem).GetConstructor(new System.Type[] { typeof(string) });
             if (constructor != null)
             {
                 return(new InstanceDescriptor(constructor, new object[] { item.Text }, false));
             }
         }
         if (item.SubItems.Count <= 1)
         {
             if (!string.IsNullOrEmpty(item.ImageKey))
             {
                 constructor = typeof(ListViewItem).GetConstructor(new System.Type[] { typeof(string), typeof(string) });
                 if (constructor != null)
                 {
                     return(new InstanceDescriptor(constructor, new object[] { item.Text, item.ImageKey }, false));
                 }
             }
             else
             {
                 constructor = typeof(ListViewItem).GetConstructor(new System.Type[] { typeof(string), typeof(int) });
                 if (constructor != null)
                 {
                     return(new InstanceDescriptor(constructor, new object[] { item.Text, item.ImageIndex }, false));
                 }
             }
         }
         if (!string.IsNullOrEmpty(item.ImageKey))
         {
             constructor = typeof(ListViewItem).GetConstructor(new System.Type[] { typeof(string[]), typeof(string) });
             if (constructor != null)
             {
                 return(new InstanceDescriptor(constructor, new object[] { strArray, item.ImageKey }, false));
             }
         }
         else
         {
             constructor = typeof(ListViewItem).GetConstructor(new System.Type[] { typeof(string[]), typeof(int) });
             if (constructor != null)
             {
                 return(new InstanceDescriptor(constructor, new object[] { strArray, item.ImageIndex }, false));
             }
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
 /// <include file='doc\ListViewHitTestInfo.uex' path='docs/doc[@for="ListViewHitTestInfo.ListViewHitTestInfo"]/*' />
 /// <devdoc>
 ///     Creates a ListViewHitTestInfo instance.
 /// </devdoc>
 public ListViewHitTestInfo(ListViewItem hitItem, ListViewItem.ListViewSubItem hitSubItem, ListViewHitTestLocations hitLocation)
 {
     this.item    = hitItem;
     this.subItem = hitSubItem;
     this.loc     = hitLocation;
 }
Beispiel #35
0
 /// <summary>
 ///     Creates a ListViewHitTestInfo instance.
 /// </summary>
 public ListViewHitTestInfo(ListViewItem hitItem, ListViewItem.ListViewSubItem hitSubItem, ListViewHitTestLocations hitLocation)
 {
     item    = hitItem;
     subItem = hitSubItem;
     loc     = hitLocation;
 }