private void RefreshConnection() { this.txtCPCreateLog.Clear(); foreach (CPCreateLog i in CommuniPortFactory.Default.CPCreateLogs) { string text = i.DT.ToString() + " " + i.Log + Environment.NewLine; this.txtCPCreateLog.AppendText(text); } this.txtCPCreateLog.ScrollToCaret(); this.listView1.Items.Clear(); CommuniPortCollection cps = SoftManager.GetSoft().CommuniPortManager.CommuniPorts; foreach (ICommuniPort cp in cps) { ListViewItem lvi = new ListViewItem(cp.ToString()); string[] subItems = new string[] { GetStationNames(cp), cp.CreateDateTime.ToString() }; lvi.SubItems.AddRange(subItems); listView1.Items.Add(lvi); } }
/// <summary> /// /// </summary> private void Fill() { int no = 1; StationCollection stations = SoftManager.GetSoft().Hardware.Stations; foreach (IStation st in stations) { foreach (IDevice d in st.Devices) { if (d is IOutside) { string keyName = string.Format("{0}: {1}({2})", no++, d.Station.Name, d.DeviceType.Text); KeyValue kv = new KeyValue(keyName, d); kvs.Add(kv); } } } // // kvs.Insert(0, new KeyValue("<无>", null)); this.cmbStandard.DisplayMember = "Key"; this.cmbStandard.ValueMember = "Value"; this.cmbStandard.DataSource = kvs; IOutsideTemperatureProvider p = OutsideTemperatureProviderManager.Provider; if (p is DeviceOTProvider) { this.cmbStandard.SelectedValue = ((DeviceOTProvider)p).Outside; } }
/// <summary> /// /// </summary> private void Fill() { StationCollection stations = SoftManager.GetSoft().Hardware.Stations; foreach (IStation st in stations) { foreach (IDevice d in st.Devices) { if (d is IOutside) { kvs.Add(new KeyValue(d.Station.Name, d)); } } } // // kvs.Insert(0, new KeyValue("<无>", null)); this.cmbStandard.DisplayMember = "Key"; this.cmbStandard.ValueMember = "Value"; this.cmbStandard.DataSource = kvs; IOutsideTemperatureProvider p = OutsideTemperatureProviderManager.Provider; if (p is DeviceOTProvider) { this.cmbStandard.SelectedValue = ((DeviceOTProvider)p).Outside; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMain_Load(object sender, EventArgs e) { Init(); // // this.mnuView.Visible = false; this.toolStrip1.Visible = false; Soft soft = SoftManager.GetSoft(); object o2 = soft.Hardware; int n = soft.Hardware.Stations.Count; n = soft.SocketListenerManager.SocketListeners.Count; //this.Text = n.ToString(); // spu // //this.ucSpus1.SPUs = App.Soft.SPUs; //this.ucSpus1.RefreshSPUs(); this.mnuToolbar.Checked = this.toolStrip1.Visible; this.mnuStatusbar.Checked = this.statusStrip1.Visible; foreach (IDPU dpu in this.Soft.DPUs) { if (dpu.UIEntry != null) { dpu.UIEntry.Create(this.mnuSetting); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void HardwareTreeView_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node is StationTreeNode) { SoftManager.GetSoft().SelectedHardwareItem = ((StationTreeNode)e.Node).Station; } else if (e.Node is DeviceTreeNode) { SoftManager.GetSoft().SelectedHardwareItem = ((DeviceTreeNode)e.Node).Device; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _mnuTemperatureLine_Click(object sender, EventArgs e) { XD1100Device selectedXd1100 = SoftManager.GetSoft().SelectedHardwareItem as XD1100Device; if (selectedXd1100 != null) { string stationName = selectedXd1100.Station.Name; int deviceID = GuidHelper.ConvertToInt32(selectedXd1100.Guid); LocalController c = new LocalController(); frmXD100ModbusTemperatureControl f = new frmXD100ModbusTemperatureControl(stationName, deviceID, c); f.ShowDialog(); } else { NUnit.UiKit.UserMessage.Display("selecte xd1100 device first"); } }
/// <summary> /// /// </summary> /// <param name="cp"></param> /// <returns></returns> private string GetStationNames(ICommuniPort cp) { string r = string.Empty; StationCollection stations = SoftManager.GetSoft().Hardware.Stations; foreach (IStation st in stations) { if (st.CommuniPort == cp) { if (r.Length > 0) { r += ","; } r += st.Name; } } return(r); }
public XD1100Dpu() { this.Name = "XD1100Dpu"; this.DeviceFactory = new XD1100DeviceFactory (this); this.DevicePersister = new XD1100DevicePersister (); this.DeviceSourceProvider = new XD1100DeviceSourceProvider (); this.DeviceType = DeviceTypeManager.AddDeviceType( "XD1100Device", typeof(XD1100Device)); this.DeviceUI = new DeviceUI(this); this.Processor = new XD1100DeviceProcessor(); string path = PathUtils.GetAssemblyDirectory(typeof(XD1100Device).Assembly); this.TaskFactory = new XmlTaskFactory(this, path); this.OperaFactory = new XmlOperaFactory(path); this.UIEntry = new UIEntry(); // TODO: init outside temperature provider manager // SoftManager.GetSoft().HardwareCreated += new EventHandler(XD1100Dpu_HardwareCreated); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void parentMenuItem_DropDownOpening(object sender, EventArgs e) { XD1100Device d = SoftManager.GetSoft().SelectedHardwareItem as XD1100Device; this._mnuTemperatureLine.Visible = d != null; }