public ShutterNode() : base() { index++; this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxShutterType; this.Text = UIResMang.GetString("TextShutter"); this.Title = UIResMang.GetString("TextShutter") + index; SetText(this.Title); this.Size = new Size(60, 60); this.Padding = new Padding(15); this.Radius = 30; this.FlatStyle = EFlatStyle.Flat; this.Alpha = 0.6f; this.BackgroundColor = Color.White; this.Symbol = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResCtrlDir, "Shutter_On.png")); this.ImageOn = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResCtrlDir, "Shutter_On.png")); this.ImageOff = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResCtrlDir, "Shutter_Off.png")); this.ShutterUpDown = new KNXObject(); this.ShutterStop = new KNXObject(); this.AbsolutePositionOfShutter = new KNXObject(); this.AbsolutePositionOfBlinds = new KNXObject(); this.StateUpperPosition = new KNXObject(); this.StateLowerPosition = new KNXObject(); this.StatusActualPositionOfShutter = new KNXObject(); this.StatusActualPositionOfBlinds = new KNXObject(); }
/// <summary> /// 保存当前组地址数据, /// </summary> private void SaveAddressList() { Cursor = Cursors.WaitCursor; try { //// 保存缓存中的数据到 JSON 文件 WriteToDatasource(); var formName = typeof(FrmMain).Name; if (Application.OpenForms[formName] != null) { var frm = Application.OpenForms[formName] as FrmMain; if (frm != null) { frm.ProjectChanged(); } } this.Changed = false; } catch (Exception ex) { string errorMsg = UIResMang.GetString("Message18"); MessageBox.Show(errorMsg, UIResMang.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Error(errorMsg + LogHelper.Format(ex)); } finally { Cursor = Cursors.Default; } }
public DimmerNode() : base() { index++; this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxDimmerType; this.Text = UIResMang.GetString("TextDimmer"); this.Title = UIResMang.GetString("TextDimmer") + index; SetText(this.Title); this.Size = new Size(60, 60); this.Padding = new Padding(15); this.FlatStyle = EFlatStyle.Flat; this.Radius = 30; this.Alpha = 0.6f; this.BackgroundColor = Color.White; this.Symbol = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResCtrlDir, "Dimmer_Off.png")); this.ImageOn = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResCtrlDir, "Dimmer_On.png")); this.ImageOff = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResCtrlDir, "Dimmer_Off.png")); this.Switch = new KNXObject(); this.DimRelatively = new KNXObject(); this.DimAbsolutely = new KNXObject(); this.StateOnOff = new KNXObject(); this.StateDimValue = new KNXObject(); }
public FrmGroupAddress(DataStatus status) { InitializeComponent(); foreach (var it in Enum.GetNames(typeof(KNXPriority))) { this.cmbPriority.Items.Add(it); } foreach (var it in MyCache.NodeActions) { this.treeViewDefaultActions.Nodes.Add(it); } AddressStatus = status; if (DataStatus.Modify == AddressStatus) { this.txtID.Enabled = false; this.txtWriteAddress.Enabled = false; this.Text = UIResMang.GetString("TextModifyAddress"); } else if (DataStatus.Add == AddressStatus) { this.Text = UIResMang.GetString("TextAddNewAddress"); } foreach (var it in MyCache.NodeTypes) { this.tvDPTName.Nodes.Add(it); } this.tvDPTName.Height = 300; this.tvDPTName.Visible = false; this.tvDPTName.NodeMouseDoubleClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(tvDPTName_NodeMouseDoubleClick); this.Controls.Add(this.tvDPTName); }
public SceneButtonNode() : base() { index++; this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxSceneButtonType; this.Text = UIResMang.GetString("TextSceneButton"); this.Title = UIResMang.GetString("TextSceneButton") + index; SetText(this.Title); this.Size = new Size(180, 40); this.FlatStyle = EFlatStyle.Stereo; this.Clickable = EBool.Yes; this.ReadAddressId = new Dictionary <string, KNXSelectedAddress>(); this.WriteAddressIds = new Dictionary <string, KNXSelectedAddress>(); this.ImageOn = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResImgDir, "on4.png")); this.ColorOn = this.BackgroundColor; this.ImageOff = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResImgDir, "off4.png")); this.ColorOff = this.BackgroundColor; this.IsGroup = EBool.No; this.DefaultValue = 1; }
/// <summary> /// ViewNode 转 KNXView /// </summary> /// <param name="knx"></param> public void ToKnx(KNXView knx, BackgroundWorker worker) { if (null != worker) { worker.ReportProgress(0, string.Format(UIResMang.GetString("TextIsExporting"), this.Title)); } knx.Id = this.Id; knx.Text = this.Text; knx.Title = this.Title; knx.Left = this.Location.X; knx.Top = this.Location.Y; knx.Width = this.Size.Width; knx.Height = this.Size.Height; knx.Padding = new KNXPadding(this.Padding); knx.DisplayBorder = (int)this.DisplayBorder; knx.BorderColor = ColorHelper.ColorToHexStr(this.BorderColor); knx.Alpha = this.Alpha; knx.Radius = this.Radius; knx.FlatStyle = (int)this.FlatStyle; knx.BackgroundColor = ColorHelper.ColorToHexStr(this.BackgroundColor); knx.BackgroundImage = this.BackgroundImage; knx.TitleFont = this.TitleFont.ToKnx(); MyCache.ValidResImgNames.Add(knx.BackgroundImage); }
public DigitalAdjustmentNode() : base() { index++; this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxDigitalAdjustmentType; this.Text = UIResMang.GetString("TextDigitalAdjustment"); this.Title = UIResMang.GetString("TextDigitalAdjustment") + index; SetText(this.Title); this.Size = new Size(180, 40); this.FlatStyle = EFlatStyle.Stereo; this.TitleFont = new STFont(Color.Yellow, 28); this.ReadAddressId = new Dictionary <string, KNXSelectedAddress>(); this.WriteAddressIds = new Dictionary <string, KNXSelectedAddress>(); this.LeftImage = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResImgDir, "reduce.png")); this.RightImage = ProjResManager.CopyImage(Path.Combine(MyCache.ProjectResImgDir, "increase.png")); this.DecimalDigit = EDecimalDigit.Zero; this.MaxValue = 30; this.MinValue = 16; this.RegulationStep = ERegulationStep.One; this.Unit = EMeasurementUnit.None; this.ValueFont = new STFont(Color.Yellow, 28); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { try { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { string title = (string)InstanceHelper.GetPropertyValue("Title", context.Instance, context.Instance.GetType()); Dictionary <string, KNXSelectedAddress> readAddressId = (Dictionary <string, KNXSelectedAddress>)InstanceHelper.GetPropertyValue("ReadAddressId", context.Instance, context.Instance.GetType()); if (null != readAddressId) { var frm = new FrmGroupAddressPick(); frm.Text = UIResMang.GetString("PropEtsReadAddressId") + " - " + title; frm.MultiSelect = false; frm.PickType = FrmGroupAddressPick.AddressType.Read; frm.SelectedAddress = readAddressId; var result = frm.ShowDialog(); if (result == DialogResult.OK) { //value = frm.SelectedAddress; value = new Dictionary <string, KNXSelectedAddress>(frm.SelectedAddress); } } } } catch (Exception ex) { System.Console.WriteLine("PropertyGridImageEditor Error : " + ex.Message); return(value); } return(value); }
/// <summary> /// 导入ETS项目文件中的 groupaddress /// </summary> private void ImportEtsProject() { try { using (var ofd = new OpenFileDialog()) { ofd.Filter = EtsFilter; ofd.FilterIndex = 1; ofd.DefaultExt = "knxproj"; ofd.RestoreDirectory = true; if (ofd.ShowDialog(this) == DialogResult.OK) { ClearProjTempFolder(); if (Directory.Exists(MyCache.ProjTempFolder)) { this.backWorkerImportEtsProject.RunWorkerAsync(ofd); // 运行 backgroundWorker 组件 importInd = new FrmProgress(this.backWorkerImportEtsProject); importInd.Text = string.Format(UIResMang.GetString("TextIsImporting"), ofd.FileName); importInd.ShowDialog(this); importInd.Close(); } } } } catch (Exception ex) { string errorMsg = UIResMang.GetString("Message17"); MessageBox.Show(errorMsg, UIResMang.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Error(errorMsg + LogHelper.Format(ex)); } }
public virtual object Copy() { ViewNode node = this.Clone() as ViewNode; node.Title = this.Title + UIResMang.GetString("NCopy"); return(node); }
private ToolStripMenuItem CreateGroupByMenuItem() { ToolStripMenuItem tsmiGroup = new ToolStripMenuItem(); tsmiGroup.Text = UIResMang.GetString("GroupBy"); return(tsmiGroup); }
private void MarkSelectedStyle(ToolStripMenuItem SItem) { foreach (ToolStripMenuItem item in this.ViewStyleItems) { item.Image = null; } SItem.Image = UIResMang.GetImage("CheckMark_128"); }
private ToolStripMenuItem CreateRefreshMenuItem() { ToolStripMenuItem tsmiRefresh = new ToolStripMenuItem(); tsmiRefresh.Text = UIResMang.GetString("Refresh"); tsmiRefresh.Click += RefreshMenuItem_Clicked; return(tsmiRefresh); }
private ToolStripMenuItem CreateGroupByNoneMenuItem() { ToolStripMenuItem tsmiGroupByNone = new ToolStripMenuItem(); tsmiGroupByNone.Text = UIResMang.GetString("None"); tsmiGroupByNone.Click += GroupByNoneMenuItem_Clicked; return(tsmiGroupByNone); }
private ToolStripMenuItem CreateLargeIconMenuItem() { ToolStripMenuItem tsmiLargeIcon = new ToolStripMenuItem(); tsmiLargeIcon.Text = UIResMang.GetString("LargeIcon"); tsmiLargeIcon.Click += LargeIconMenuItem_Clicked; return(tsmiLargeIcon); }
private ToolStripMenuItem CreateSmallIconMenuItem() { ToolStripMenuItem tsmiSamllIcon = new ToolStripMenuItem(); tsmiSamllIcon.Text = UIResMang.GetString("SmallIcon"); tsmiSamllIcon.Click += SmallIconMenuItem_Clicked; return(tsmiSamllIcon); }
private ToolStripMenuItem CreateDetailMenuItem() { ToolStripMenuItem tsmiDetail = new ToolStripMenuItem(); tsmiDetail.Text = UIResMang.GetString("Detail"); tsmiDetail.Click += DetailMenuItem_Clicked; return(tsmiDetail); }
private void backgroundWorkerImportOPC_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { LoadAllAddress(); this.importInd.Close(); this.pictureBox.Image = UIResMang.GetImage("Help_32x32"); this.label.Text = UIResMang.GetString("Message43"); }
public FrmGroupAddressPick() { InitializeComponent(); this.cbbFilterType.Items.Insert((int)FilterType.Name, UIResMang.GetString("Name")); this.cbbFilterType.Items.Insert((int)FilterType.GroupAddress, UIResMang.GetString("GroupAddress")); this.cbbFilterType.SelectedIndex = (int)FilterType.Name; SelectedAddress = new Dictionary <string, KNXSelectedAddress>(); }
private ToolStripMenuItem CreateChangeNameMenuItem() { ToolStripMenuItem tsmiChangeNameItem = new ToolStripMenuItem(); tsmiChangeNameItem.Name = "tsmiChangeNameItem"; tsmiChangeNameItem.Size = new Size(100, 22); tsmiChangeNameItem.Text = UIResMang.GetString("ChangeName"); tsmiChangeNameItem.Click += this.ChangeNodeName; return(tsmiChangeNameItem); }
private ToolStripMenuItem CreateDisplayMenuItem() { ToolStripMenuItem tsmiDisplayItem = new ToolStripMenuItem(); tsmiDisplayItem.Name = "tsmiDisplayItem"; tsmiDisplayItem.Size = new Size(100, 22); tsmiDisplayItem.Text = UIResMang.GetString("Display"); tsmiDisplayItem.Click += this.DisplaySelectedNode; return(tsmiDisplayItem); }
private ToolStripMenuItem CreatePropertyMenuItem() { ToolStripMenuItem tsmiPropertyItem = new ToolStripMenuItem(); tsmiPropertyItem.Name = "tsmiPropertyItem"; tsmiPropertyItem.Size = new System.Drawing.Size(100, 22); tsmiPropertyItem.Text = UIResMang.GetString("Property"); tsmiPropertyItem.Click += this.DisplaySelectedNodeProperty; return(tsmiPropertyItem); }
private void SmallIconMenuItem_Clicked(object sender, EventArgs e) { ToolStripMenuItem tsmi = sender as ToolStripMenuItem; tsmi.Image = UIResMang.GetImage("CheckMark_128"); this.SelectedStyleItem = tsmi; MarkSelectedStyle(this.SelectedStyleItem); DisplayAsSamllIcon(MyCache.Templates); }
private void GroupByNoneMenuItem_Clicked(object sender, EventArgs e) { UnmarkSelectedGroupBy(); ToolStripMenuItem tsmi = sender as ToolStripMenuItem; tsmi.Image = UIResMang.GetImage("CheckMark_128"); this.SelectedGroupBy = GroupBy.None; this.SelectedStyleItem.PerformClick(); }
private void btnOk_Click(object sender, EventArgs e) { SetSelectIDs(); if (SelectedAddress.Count > 1 && MultiSelect == false) { MessageBox.Show(UIResMang.GetString("Message21")); this.SelectedAddress.Clear(); } this.DialogResult = DialogResult.OK; }
private ToolStripMenuItem CreateInsertMenuItem() { ToolStripMenuItem tsmiInsertItem = new ToolStripMenuItem(); //tsmiInsertItem.Image = ResourceMng.GetImage("Delete_Control_16x16"); tsmiInsertItem.Name = "tsmiInsertItem"; tsmiInsertItem.Size = new System.Drawing.Size(100, 22); tsmiInsertItem.Text = UIResMang.GetString("Insert"); tsmiInsertItem.Click += this.InsertAtSelectedNode; return(tsmiInsertItem); }
/// <summary> /// 创建右键删除选项 /// </summary> /// <returns></returns> private ToolStripMenuItem CreateDeleteMenuItem() { ToolStripMenuItem tsmiDeleteItem = new ToolStripMenuItem(); tsmiDeleteItem.Image = UIResMang.GetImage("Delete_Control_16x16"); tsmiDeleteItem.Name = "tsmiDeleteItem"; tsmiDeleteItem.Size = new System.Drawing.Size(100, 22); tsmiDeleteItem.Text = UIResMang.GetString("Delete"); tsmiDeleteItem.Click += this.DeleteSelectedNode_Click; return(tsmiDeleteItem); }
/// <summary> /// 创建右键粘贴选项 /// </summary> /// <returns></returns> private ToolStripMenuItem CreatePasteMenuItem() { ToolStripMenuItem tsmiPasteNode = new ToolStripMenuItem(); tsmiPasteNode.Image = UIResMang.GetImage("Paste_16x16"); tsmiPasteNode.Name = "tsmiPasteNode"; tsmiPasteNode.Size = new System.Drawing.Size(152, 22); tsmiPasteNode.Text = UIResMang.GetString("Paste"); tsmiPasteNode.Click += PasteNode_Click; return(tsmiPasteNode); }
private ToolStripMenuItem CreateAddPageMenuItem() { ToolStripMenuItem tsmiAddPageItem = new ToolStripMenuItem(); tsmiAddPageItem.Image = UIResMang.GetImage("Page_16x16"); tsmiAddPageItem.Name = "tsmiAddPageItem"; tsmiAddPageItem.Size = new System.Drawing.Size(152, 22); tsmiAddPageItem.Text = UIResMang.GetString("AddPage"); tsmiAddPageItem.Click += new System.EventHandler(AddPageNode_Click); return(tsmiAddPageItem); }
private void buttonFinish_Click(object sender, EventArgs e) { this.dataGridView.EndEdit(); this.backWorkerSave.RunWorkerAsync(); importInd = new FrmProgress(this.backWorkerSave); importInd.Text = UIResMang.GetString("Importing"); importInd.ShowDialog(this); importInd.Close(); this.DialogResult = DialogResult.OK; this.Close(); }