protected override void OnClick(EventArgs e) { base.OnClick(e); Debug.WriteLine(this.GetType().Namespace + "." + this.GetType().Name + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + "()"); if (Enabled) { if (!_storage.IsSaved) { /*Prject még soha nem volt mentve, itt az idő hogy megtegye a felhasználó*/ var sps = new ShowingParameters(); if (sps.Show()) { _storage.Parameters.ProductName = sps.ProudctName; _storage.Parameters.ProductVersion = sps.ProductVersion; _storage.Parameters.ProductCode = sps.ProcutCode; _storage.Parameters.CustomerName = sps.CustomerName; _storage.Parameters.CustomerCode = sps.CustomerCode; _storage.SaveAs(sps.Path); _adapter.Play(); } } else { /*Ha nincs vadapater kiválasztva akkor kényszerítjük felhsználót hogy vállaszon valamit.*/ if (!AdapterService.GetAdapters().Contains(_storage.Parameters.DeviceName)) { IAdapterSelectForm selector = new SelectAdapterForm(); selector.ShowDialog(); _storage.Parameters.DeviceName = selector.SelectedAdapter; } _adapter.Play(); } } }
protected override void OnDropDown(EventArgs e) { base.OnDropDown(e); Items.Clear(); Items.AddRange(AdapterService.GetAdapters()); }
/// <summary> /// /// </summary> private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (listView1.SelectedItems.Count != 0) { SelectedAdapter = AdapterService.GetAdapters()[listView1.SelectedItems[0].Index]; } }
/// <summary> /// /// </summary> public AdapterComboBox() { DropDownStyle = ComboBoxStyle.DropDownList; AutoToolTip = true; Items.AddRange(AdapterService.GetAdapters()); Size = new System.Drawing.Size(200, 25); EventAggregator.Instance.Subscribe <StorageAppEvent>(e => { if (e.Details.DataObjects == DataObjects.ParameterProperty && e.Details.PropertyDescriptor.Name == PropertyPlus.GetPropertyName(() => e.Storage.Parameters.DeviceName)) { _parmeters = e.Storage.Parameters; SelectedItem = e.Storage.Parameters.DeviceName; } }); EventAggregator.Instance.Subscribe <StopAppEvent>(e => Enabled = true); EventAggregator.Instance.Subscribe <PlayAppEvent>(e => Enabled = false); }
/// <summary> /// /// </summary> private void AdaptersListRefresh() { var adapters = AdapterService.GetAdapters(); listView1.Items.Clear(); foreach (var name in adapters) { ListViewItem item = new ListViewItem(); if (name.Contains("Virtual")) { item.ImageKey = @"virtual_adapter"; item.Text = name; listView1.Items.Add(item); } else { item.ImageKey = @"adapter"; item.Text = @"Serial Number: " + name; listView1.Items.Add(item); } } }