private void NewAddress() { var frm = new FrmGroupAddress(DataStatus.Add) { Address = new EdGroupAddress() }; var dlgResult = frm.ShowDialog(this); if (dlgResult == DialogResult.OK) { // 当前地址了列表是否为空 if (MyCache.GroupAddressTable != null) { // 判断地址是否冲突 if (CheckUnique(MyCache.GroupAddressTable, frm.Address) == true) { MyCache.GroupAddressTable.Add(frm.Address); //dgvGroupAddress.DataSource = MyCache.GroupAddressTable; LoadAllAddress(); //Changed = true; } else { MessageBox.Show(ResourceMng.GetString("Message19"), ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void OpenGroupAddressMgr() { try { var formName = typeof(FrmGroupAddressMgt).Name; if (Application.OpenForms[formName] != null) { var frm = Application.OpenForms[formName]; frm.WindowState = FormWindowState.Normal; frm.Activate(); } else { var frm = new FrmGroupAddressMgt(); //frm.Show(); frm.ShowDialog(); } } catch (Exception ex) { string errorMsg = ResourceMng.GetString("Message12"); MessageBox.Show(errorMsg, ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Error(errorMsg + LogHelper.Format(ex)); } }
public override object Clone() { ViewNode node = base.Clone() as ViewNode; node.Text = this.Text + " " + ResourceMng.GetString("NCopy"); node.Id = GenId(); node.X = this.X; node.Y = this.Y; node.Width = this.Width; node.Height = this.Height; //node.Location = this.Location; //node.Size = this.Size; node.DisplayBorder = this.DisplayBorder; node.BorderColor = this.BorderColor; node.Alpha = this.Alpha; node.Radius = this.Radius; node.FlatStyle = this.FlatStyle; node.BackgroundColor = this.BackgroundColor; node.BackgroundImage = this.BackgroundImage; node.FontColor = this.FontColor; node.FontSize = this.FontSize; node.State = ControlState.Normal; return(node); }
public static TreeNode GetActionNode() { ScalingNode nodeAction = new ScalingNode(); nodeAction.Text = nodeAction.KNXMainNumber + "." + nodeAction.KNXSubNumber + " " + nodeAction.Name; DatapointActionNode actionAdjustTo30per = new DatapointActionNode(); actionAdjustTo30per.Name = actionAdjustTo30per.Text = ResourceMng.GetString("AdjustTo30per"); actionAdjustTo30per.Value = 76; DatapointActionNode actionAdjustTo60per = new DatapointActionNode(); actionAdjustTo60per.Name = actionAdjustTo60per.Text = ResourceMng.GetString("AdjustTo60per"); actionAdjustTo60per.Value = 153; DatapointActionNode actionAdjustTo90per = new DatapointActionNode(); actionAdjustTo90per.Name = actionAdjustTo90per.Text = ResourceMng.GetString("AdjustTo90per"); actionAdjustTo90per.Value = 229; nodeAction.Nodes.Add(actionAdjustTo30per); nodeAction.Nodes.Add(actionAdjustTo60per); nodeAction.Nodes.Add(actionAdjustTo90per); return(nodeAction); }
private bool SaveKnxUiProject(string fileName) { Cursor = Cursors.WaitCursor; bool result = false; try { VersionStorage.Save(); // 保存项目文件的版本信息。 this.ucdo.SaveNode(); // 保存界面到JSON文件 GroupAddressStorage.Save(); // 保存组地址到JSON文件 // 是否指定了项目文件名 if (fileName == MyConst.DefaultKnxUiProjectName) { var myDialog = new SaveFileDialog(); myDialog.InitialDirectory = MyCache.DefaultKnxProjectFolder; myDialog.OverwritePrompt = true; myDialog.FileName = MyConst.DefaultKnxUiProjectName; myDialog.DefaultExt = MyConst.KnxUiEditorFileExt; myDialog.Filter = KnxFilter; myDialog.FilterIndex = 1; myDialog.RestoreDirectory = true; var myResult = myDialog.ShowDialog(this); if (DialogResult.OK == myResult) { ProjectFile = myDialog.FileName; ZipProject(this.ProjectFile); result = true; } } else { ZipProject(this.ProjectFile); result = true; } } catch (Exception ex) { string errorMsg = ResourceMng.GetString("Message5") + " " + "exception message: " + ex.Message; MessageBox.Show(errorMsg, ResourceMng.GetString("Message6"), MessageBoxButtons.OK, MessageBoxIcon.Error); Log.Error(errorMsg + LogHelper.Format(ex)); } finally { Cursor = Cursors.Default; } if (result) // 保存成功 { ProjectSaved(); } return(result); }
private ToolStripMenuItem CreateCloseOthersMenuItem() { ToolStripMenuItem tsmiCloseOthersItem = new ToolStripMenuItem(); tsmiCloseOthersItem.Name = "tsmiCloseOthersItem"; //tsmiCloseOthersItem.Size = new System.Drawing.Size(100, 22); tsmiCloseOthersItem.Text = ResourceMng.GetString("CloseOthers"); tsmiCloseOthersItem.Click += new System.EventHandler(CloseOthersTabPage_Click); return(tsmiCloseOthersItem); }
public LabelNode() { index++; this.Text = ResourceMng.GetString("TextLabel") + "_" + index; this.Name = ImageKey = SelectedImageKey = MyConst.Controls.KnxLabelType; this.Width = 150; this.Height = 35; //this.Size = new Size(150, 35); this.Clickable = EBool.No; }
public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) { PropertyDescriptorCollection collection = TypeDescriptor.GetProperties(value, true); List <PropertyDescriptor> list = new List <PropertyDescriptor>(); STControlPropertyDescriptor propText = new STControlPropertyDescriptor(collection["Text"]); propText.SetCategory(ResourceMng.GetString("CategoryAppearance")); propText.SetDisplayName(ResourceMng.GetString("PropText")); propText.SetDescription(ResourceMng.GetString("DescriptionForPropText")); list.Add(propText); STControlPropertyDescriptor PropWidth = new STControlPropertyDescriptor(collection["Width"]); PropWidth.SetCategory(ResourceMng.GetString("CategoryLayout")); PropWidth.SetDisplayName(ResourceMng.GetString("PropWidth")); PropWidth.SetDescription(ResourceMng.GetString("")); list.Add(PropWidth); STControlPropertyDescriptor PropHeight = new STControlPropertyDescriptor(collection["Height"]); PropHeight.SetCategory(ResourceMng.GetString("CategoryLayout")); PropHeight.SetDisplayName(ResourceMng.GetString("PropHeight")); PropHeight.SetDescription(ResourceMng.GetString("")); list.Add(PropHeight); //STControlPropertyDescriptor PropSize = new STControlPropertyDescriptor(collection["Size"]); //PropSize.SetCategory(ResourceMng.GetString("CategoryLayout")); //PropSize.SetDisplayName(ResourceMng.GetString("PropSize")); //PropSize.SetDescription(ResourceMng.GetString("")); //list.Add(PropSize); STControlPropertyDescriptor PropBackColor = new STControlPropertyDescriptor(collection["BackgroundColor"]); PropBackColor.SetCategory(ResourceMng.GetString("")); PropBackColor.SetDisplayName(ResourceMng.GetString("PropBackColor")); PropBackColor.SetDescription(ResourceMng.GetString("")); list.Add(PropBackColor); STControlPropertyDescriptor PropBackgroundImage = new STControlPropertyDescriptor(collection["BackgroundImage"]); PropBackgroundImage.SetCategory(ResourceMng.GetString("")); PropBackgroundImage.SetDisplayName(ResourceMng.GetString("PropBackgroundImage")); PropBackgroundImage.SetDescription(ResourceMng.GetString("")); list.Add(PropBackgroundImage); return(new PropertyDescriptorCollection(list.ToArray())); }
/// <summary> /// 窗口关闭时,提示用户保存修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FrmMgrGroupAddresses_FormClosing(object sender, FormClosingEventArgs e) { //WriteToDatasource(); // 当前数据有没有保存 if (this.Changed) { var result = MessageBox.Show(ResourceMng.GetString("Message20"), ResourceMng.GetString("Message4"), MessageBoxButtons.YesNoCancel); if (result == DialogResult.Yes) { SaveAddressList(); } else if (result == DialogResult.Cancel) { e.Cancel = true; } } }
private void NewKnxUiProject() { if (Saved == false /* && this.tvwAppdata.Nodes.Count > 0*/) { var result = MessageBox.Show(ResourceMng.GetString("Message7"), ResourceMng.GetString("Message4"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { SaveKnxUiProject(ProjectFile); } else if (DialogResult.No == result) { AddAppNode(); } } else { AddAppNode(); } }