コード例 #1
0
 private void BTN_Import_Click(object sender, EventArgs e)
 {
     try
     {
         PAN_Relational.Controls.Clear();
         this.selectedChild     = null;
         this.selectedContainer = null;
         string extractedMessage = TB_Import.Text.ToUpper().Replace(".", "").Replace(",", "").Replace("'", "");
         if (extractedMessage.Contains("WIDE"))
         {
             extractedMessage = LUAtoMQTT(extractedMessage);
         }
         string mes = "";
         try
         {
             mes = extractedMessage.Substring(extractedMessage.IndexOf("FE010001"));
         }
         catch
         {
             if (extractedMessage.IndexOf("900580") >= 0)
             {
                 mes = "FE010001FD020001" + extractedMessage.Substring(extractedMessage.IndexOf("900580") + 10) + "FE010002FD020001";
             }
         }
         updateValues = false;
         ParseImportMessage(mes);
         updateValues = true;
     }
     catch
     {
         MessageBox.Show("Specified input is not a recognized relational cycle.");
     }
 }
コード例 #2
0
        public RelationalBuilder2(SymbIOT p, List <KeyValue> kv)
        {
            InitializeComponent();
            parent            = p;
            keyValues         = kv;
            activeLB          = null;
            selectedChild     = null;
            selectedContainer = null;
            relationalTypes   = new List <KeyValue>();
            RelationalID      = "FD020001";
            scrollpos         = PAN_Relational.VerticalScroll.Value;
            numContainers     = 0;

            BTN_Swap.Visible = parent.dm_name == "Cooking";

            AddGroupBox(0, "Presets");

            AddGroupBox(PAN_Keys.Controls.Count, "Recent");

            LoadLBs(CB_FullDM.Checked);

            if (!File.Exists("SymbIOT_Presets.xml"))
            {
                // Create a file to write to.
                using (StreamWriter sw = File.CreateText("SymbIOT_Presets.xml"))
                {
                    sw.WriteLine(Properties.Resources.SymbIOT_Presets);
                }
            }

            LoadXML();
        }
コード例 #3
0
        private void AddToPanel(Panel pan, string kvp, string val)
        {
            KeyValue inkey = null;

            try
            {
                foreach (KeyValue k in keyValues)
                {
                    if (kvp.Contains("0x" + k.KeyID))
                    {
                        inkey = k;
                        break;
                    }
                }
                if (inkey.isSet || pan == PAN_Recv)
                {
                    RelationalItem2 rel = new RelationalItem2(inkey, this, pan, val, true);
                    pan.Controls.Add(rel);
                    foreach (RelationalItem2 r in pan.Controls)
                    {
                        r.Top = r.Height * pan.Controls.GetChildIndex(r);
                    }
                }
                else
                {
                    MessageBox.Show("Selected key is read-only and cannot be sent in a command.");
                }
            }
            catch
            {
                MessageBox.Show("No key selected.");
            }
        }
コード例 #4
0
ファイル: RelationalContainer.cs プロジェクト: abmantis/InDev
        public void AddKey(KeyValue kv, string val)
        {
            RelationalItem2 ri = new RelationalItem2(kv, this, topParent, val);

            if (kv.Instance.Contains("Upper"))
            {
                foreach (KeyValue k in this.topParent.keyValues)
                {
                    if (k.Instance.Contains("Lower") && k.AttributeName == kv.AttributeName)
                    {
                        ri.SetAltCavityKV(k, true);
                    }
                }
            }
            if (kv.Instance.Contains("Lower"))
            {
                foreach (KeyValue k in this.topParent.keyValues)
                {
                    if (k.Instance.Contains("Upper") && k.AttributeName == kv.AttributeName)
                    {
                        ri.SetAltCavityKV(k, false);
                    }
                }
            }
            this.Controls.Add(ri);
            int index = selectedChild == null ? this.Controls.Count - 2 : this.Controls.GetChildIndex(selectedChild) + 1;

            this.Controls.SetChildIndex(ri, index);
            this.topParent.ClearAllSelected();
            ri.SetSelected(true);
            RefreshSize();
        }
コード例 #5
0
        public void RefreshArrayCount()
        {
            arrayCount = 0;
            foreach (RelationalContainer rc in PAN_Relational.Controls)
            {
                rc.UpdateCount(updateValues);
            }

            BTN_Envelope.Enabled = PAN_Relational.Controls.Count == 0 ? true : false;
            BTN_Array.Enabled    = PAN_Relational.Controls.Count == 0 ? false : true;
            BTN_Entity.Enabled   = PAN_Relational.Controls.Count == 0 ? false : true;
            RefreshPresets();
            if (BTN_Envelope.Enabled)
            {
                this.selectedChild     = null;
                this.selectedContainer = null;
            }
        }
コード例 #6
0
ファイル: RelationalContainer.cs プロジェクト: abmantis/InDev
        public RelationalContainer(KeyValue openKey, KeyValue closeKey, Control parent, RelationalBuilder2 topparent, int lev, string val)
        {
            InitializeComponent();
            selectedChild  = null;
            this.parent    = parent;
            this.topParent = topparent;
            this.Level     = lev;
            arrayCount     = 0;
            RelationalItem2 ri = new RelationalItem2(openKey, this, topparent, val);

            this.Controls.Add(ri);
            RelationalItem2 ri2 = new RelationalItem2(closeKey, this, topparent, val);

            this.Controls.Add(ri2);
            // this.topParent.ClearAllSelected();
            //ri.SetSelected(true);
            RefreshSize();
            Value = val;
        }