Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        /// <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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        /// <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));
            }
        }
Ejemplo n.º 10
0
        public virtual object Copy()
        {
            ViewNode node = this.Clone() as ViewNode;

            node.Title = this.Title + UIResMang.GetString("NCopy");

            return(node);
        }
Ejemplo n.º 11
0
        private ToolStripMenuItem CreateGroupByMenuItem()
        {
            ToolStripMenuItem tsmiGroup = new ToolStripMenuItem();

            tsmiGroup.Text = UIResMang.GetString("GroupBy");

            return(tsmiGroup);
        }
Ejemplo n.º 12
0
        private void MarkSelectedStyle(ToolStripMenuItem SItem)
        {
            foreach (ToolStripMenuItem item in this.ViewStyleItems)
            {
                item.Image = null;
            }

            SItem.Image = UIResMang.GetImage("CheckMark_128");
        }
Ejemplo n.º 13
0
        private ToolStripMenuItem CreateRefreshMenuItem()
        {
            ToolStripMenuItem tsmiRefresh = new ToolStripMenuItem();

            tsmiRefresh.Text   = UIResMang.GetString("Refresh");
            tsmiRefresh.Click += RefreshMenuItem_Clicked;

            return(tsmiRefresh);
        }
Ejemplo n.º 14
0
        private ToolStripMenuItem CreateGroupByNoneMenuItem()
        {
            ToolStripMenuItem tsmiGroupByNone = new ToolStripMenuItem();

            tsmiGroupByNone.Text   = UIResMang.GetString("None");
            tsmiGroupByNone.Click += GroupByNoneMenuItem_Clicked;

            return(tsmiGroupByNone);
        }
Ejemplo n.º 15
0
        private ToolStripMenuItem CreateLargeIconMenuItem()
        {
            ToolStripMenuItem tsmiLargeIcon = new ToolStripMenuItem();

            tsmiLargeIcon.Text   = UIResMang.GetString("LargeIcon");
            tsmiLargeIcon.Click += LargeIconMenuItem_Clicked;

            return(tsmiLargeIcon);
        }
Ejemplo n.º 16
0
        private ToolStripMenuItem CreateSmallIconMenuItem()
        {
            ToolStripMenuItem tsmiSamllIcon = new ToolStripMenuItem();

            tsmiSamllIcon.Text   = UIResMang.GetString("SmallIcon");
            tsmiSamllIcon.Click += SmallIconMenuItem_Clicked;

            return(tsmiSamllIcon);
        }
Ejemplo n.º 17
0
        private ToolStripMenuItem CreateDetailMenuItem()
        {
            ToolStripMenuItem tsmiDetail = new ToolStripMenuItem();

            tsmiDetail.Text   = UIResMang.GetString("Detail");
            tsmiDetail.Click += DetailMenuItem_Clicked;

            return(tsmiDetail);
        }
Ejemplo n.º 18
0
        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");
        }
Ejemplo n.º 19
0
        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>();
        }
Ejemplo n.º 20
0
        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);
        }
Ejemplo n.º 21
0
        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);
        }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
        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);
        }
Ejemplo n.º 24
0
        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();
        }
Ejemplo n.º 25
0
        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;
        }
Ejemplo n.º 26
0
        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);
        }
Ejemplo n.º 27
0
        /// <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);
        }
Ejemplo n.º 28
0
        /// <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);
        }
Ejemplo n.º 29
0
        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);
        }
Ejemplo n.º 30
0
        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();
        }