Ejemplo n.º 1
0
        private void btnDelete_Click_1(object sender, EventArgs e)//Working
        {
            var confirmResult = MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            ListView.CheckedIndexCollection checkedItem = listView1.CheckedIndices;

            if (confirmResult == DialogResult.Yes)
            {
                while (checkedItem.Count > 0)
                {
                    listView1.Items.RemoveAt(checkedItem[0]);
                }

                salesLinesList.Clear();
                int count = 0;

                foreach (ListViewItem i in listView1.Items)
                {
                    int     ID       = Convert.ToInt16(listView1.Items[count].SubItems[0].Text);
                    int     Qty      = Convert.ToInt16(listView1.Items[count].SubItems[1].Text);
                    decimal TPrice   = Convert.ToDecimal(listView1.Items[count].SubItems[2].Text);
                    string  shrtDesc = listView1.Items[count].SubItems[3].Text;

                    SalesLines new_sl = new SalesLines(ID, Qty, TPrice, shrtDesc);
                    salesLinesList.Add(new_sl);
                    count++;
                }
            }
        }
Ejemplo n.º 2
0
        private void Delete_btn_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (confirmResult == DialogResult.Yes)
            {
                ListView.CheckedIndexCollection checkedItems = listView1.CheckedIndices;
                while (checkedItems.Count != 0)
                {
                    var myitem = listView1.Items[checkedItems[0]];
                    all_records.RemoveAll(x => (x.GetName() == myitem.SubItems[0].Text) && (x.GetUsername() == myitem.SubItems[1].Text) && (x.GetPassword() == myitem.SubItems[2].Text));
                    listView1.Items.RemoveAt(checkedItems[0]);
                }

                Program.Decryptfile(Program.file_location(), Program.filename);       /// here

                using (StreamWriter newTask = new StreamWriter(Program.file_location(), false))
                {
                    foreach (Record r in all_records)
                    {
                        newTask.WriteLine(r.Display_details());
                    }
                }

                Program.Encryptfile(Program.file_location(), Program.filename);     // here

                Update_listview();
            }
        }
Ejemplo n.º 3
0
        private void btnDelete_Click(object sender, EventArgs e) // done
        {
            ListView.CheckedIndexCollection checkeditem = listView4.CheckedIndices;

            while (checkeditem.Count > 0)
            {
                listView4.Items.RemoveAt(checkeditem[0]);
            }

            children.Clear();

            int count = 0;

            foreach (ListViewItem i in listView4.Items)
            {
                string   Name = listView4.Items[count].SubItems[0].Text;
                DateTime DOB  = Convert.ToDateTime(listView4.Items[count].SubItems[1].Text);
                string   Fact = listView4.Items[count].SubItems[2].Text;

                ChildDetails new_Child = new ChildDetails(Name, DOB, Fact);

                children.Add(new_Child);
                count++;
            }
        }
