/* * private void btn_Refresh_Click(object sender, EventArgs e) * { * SaveLog("Refresh, start scan printers"); * * startWait("Scan devices"); * * int handle1 = CreatePrinter(); * Application.DoEvents(); * SetClient(handle1, System.Text.Encoding.ASCII.GetBytes( m_pIPClient), m_iClientCount); * * int count = ScanPrinter(handle1); * * Application.DoEvents(); * StringBuilder pin = new StringBuilder(255 * 20); * GetPrinterInfos(handle1, count ,pin); * String strClient = pin.ToString(); * String[] strClients = null; * Application.DoEvents(); * strClients = strClient.Split(new Char[] { ',' }); * //} * * lstBox_Printers.Items.Clear(); * //lstBox_Printers.DataSource = strClients; * for(int i=0;i<strClients.Length;i++) * lstBox_Printers.Items.Add(strClients[i]); * * DelPrinter(handle1); * StopWait(); * SaveLog("scan end, find [" + count.ToString() + "] printers."); * } */ public LinePageForm newLinePage(string sLineName) { MainTables.TabPages.Add(sLineName); MainTables.SelectTab(MainTables.TabPages.Count - 1); LinePageForm lineform = new LinePageForm(); lineform.FormBorderStyle = FormBorderStyle.None; lineform.Dock = DockStyle.Fill; lineform.TopLevel = false; lineform.Parent = MainTables.SelectedTab; lineform.LineName = sLineName; lineform.mainForm = this; lineform.bNeedAutoConnect = m_bAutoConnect; lineform.bNeedAutoPrint = m_bAutoPrint; lineform.Show(); LineForms.Add(lineform); currLinePage = lineform; createAllLineName(); CLog.SaveLog("Create Line[" + sLineName + "]"); return(lineform); }
public HotelRatingViewModel() { var hotelCollection = MainTables.GetHotelRankCollection(); List <string> keys = hotelCollection.Select(hotel => hotel.Name).ToList(); List <long> values = hotelCollection.Select(hotel => hotel.VoucherClount).ToList(); List <KeyValuePair <string, long> > valueList = new List <KeyValuePair <string, long> >(); for (int i = 0; i < hotelCollection.Count && i < 10; i++) { valueList.Add(new KeyValuePair <string, long>(keys[i], values[i])); } valueList.Add(new KeyValuePair <string, long>("Другие", hotelCollection.Sum(hotel => hotel.VoucherClount))); Hotel10Collection = valueList; SaveInExcel = new RelayCommand(o => MainTables.SaveHotelsRankToExcel(hotelCollection), o => true); }