Example #1
0
        static void Reload()
        {
            ProductDataBase.Load("Products.xml");
            if (System.IO.File.Exists("project.xml"))
            {
                XElement project = XElement.Load("project.xml");
                SynergySequence.SequenceManager sequencemanager = new ComputerSequenceManager();

                DesktopCodeBlocks.DesktopCodeBlock.AddAllPrototypes(sequencemanager);

                sequencemanager.AddDataType(new SequenceManager.DataType("int", System.Drawing.Color.Blue));
                sequencemanager.AddDataType(new SequenceManager.DataType("bool", System.Drawing.Color.Green));

                DesktopClient.sequence = new DesktopSequence();
                DesktopClient.sequence.Manager = sequencemanager;
                DesktopClient.sequence.Load(project.Element("Sequence"));
                DesktopClient.MainStation = null;
                if (project.Element("MainStation") != null)
                {
                    DesktopClient.MainStation = new MainStation.MainStation();
                    DesktopClient.MainStation.Load(project.Element("MainStation"));
                    MainStation.MainStation.Connect();
                    byte[] data = MainStation.MainStationCompiler.Compile(DesktopClient.MainStation);

                    if (MainStation.MainStation.EEPROMWriteVerify(data))
                        tray.ShowBalloonTip(1000, "", "MainStation updated", ToolTipIcon.None);
                    else
                        tray.ShowBalloonTip(1000, "", "Failed to update mainstation", ToolTipIcon.None);
                }

                foreach (WebInterface.WebInterface i in WebInterface.WebInterface.WebInterfaces)
                {
                    i.Stop();
                }

                WebInterface.WebInterface.WebInterfaces.Clear();
                foreach (XElement element in project.Elements("WebInterface"))
                {
                    WebInterface.WebInterface wi = new WebInterface.WebInterface(element);
                    wi.Start();
                    WebInterface.WebInterface.WebInterfaces.Add(wi);
                }
            }
        }
Example #2
0
        public TreeNode GetTreeNode(WebInterface.Scene _Scene)
        {
            int icon = (int)MainWindow.Icons.WebInterface;
            TreeNode node = new TreeNode(_Scene.Name, icon, icon);
            node.Tag = _Scene;

            return node;
        }
Example #3
0
 static void UpdateControl(WebInterface.Control _Control)
 {
     if (_Control is WebInterface.Switch)
     {
         WebInterface.Switch sw = (WebInterface.Switch)_Control;
         while (sw.CommandsPending())
         {
             WebInterface.Switch.Command command = sw.DequeueCommand();
             foreach (CodeBlock b in DesktopClient.sequence.CodeBlocks)
             {
                 if (b is BlockEventSwitchToggle && ((BlockEventSwitchToggle)b).SwitchName.ToLower() == _Control.Name.ToLower())
                 {
                     new DesktopSequence.Event((DesktopCodeBlock)b).Invoke();
                 }
             }
             //FIXME no event found for pressed button
         }
         sw.Loading = false;
     }
 }
Example #4
0
 public TreeNode GetTreeNode(WebInterface.WebInterface _WebInterface)
 {
     int icon = (int)MainWindow.Icons.WebInterface;
     TreeNode node = new TreeNode("Web interface", icon, icon);
     node.Tag = _WebInterface;
     foreach (Scene s in _WebInterface.scenes)
     {
         node.Nodes.Add(GetTreeNode(s));
     }
     return node;
 }