Ejemplo n.º 4
0
        private void lvTerm_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }

            ListView.CheckedIndexCollection selDist = lvDist.CheckedIndices;
            ListView.CheckedIndexCollection selTerm = lvTerm.CheckedIndices;

            if (e.NewValue == CheckState.Checked && (selDist.Count + selTerm.Count) >= 17)
            {
                MessageBox.Show(LangPack.GetMongolian("Terminals can not be selected to issue more than sixteen."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                e.NewValue = CheckState.Unchecked;
                return;
            }

            ListViewItem item = lvTerm.Items[e.Index];

            if (e.NewValue == CheckState.Checked)
            {
                item.ForeColor = Color.Blue;
                item.Font      = new Font(lvTerm.Font, FontStyle.Bold);
            }
            else
            {
                item.ForeColor = Color.Black;
                item.Font      = new Font(lvTerm.Font, FontStyle.Regular);
            }
        }
Ejemplo n.º 5
0
 private void prepareTestCases(ListView.CheckedIndexCollection selectedTCs)
 {
     currentTestingIndex = 0;
     lstTestCases.Clear();
     foreach (int index in selectedTCs)
     {
         if (index == 0)
         {
             lstTestCases.Add(new ThreadStart(testCase1_Runnable));
         }
         else if (index == 1)
         {
             lstTestCases.Add(new ThreadStart(testCase2_Runnable));
         }
         if (index == 2)
         {
             lstTestCases.Add(new ThreadStart(testCase3_Runnable));
         }
         if (index == 3)
         {
             lstTestCases.Add(new ThreadStart(testCase4_Runnable));
         }
         if (index == 4)
         {
             lstTestCases.Add(new ThreadStart(testCase5_Runnable));
         }
         if (index == 5)
         {
             lstTestCases.Add(new ThreadStart(testCase6_Runnable));
         }
     }
 }
Ejemplo n.º 6
0
        private void ApplyBtn_Click(object sender, EventArgs e)
        {
            ListView.CheckedIndexCollection checkedIdx = ModsListView.CheckedIndices;

            mainProc.SaveCheckedMods(checkedIdx);

            int[] deleteModIdxs = GetDeleteModIdxs();

            SetProgressStatus(deleteModIdxs.Length, true);

            int i = 1;

            foreach (int idx in deleteModIdxs)
            {
                i++;
                ChangeProgressStatus(i);
                mainProc.RemoveClientMod(idx);
            }

            DisableProgressBar();

            string[] applyModNames = GetApplyModNames();

            mainProc.ModApply(ClientPathTextBox.Text, applyModNames);
        }
Ejemplo n.º 7
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            TreeNode selNode = tvKind.SelectedNode;

            ListView.CheckedIndexCollection selText = lvText.CheckedIndices;

            if (selText == null || selText.Count == 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please choose the CG text to delete."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (DialogResult.No == MessageBox.Show(LangPack.GetMongolian("Want to delete?"), this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2))
            {
                return;
            }

            for (int i = 0; i < selText.Count; i++)
            {
                BoardInfoDetail info = lvText.Items[selText[i]].Tag as BoardInfoDetail;
                brdMng.dicBrd[info.kind].dicText.Remove(info.name);
                brdMng.SaveBrdData();
            }

            MessageBox.Show(LangPack.GetMongolian("Deleted."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);

            if (this.OnCGChangedEvt != null)
            {
                this.OnCGChangedEvt(this, new CGChangedEventArgs());
            }

            tvKind.SelectedNode = null;
            tvKind.SelectedNode = selNode;
        }
Ejemplo n.º 8
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            TreeNode selNode = tvKind.SelectedNode;

            ListView.CheckedIndexCollection selText = lvText.CheckedIndices;

            if (selText == null || selText.Count == 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select the items to modify."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (selText.Count != 1)
            {
                MessageBox.Show(LangPack.GetMongolian("Please choose one CG text to modify."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            BoardInfoDetail info = lvText.Items[selText[0]].Tag as BoardInfoDetail;
            BoardEditForm   form = new BoardEditForm(info, isPrimaryCG);

            form.OnCGChangeEvt += new EventHandler <CGChangeEventArgs>(form_OnCGChangeEvt);
            form.ShowDialog();
            form.OnCGChangeEvt -= new EventHandler <CGChangeEventArgs>(form_OnCGChangeEvt);

            tvKind.SelectedNode = null;
            tvKind.SelectedNode = selNode;
        }
Ejemplo n.º 9
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            ListView.CheckedIndexCollection checkedIdx = ModsListView.CheckedIndices;

            mainProc.SaveCheckedMods(checkedIdx);

            Common.DeleteIfEmpty(mainProc.myModsPath);
        }
Ejemplo n.º 10
0
 //Delete checked tasks
 private void delTaskListViewItems()
 {
     ListView.CheckedIndexCollection checkedItems = taskListView.CheckedIndices;
     while (checkedItems.Count > 0)
     {
         taskListView.Items.RemoveAt(checkedItems[0]);
     }
     editButton.Visible = nameTextBox.Text != "" && taskListView.SelectedItems.Count > 0;
 }
Ejemplo n.º 11
0
 private void Goodslv_ItemChecked(object sender, ItemCheckedEventArgs e)   //勾选商品同时异步显示联通时间
 {
     if (goodslv.CheckedIndices != null && goodslv.CheckedIndices.Count > 0)
     {
         ListView.CheckedIndexCollection c = goodslv.CheckedIndices;
         outputt.Text = String.Format("已选择商品为: {0} {1},商品ID为: {2},商品价格为: {3}", goodslv.Items[c[0]].Text,
                                      goodslv.Items[c[0]].SubItems[1].Text, goodslv.Items[c[0]].SubItems[2].Text, goodslv.Items[c[0]].SubItems[3].Text);
         if (!bggetunifritime.IsBusy)
         {
             bggetunifritime.RunWorkerAsync();
         }
     }
 }
Ejemplo n.º 12
0
        public void btnEnd_Click(object sender, EventArgs e)
        {
            ListView.CheckedIndexCollection selDist = lvDist.CheckedIndices;
            ListView.CheckedIndexCollection selTerm = lvTerm.CheckedIndices;

            if ((selDist == null && selTerm == null) || ((selDist.Count + selTerm.Count) == 0))
            {
                MessageBox.Show(LangPack.GetMongolian("Please select terminal(s) to issue."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if ((selDist.Count + selTerm.Count) > 16)
            {
                MessageBox.Show(LangPack.GetMongolian("Terminals can not be selected to issue more than sixteen."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            List <string> lstDistIP = new List <string>();
            List <string> lstTermIP = new List <string>();

            for (int i = 0; i < selDist.Count; i++)
            {
                lstDistIP.Add((lvDist.Items[selDist[i]].Tag as DistData).DistIp);
            }

            for (int i = 0; i < selTerm.Count; i++)
            {
                lstTermIP.Add((lvTerm.Items[selTerm[i]].Tag as TermData).TermIp);
            }

            if (evtIndInfo != null)
            {
                evtIndInfo(lstDistIP, lstTermIP);
            }

            this.lvDist.CheckBoxes = false;
            this.lvTerm.CheckBoxes = false;

            if (bSnGrp)
            {
                this.BackgroundImage = Util.GetBackgroundImage((byte)Util.emBackImage.grpNone);
            }
            else
            {
                this.BackgroundImage = Util.GetBackgroundImage((byte)Util.emBackImage.IndNone);
            }

            btnEnd.Enabled = false;
        }
Ejemplo n.º 13
0
        private void btnUpdate_Click(object sender, EventArgs e)//broken
        {
            ListView.CheckedIndexCollection checkedItem = listView1.CheckedIndices;
            while (checkedItem.Count > 0)
            {
                frmUpdateSalesLines updateSalesLinesForm = new frmUpdateSalesLines(productList, salesLinesList);
                SalesLines          saleslines           = updateSalesLinesForm.GetUpdate();

                if (saleslines != null)
                {
                    salesLinesList.Add(saleslines);
                }
                listUpdate(listView1);
            }
        }
Ejemplo n.º 14
0
 public void Run(bool infinityMode, bool debugMode, ListView.CheckedIndexCollection selectedTCs, dutController dut1, dutController dut2)
 {
     if (tdRun != null)
     {
         Stop();
     }
     _dut1 = dut1;
     _dut2 = dut2;
     Logger.Initialize(System.AppDomain.CurrentDomain.BaseDirectory + "\\Log\\" + dut1.DeviceID + "_" + dut2.DeviceID);
     infinityModeFlag = infinityMode;
     debugModeFlag    = debugMode;
     runFlag          = true;
     prepareTestCases(selectedTCs);
     tdRun = new Thread(testlist_Runnable);
     tdRun.Start();
 }
Ejemplo n.º 15
0
        public void SaveCheckedMods(ListView.CheckedIndexCollection idxs)
        {
            for (int i = 0; i < myMods.ModList.Count; i++)
            {
                if (idxs.Contains(i))
                {
                    myMods.ModList.ElementAt(i).ApplyChecked = true;
                }
                else
                {
                    myMods.ModList.ElementAt(i).ApplyChecked = false;
                }
            }

            xmlManager.XmlWriter(myMods);
        }
Ejemplo n.º 16
0
        private void btnConvert_Click(object sender, EventArgs e)
        {
            //string strPathTar = this.strRootPath + "\\" + this.strType + "\\json";
            //DirectoryInfo diTar = new DirectoryInfo(strPathTar);
            //FileInfo[] listFileInfo = diTar.GetFiles();
            //foreach (FileInfo fi in listFileInfo)
            //    File.Delete(fi.FullName);

            this.SetButtonsEnable(false);
            ListView.CheckedIndexCollection ck = this.listViewData.CheckedIndices;
            if (ck.Count == 0)
            {
                this.AddLog("[!错误] 请选中需要转换的工作表!");
                this.SetButtonsEnable(true);
                return;
            }
            string str = "需要转换的工作表共计" + ck.Count + "项!";

            this.AddLog(str);
            for (int i = 0; i < this.listXlsx.Count; i++)
            {
                DataXlsx xlsx = this.listXlsx[i];
                int      n    = 0;
                for (int j = 0; j < xlsx.listSheet.Count; j++)
                {
                    DataSheet sheet = xlsx.listSheet[j];
                    sheet.bChecked = false;
                    if (sheet.lvi != null)
                    {
                        if (sheet.lvi.Checked)
                        {
                            sheet.bChecked = true;
                            n++;
                        }
                    }
                }
                xlsx.nSheetChecked = n;
            }
            this.nPosition           = 0;
            this.progressBar.Minimum = 0;
            this.progressBar.Value   = 0;
            this.progressBar.Maximum = ck.Count;
            this.nWorkMode           = WorkMode.Convert;
            this.timer.Enabled       = true;
            ThreadPool.SetMinThreads(10, 10);
            ThreadPool.QueueUserWorkItem(new WaitCallback(FormMain.ConvertXlsxSheet), null);
        }
Ejemplo n.º 17
0
        private void btnDeleteProduct_Click_1(object sender, EventArgs e)
        {
            if (lsvProductList.CheckedItems.Count > 0)
            {
                var confirmResult = MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (confirmResult == DialogResult.Yes)
                {
                    List <int> productIDsToBeDeleted = new List <int>();                                   //Store product IDs for deletion
                    ListView.CheckedListViewItemCollection checkedItemIDs = lsvProductList.CheckedItems;   //CheckedItem collection to retrieve product ID
                    ListView.CheckedIndexCollection        checkedItems   = lsvProductList.CheckedIndices; //CheckedIndex collection to remove item from listview

                    //Add IDs to be removed into list
                    foreach (ListViewItem item in checkedItemIDs)
                    {
                        productIDsToBeDeleted.Add(Convert.ToInt32(item.SubItems[0].Text));
                    }
                    //Remove checked items from listview
                    while (checkedItems.Count > 0)
                    {
                        lsvProductList.Items.RemoveAt(checkedItems[0]);
                    }
                    //Get Items to be removed from product List
                    List <Product> itemsToRemove = new List <Product>();
                    foreach (Product product in productList)
                    {
                        foreach (int productToBeDeleted in productIDsToBeDeleted)
                        {
                            if (product.productID == productToBeDeleted)
                            {
                                itemsToRemove.Add(product);
                            }
                        }
                    }
                    //Remove items from product list
                    foreach (Product item in itemsToRemove)
                    {
                        productList.Remove(item);
                    }
                }
            }
            else
            {
                MessageBox.Show("No Item Seleted", "Invalid Selection", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 18
0
        private async void btnPostVideos_Click(object sender, EventArgs e)
        {
            ListView.CheckedIndexCollection CheckedIndices = lstVideos.CheckedIndices;
            List <int> SelectedIndices = new List <int>();

            foreach (int index in CheckedIndices)
            {
                SelectedIndices.Add(index);
            }

            btnProcess.Enabled    = false;
            btnPostVideos.Enabled = false;
            UserSettings settings = UserSettings.Load();
            await Task.Run(() =>
            {
                int intCount = 0;
                foreach (int index in SelectedIndices)
                {
                    VideoToPost video = QueuedVideos[index];
                    intCount++;
                    SetStatus("Posting Video..." + intCount.ToString() + " of " + SelectedIndices.Count().ToString() + ": " + video.title);
                    List <attached_media> UploadedMedia = new List <attached_media>();
                    var postOnWallTask = facebookService.PostOnWallAsync(txtAccessKey.Text, txtPageID.Text, video.summary, "", UploadedMedia, video.url);
                    Task[] array       = new Task[] { postOnWallTask };
                    try {
                        Task.WaitAll(array, -1);
                        if (!settings.postedVideos.Contains(video.id))
                        {
                            settings.postedVideos.Add(video.id);
                            settings.Save();
                        }
                    } catch {
                    }
                }
                SetStatus(SelectedIndices.Count().ToString() + " Videos Posted!");
            });

            //Uncheck processed items
            btnProcess.Enabled    = true;
            btnPostVideos.Enabled = true;
            lstVideos.Items.OfType <ListViewItem>().Where(x => SelectedIndices.Contains(x.Index)).ToList().ForEach(item => item.Checked = false);
        }
Ejemplo n.º 19
0
        private void lvText_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            ListView.CheckedIndexCollection selText = lvText.CheckedIndices;

            if (selText == null || selText.Count <= 0)
            {
                return;
            }

            if (bOrder)
            {
                BoardInfoDetail info = lvText.Items[selText[0]].Tag as BoardInfoDetail;

                if (evtBoardText != null)
                {
                    evtBoardText(info);
                }

                //this.Close();
            }
        }
Ejemplo n.º 20
0
        private void toolStripBtnClean_Click(object sender, EventArgs e)
        {
            vbtnScan.Enabled = true;
            if (this.lsvFile.Items.Count > 0)
            {
                foreach (ListViewItem lvi in this.lsvFile.Items)
                {
                    if (!lvi.Checked)
                    {
                        continue;
                    }

                    try
                    {
                        if (rbtnDelete.Checked == true)
                        {
                            lblFilename.Text = "Deleted File(s) " + lvi.Text;
                            lblFilename.Refresh();
                            File.Delete(Path.Combine(lvi.SubItems[2].Text, lvi.Text));
                            continue;
                        }

                        if (rbtnMoveToFolder.Checked == true)
                        {
                            ListView.CheckedIndexCollection checkedItems = lsvFile.CheckedIndices;
                            lblFilename.Text = "Moving File(s) " + lvi.Text;
                            lblFilename.Refresh();
                            lsvFile.Items.RemoveAt(checkedItems[0]);
                            if (!File.Exists(Path.Combine(txtboxMoveFolder.Text, lvi.Text)))
                            {
                                File.Move(Path.Combine(lvi.SubItems[2].Text, lvi.Text), Path.Combine(txtboxMoveFolder.Text, lvi.Text));
                            }
                        }
                    }catch (Exception ex) { MessageBox.Show(ex.Message); }
                }
            }
            ClearAll();
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Get all Possible Subject. Can be duplicated for Irregular
 /// </summary>
 private void GetPossibleSubject()
 {
     ListView.CheckedListViewItemCollection items = lstSubjects.CheckedItems;
     if (lstSelectedSubjects.Items.Count == 0 || !isRegular)
     {
         foreach (ListViewItem i in items)
         {
             //ListViewItem itm = new ListViewItem("0");
             //itm.SubItems.Add(i.SubItems[0].Text);
             //itm.SubItems.Add(i.SubItems[1].Text);
             //itm.SubItems.Add(i.SubItems[3].Text);
             //lstSelectedSubjects.Items.Add(itm);
             mc.AddSubject(i.SubItems[0].Text, i.SubItems[1].Text, i.SubItems[3].Text,
                           Convert.ToInt32(db.DataLookUp("(LectureHours + LaboratoryHours)", "tblSubjects", "0", "SubjectID='" + i.SubItems[0].Text + "'")));
             mc.ViewAllSubjectItems(lstSelectedSubjects);
         }
     }
     else
     {
         List <MySubject> selectedSubjects = mc.SelectedSubjects;
         foreach (ListViewItem i in items)
         {
             //Check every CheckedSubjects in Subjects does not exist in Selected Subjects
             if (selectedSubjects.Where(s => s.SubjectID.Equals(i.SubItems[0].Text)).Select(s => s).ToList().Count == 0)
             {
                 mc.AddSubject(i.SubItems[0].Text, i.SubItems[1].Text, i.SubItems[3].Text,
                               Convert.ToInt32(db.DataLookUp("(LectureHours + LaboratoryHours)", "tblSubjects", "0", "SubjectID='" + i.SubItems[0].Text + "'")));
                 mc.ViewAllSubjectItems(lstSelectedSubjects);
             }
         }
     }
     //Clears Check in Subjects Listview after Getting its possible entry
     ListView.CheckedIndexCollection indexCol = lstSubjects.CheckedIndices;
     foreach (int x in indexCol)
     {
         lstSubjects.Items[x].Checked = false;
     }
 }
Ejemplo n.º 22
0
        private void btnView_Click(object sender, EventArgs e)
        {
            ListView.CheckedIndexCollection selText = lvText.CheckedIndices;

            if (selText == null || selText.Count == 0)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select CG text to preview."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (selText.Count != 1)
            {
                MessageBox.Show(LangPack.GetMongolian("Please select one CG text to preview."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            BoardInfoDetail info = lvText.Items[selText[0]].Tag as BoardInfoDetail;

            BoardViewForm form = new BoardViewForm(info.text, info.isBlack, this.isPrimaryCG);

            form.ShowDialog();

            lvText.Items[selText[0]].Checked = false;
        }
Ejemplo n.º 23
0
        private void btnGateName_Click(object sender, EventArgs e)
        {
            ListView.CheckedIndexCollection checkedIndex = lv_Port.CheckedIndices;
            int index = lv_Port.CheckedIndices[0];

            if (txtGateName.Text == "")
            {
                MessageBox.Show("이름을 기입하십시오");
            }
            else if (index != -1)
            {
                lv_Port.Items[index].SubItems[2].Text = txtGateName.Text;

                string[] ST = comb_Reader.Items[index].ToString().Split(',');

                string unit = ST[0] + ',' + ST[1] + ',' + txtGateName.Text + ',' + ST[3] + ',' + ST[4];

                comb_Reader.Items[index] = unit;

                string strqry = "Update ServerContainer set Gate = '" + txtGateName.Text + "'where port =" + ST[1];
                Server.SQLUpload(strqry);
                rebootflag = true;
            }
        }
Ejemplo n.º 24
0
        private void Deletebtn_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Are you sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (confirmResult == DialogResult.Yes)
            {
                List <int> supplierIDsToBeDeleted = new List <int>();                             //Store product IDs for deletion
                ListView.CheckedListViewItemCollection checkedItemIDs = listView1.CheckedItems;   //CheckedItem collection to retrieve product ID
                ListView.CheckedIndexCollection        checkedItems   = listView1.CheckedIndices; //CheckedIndex collection to remove item from listview

                //Add IDs to be removed into list
                foreach (ListViewItem item in checkedItemIDs)
                {
                    supplierIDsToBeDeleted.Add(Convert.ToInt32(item.SubItems[0].Text));
                }

                //Remove checked items from listview
                while (checkedItems.Count > 0)
                {
                    listView1.Items.RemoveAt(checkedItems[0]);
                }

                //Get Items to be removed from product List
                List <Suppliersdetails> itemsToRemove = new List <Suppliersdetails>();
                foreach (Suppliersdetails supplier in suppliers)
                {
                    foreach (int supplierToBeDeleted in supplierIDsToBeDeleted)
                    {
                        if (supplier.id == supplierToBeDeleted)
                        {
                            itemsToRemove.Add(supplier);
                        }
                    }
                }
            }
        }
Ejemplo n.º 25
0
 private void убратьРасходToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ListView.CheckedIndexCollection chekindex = listView1.CheckedIndices;
     if (chekindex.Count < 1)
     {
         MessageBox.Show(
             "1. В поле \"ID\" Отметьте галочкой ненавистные платежи\n\n2. Нажмите кнопку \"Убрать расход\"",
             "Для удаления",
             MessageBoxButtons.OK,
             MessageBoxIcon.Information,
             MessageBoxDefaultButton.Button1,
             MessageBoxOptions.DefaultDesktopOnly);
     }
     else
     {
         int i = 0;
         foreach (int item in chekindex)
         {
             spends.RemoveAt(item - i);
             listView1.Items.RemoveAt(item - i);
             i++;
         }
     }
 }
Ejemplo n.º 26
0
        private void lvDist_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (e.Index < 0)
            {
                return;
            }

            ListView.CheckedIndexCollection selDist = lvDist.CheckedIndices;
            ListView.CheckedIndexCollection selTerm = lvTerm.CheckedIndices;

            if (e.NewValue == CheckState.Checked && (selDist.Count + selTerm.Count) >= 17)
            {
                MessageBox.Show(LangPack.GetMongolian("Terminals can not be selected to issue more than sixteen."), LangPack.GetMongolian(this.Name), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                e.NewValue = CheckState.Unchecked;
                return;
            }

            ListViewItem item = lvDist.Items[e.Index];

            if (bGroup)
            {
                Group grp = item.Tag as Group;

                if (evtGroupInfo != null)
                {
                    evtGroupInfo(grp);
                }

                item.ForeColor    = Color.Blue;
                item.Font         = new System.Drawing.Font(lvDist.Font, FontStyle.Bold);
                lvDist.CheckBoxes = false;
            }
            else
            {
                DistData            dist     = item.Tag as DistData;
                List <ListViewItem> lstIndex = new List <ListViewItem>();

                if (e.NewValue == CheckState.Checked)
                {
                    item.ForeColor = Color.Blue;
                    item.Font      = new Font(lvDist.Font, FontStyle.Bold);

                    foreach (ListViewItem lv in lvTerm.Items)
                    {
                        TermData term = lv.Tag as TermData;
                        if (term.DistCode == dist.Code)
                        {
                            lstIndex.Add(lv);
                        }
                    }

                    foreach (ListViewItem index in lstIndex)
                    {
                        lvTerm.Items.Remove(index);
                    }
                }
                else
                {
                    item.ForeColor = Color.Black;
                    item.Font      = new Font(lvDist.Font, FontStyle.Regular);

                    ListViewItem newItem = null;

                    foreach (KeyValuePair <string, TermData> pair in dist.dicBroadTermData)
                    {
                        TermData term = pair.Value as TermData;

                        newItem      = new ListViewItem();
                        newItem.Text = "";
                        newItem.Tag  = term;
                        lvTerm.Items.Add(newItem);
                        newItem.SubItems.Add(term.Name);
                        newItem.SubItems.Add(dist.Name);
                    }

                    lvTerm.Sort();
                }
            }
        }
Ejemplo n.º 27
0
        private void ModsListView_Leave(object sender, System.EventArgs e)
        {
            ListView.CheckedIndexCollection checkedIdx = ModsListView.CheckedIndices;

            mainProc.SaveCheckedMods(checkedIdx);
        }
        private void click_Extract(object sender, EventArgs e)
        {
            int CardColumn        = 2;
            int TagColumn         = 4;
            int DescriptionColumn = 5;
            int SlotRowWidth      = 34;

            List <IO_Block> Selected_Cards = new List <IO_Block>();

            ListView.CheckedIndexCollection holder = lv_IOCards.CheckedIndices;

            foreach (int index in holder)
            {
                Selected_Cards.Add(IO_Blocks[index]);
            }

            Excel.Application ExcelApp = new Excel.Application();
            ExcelApp.Visible        = false;
            ExcelApp.ScreenUpdating = false;
            ExcelApp.EnableEvents   = false;

            Excel.Workbook ExcelWB = ExcelApp.Workbooks.Open(tb_Path.Text);
            ExcelApp.Calculation = Excel.XlCalculation.xlCalculationManual;
            Excel.Sheets ExcelSheets = ExcelWB.Sheets;

            foreach (IO_Block card in Selected_Cards)
            {
                int test = SlotRowWidth * Int32.Parse(card.slot) + 3;
                ExcelSheets[1].Cells[SlotRowWidth * Int32.Parse(card.slot) + 3, CardColumn].Value = card.partNumber;

                int portCount = 0;
                for (int i = 0; i < card.portDescriptions.Length; i++)
                {
                    if (!String.IsNullOrEmpty(card.portDescriptions[i]))
                    {
                        ExcelSheets[1].Cells[SlotRowWidth * Int32.Parse(card.slot) + 4 + portCount, DescriptionColumn].Value = card.portDescriptions[i];
                        portCount++;
                    }
                }
                ExcelApp.DisplayAlerts = false;

                Excel.Range rng = ExcelSheets[1].Range[ExcelSheets[1].Cells[SlotRowWidth * Int32.Parse(card.slot) + 4, DescriptionColumn], ExcelSheets[1].Cells[SlotRowWidth * Int32.Parse(card.slot) + 35, DescriptionColumn]];
                rng.Replace(@"\P", " ", Excel.XlLookAt.xlPart);
                rng.Replace(@" \P", " ", Excel.XlLookAt.xlPart);
                rng.Copy();

                ExcelSheets[1].Cells[SlotRowWidth * Int32.Parse(card.slot) + 4, TagColumn].PasteSpecial(Excel.XlPasteType.xlPasteValues, Excel.XlPasteSpecialOperation.xlPasteSpecialOperationNone, false, false);

                rng = ExcelSheets[1].Range[ExcelSheets[1].Cells[SlotRowWidth * Int32.Parse(card.slot) + 4, TagColumn], ExcelSheets[1].Cells[SlotRowWidth * Int32.Parse(card.slot) + 35, TagColumn]];
                rng.Replace("  ", "_", Excel.XlLookAt.xlPart);
                rng.Replace(" ", "_", Excel.XlLookAt.xlPart);
                rng.Replace("-", "_", Excel.XlLookAt.xlPart);
                rng.Replace("SPARE", "", Excel.XlLookAt.xlPart);

                ExcelApp.DisplayAlerts = true;
            }
            ExcelWB.Worksheets[1].Cells[3, 2].Select();

            Autodesk.AutoCAD.Windows.SaveFileDialog sfd = new Autodesk.AutoCAD.Windows.SaveFileDialog("Save IO Export Excel file as:", "IOExport", "xlsm", "ExcelFiles", Autodesk.AutoCAD.Windows.SaveFileDialog.SaveFileDialogFlags.DoNotWarnIfFileExist);
            System.Windows.Forms.DialogResult       dr  = sfd.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                ExcelWB.SaveAs(sfd.Filename, Type.Missing, Type.Missing, Type.Missing, true, false, Excel.XlSaveAsAccessMode.xlNoChange, Excel.XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing);

                ExcelApp.EnableEvents   = true;
                ExcelApp.Visible        = true;
                ExcelApp.ScreenUpdating = true;
                ExcelApp.Calculation    = Excel.XlCalculation.xlCalculationAutomatic;

                ExcelWB.Unprotect();
                ExcelApp.Run("ExternalUpdate");
                ExcelWB.Protect();
                this.Close();
            }
            else
            {
                ExcelWB.Close(false, Type.Missing, Type.Missing);
                this.Close();
            }
        }
Ejemplo n.º 29
0
 public void Run(ListView.CheckedIndexCollection selectedTCs, dutController dut1, dutController dut2)
 {
     Run(false, false, selectedTCs, dut1, dut2);
 }