Esempio n. 1
0
 public formCloudSendSingle(object objData, string pOperation, LedPanelCloud pPanelCloud, bool pOk, LedCmdType pCommand, formMain fmain)
 {
     this.InitializeComponent();
     this.ShowOK     = pOk;
     this.command    = pCommand;
     this.commData   = objData;
     this.operation  = pOperation;
     this.panelCloud = pPanelCloud;
     this.frmMain    = fmain;
     base.Text       = pOperation;
     base.Size       = new System.Drawing.Size(425, 89);
     base.TopMost    = true;
 }
        private bool GetResponse(LedPanel panel, string id)
        {
            bool          flag          = false;
            LedPanelCloud ledPanelCloud = panel as LedPanelCloud;
            DateTime      now           = DateTime.Now;

            while ((DateTime.Now - now).TotalSeconds < 10.0)
            {
                SingleCommandInfo singleCommandInfo = new SingleCommandService().Get(LedGlobal.CloudAccount.SessionID, ledPanelCloud.CloudID, id);
                if (singleCommandInfo != null)
                {
                    byte[] receiveData = singleCommandInfo.ReceiveData;
                    byte[] sendData    = singleCommandInfo.SendData;
                    if (receiveData != null && receiveData.Length > 0 && sendData != null && sendData.Length > 0)
                    {
                        IList <Unpack_Results> list = protocol_single_cmd.Rec_Unpack(receiveData, sendData);
                        if (list != null && list.Count > 0 && list[0].Result_Type == 2 && list[0].Info_Erroneous_Data == info_error_type.Null)
                        {
                            if (list[0].Cmd_Type != LedCmdType.Send_Panel_Parameter)
                            {
                                flag = true;
                                break;
                            }
                            TerminalInfo terminalInfo = new TerminalService().Get(LedGlobal.CloudAccount.SessionID, ledPanelCloud.DeviceID);
                            if (terminalInfo != null && ledPanelCloud.IsEquals(terminalInfo.ToParameterArray()))
                            {
                                flag = true;
                                break;
                            }
                            break;
                        }
                    }
                }
                if (flag)
                {
                    break;
                }
                Thread.Sleep(1000);
            }
            return(flag);
        }
Esempio n. 3
0
        private void LoadTreeView()
        {
            this.tvwPanel.Nodes.Clear();
            LedPanel         selectedPanel = formMain.ledsys.SelectedPanel;
            LedProject       ledsys        = formMain.ledsys;
            IList <LedGroup> groups        = formMain.ledsys.Groups;
            IList <LedPanel> panels        = formMain.ledsys.Panels;
            bool             @checked      = true;
            int i = 0;

            while (i < groups.Count)
            {
                LedGroup ledGroup = groups[i];
                if (this.CloudLogin || ledsys.Cloud.LoginState != LedCloudLoginState.Login || string.IsNullOrEmpty(ledsys.Cloud.Account.UserName) || !(ledsys.Cloud.Account.UserName == ledGroup.Name) || ledGroup.CreationMethod != LedCreationMethod.Cloud)
                {
                    goto IL_115;
                }
                bool flag = false;
                foreach (LedPanel current in ledsys.Panels)
                {
                    if (current.GetType() == typeof(LedPanel) && current.Group == ledGroup.ID)
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    goto IL_115;
                }
IL_5DC:
                i++;
                continue;
IL_115:
                string text = string.Empty;
                bool     flag2    = ledGroup.GetType() == typeof(LedGroupCloud);
                TreeNode treeNode = new TreeNode();
                if (flag2)
                {
                    string           arg              = string.Empty;
                    LedGroupCloud    ledGroupCloud    = (LedGroupCloud)ledGroup;
                    ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
                    int selectedIndex = ledGroupCloud.SelectedIndex;
                    ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(formMain.ML.GetStr("formMain_TreeView_Node_ContextMenuStrip_Item_Cloud_Group_All"));
                    if (selectedIndex == -2)
                    {
                        toolStripMenuItem.Checked = true;
                        arg = toolStripMenuItem.Text;
                    }
                    toolStripMenuItem.Tag    = 0;
                    toolStripMenuItem.Click += new EventHandler(this.tsmiGroupCloud_Click);
                    contextMenuStrip.Items.Add(toolStripMenuItem);
                    ToolStripSeparator value = new ToolStripSeparator();
                    contextMenuStrip.Items.Add(value);
                    ToolStripMenuItem toolStripMenuItem2 = new ToolStripMenuItem(formMain.ML.GetStr("formMain_TreeView_Node_ContextMenuStrip_Item_Cloud_Group_Ungroup"));
                    if (selectedIndex == -1)
                    {
                        toolStripMenuItem2.Checked = true;
                        arg  = toolStripMenuItem2.Text;
                        text = ledGroupCloud.ID;
                    }
                    toolStripMenuItem2.Tag    = ledGroupCloud.ID;
                    toolStripMenuItem2.Click += new EventHandler(this.tsmiGroupCloud_Click);
                    contextMenuStrip.Items.Add(toolStripMenuItem2);
                    ToolStripSeparator value2 = new ToolStripSeparator();
                    contextMenuStrip.Items.Add(value2);
                    if (ledGroupCloud.Subgroups != null)
                    {
                        int num = 0;
                        foreach (LedGroup current2 in ledGroupCloud.Subgroups)
                        {
                            ToolStripMenuItem toolStripMenuItem3 = new ToolStripMenuItem(current2.Name);
                            if (selectedIndex == num)
                            {
                                toolStripMenuItem3.Checked = true;
                                arg  = toolStripMenuItem3.Text;
                                text = current2.ID;
                            }
                            toolStripMenuItem3.Tag    = current2.ID;
                            toolStripMenuItem3.Click += new EventHandler(this.tsmiGroupCloud_Click);
                            contextMenuStrip.Items.Add(toolStripMenuItem3);
                            num++;
                        }
                    }
                    treeNode.Text             = string.Format("{0}({1})", ledGroup.Name, arg);
                    treeNode.ContextMenuStrip = contextMenuStrip;
                }
                else
                {
                    treeNode.Text = ledGroup.Name;
                    text          = ledGroup.ID;
                }
                treeNode.ImageIndex         = 0;
                treeNode.SelectedImageIndex = 0;
                treeNode.Tag     = ledGroup;
                treeNode.Checked = true;
                bool flag3 = false;
                foreach (LedPanel current3 in panels)
                {
                    if ((this.CloudLogin || !(current3.GetType() == typeof(LedPanelCloud))) && selectedPanel != null && selectedPanel.Width == current3.Width && selectedPanel.Height == current3.Height && selectedPanel.ColorMode == current3.ColorMode && (this.mode <= ExecuteMode.CopyItem || !(selectedPanel.ID == current3.ID)))
                    {
                        bool flag4 = false;
                        if (flag2)
                        {
                            if (current3.GetType() != typeof(LedPanelCloud))
                            {
                                continue;
                            }
                            LedPanelCloud ledPanelCloud = (LedPanelCloud)current3;
                            flag3 = true;
                            if (string.IsNullOrEmpty(text) || ledPanelCloud.Group.Contains(text))
                            {
                                flag4 = true;
                            }
                        }
                        else
                        {
                            if (current3.GetType() != typeof(LedPanel))
                            {
                                continue;
                            }
                            if (text.Equals(current3.Group))
                            {
                                flag4 = true;
                            }
                        }
                        if (flag4)
                        {
                            TreeNode treeNode2 = new TreeNode(current3.TextName);
                            if (current3.State == LedPanelState.Online)
                            {
                                treeNode2.ImageIndex         = 1;
                                treeNode2.SelectedImageIndex = 1;
                                if ((current3.PortType == LedPortType.Ethernet && (current3.EthernetCommunicaitonMode == LedEthernetCommunicationMode.LocalServer || current3.EthernetCommunicaitonMode == LedEthernetCommunicationMode.CloudServer)) || (current3.PortType == LedPortType.GPRS && current3.GPRSCommunicaitonMode == LedGPRSCommunicationMode.CloudServer))
                                {
                                    treeNode2.Text = formMain.ML.GetStr("formMain_TreeView_Node_Prefix_Online") + current3.TextName;
                                }
                            }
                            else
                            {
                                treeNode2.ImageIndex         = 2;
                                treeNode2.SelectedImageIndex = 2;
                                if ((current3.PortType == LedPortType.Ethernet && (current3.EthernetCommunicaitonMode == LedEthernetCommunicationMode.LocalServer || current3.EthernetCommunicaitonMode == LedEthernetCommunicationMode.CloudServer)) || (current3.PortType == LedPortType.GPRS && current3.GPRSCommunicaitonMode == LedGPRSCommunicationMode.CloudServer))
                                {
                                    treeNode2.Text = formMain.ML.GetStr("formMain_TreeView_Node_Prefix_Offline") + current3.TextName;
                                }
                            }
                            treeNode2.Checked = true;
                            treeNode2.Tag     = current3;
                            treeNode.Nodes.Add(treeNode2);
                        }
                    }
                }
                if (treeNode.Nodes.Count == 0)
                {
                    treeNode.Checked = false;
                    @checked         = false;
                }
                if ((treeNode.Nodes != null && treeNode.Nodes.Count > 0) || flag3)
                {
                    this.tvwPanel.Nodes.Add(treeNode);
                    goto IL_5DC;
                }
                goto IL_5DC;
            }
            if (this.tvwPanel.Nodes.Count == 0)
            {
                @checked = false;
            }
            this.chkSelectAll.Checked = @checked;
            this.tvwPanel.ExpandAll();
        }
Esempio n. 4
0
        private void tsmiGroupCloud_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = this.tvwPanel.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }
            ToolStripMenuItem toolStripMenuItem = (ToolStripMenuItem)sender;

            if (toolStripMenuItem.Checked)
            {
                return;
            }
            if (selectedNode.Tag.GetType() != typeof(LedGroupCloud))
            {
                return;
            }
            LedGroupCloud ledGroupCloud = (LedGroupCloud)selectedNode.Tag;
            string        text          = string.Empty;

            if (toolStripMenuItem.Tag != null)
            {
                string text2 = toolStripMenuItem.Tag.ToString();
                if (text2 != "0")
                {
                    text = text2;
                }
            }
            bool flag = true;

            selectedNode.Nodes.Clear();
            LedPanel selectedPanel = formMain.ledsys.SelectedPanel;

            foreach (LedPanel current in formMain.ledsys.Panels)
            {
                if (!(current.GetType() != typeof(LedPanelCloud)) && selectedPanel != null && selectedPanel.Width == current.Width && selectedPanel.Height == current.Height && selectedPanel.ColorMode == current.ColorMode && (this.mode <= ExecuteMode.CopyItem || !(selectedPanel.ID == current.ID)))
                {
                    LedPanelCloud ledPanelCloud = (LedPanelCloud)current;
                    if (string.IsNullOrEmpty(text) || ledPanelCloud.Group.Contains(text))
                    {
                        TreeNode treeNode = new TreeNode(ledPanelCloud.TextName);
                        if (ledPanelCloud.State == LedPanelState.Online)
                        {
                            treeNode.ImageIndex         = 1;
                            treeNode.SelectedImageIndex = 1;
                            if ((current.PortType == LedPortType.Ethernet && current.EthernetCommunicaitonMode == LedEthernetCommunicationMode.CloudServer) || (current.PortType == LedPortType.GPRS && current.GPRSCommunicaitonMode == LedGPRSCommunicationMode.CloudServer))
                            {
                                treeNode.Text = formMain.ML.GetStr("formMain_TreeView_Node_Prefix_Online") + ledPanelCloud.TextName;
                            }
                        }
                        else
                        {
                            treeNode.ImageIndex         = 2;
                            treeNode.SelectedImageIndex = 2;
                            if ((current.PortType == LedPortType.Ethernet && current.EthernetCommunicaitonMode == LedEthernetCommunicationMode.CloudServer) || (current.PortType == LedPortType.GPRS && current.GPRSCommunicaitonMode == LedGPRSCommunicationMode.CloudServer))
                            {
                                treeNode.Text = formMain.ML.GetStr("formMain_TreeView_Node_Prefix_Offline") + ledPanelCloud.TextName;
                            }
                        }
                        treeNode.Checked = true;
                        treeNode.Tag     = ledPanelCloud;
                        selectedNode.Nodes.Add(treeNode);
                    }
                }
            }
            ContextMenuStrip contextMenuStrip = selectedNode.ContextMenuStrip;

            if (contextMenuStrip != null)
            {
                foreach (ToolStripItem toolStripItem in contextMenuStrip.Items)
                {
                    if (toolStripItem.GetType() == typeof(ToolStripMenuItem))
                    {
                        ((ToolStripMenuItem)toolStripItem).Checked = false;
                    }
                }
            }
            toolStripMenuItem.Checked = true;
            if (selectedNode.Nodes.Count == 0)
            {
                flag = false;
            }
            selectedNode.Checked = flag;
            selectedNode.Text    = string.Format("{0}({1})", ledGroupCloud.Name, toolStripMenuItem.Text);
            selectedNode.Expand();
            if (flag && this.tvwPanel.Nodes != null && this.tvwPanel.Nodes.Count > 0)
            {
                foreach (TreeNode treeNode2 in this.tvwPanel.Nodes)
                {
                    if (treeNode2 != selectedNode && treeNode2.Nodes != null)
                    {
                        foreach (TreeNode treeNode3 in treeNode2.Nodes)
                        {
                            if (!treeNode3.Checked)
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (!flag)
                        {
                            break;
                        }
                    }
                }
            }
            this.chkSelectAll.Checked = flag;
        }
        private void LoadTreeView()
        {
            this.tvwPanel.Nodes.Clear();
            IList <LedGroup> groups   = formMain.ledsys.Groups;
            IList <LedPanel> panels   = formMain.ledsys.Panels;
            bool             @checked = this.rdoLocal.Checked;
            bool             checked2 = true;
            int i = 0;

            while (i < groups.Count)
            {
                LedGroup ledGroup = groups[i];
                string   text     = string.Empty;
                bool     flag     = ledGroup.GetType() == typeof(LedGroupCloud);
                if (@checked)
                {
                    if (!flag)
                    {
                        goto IL_82;
                    }
                }
                else if (flag)
                {
                    goto IL_82;
                }
IL_558:
                i++;
                continue;
IL_82:
                TreeNode treeNode = new TreeNode();
                if (flag)
                {
                    string           arg              = string.Empty;
                    LedGroupCloud    ledGroupCloud    = (LedGroupCloud)ledGroup;
                    ContextMenuStrip contextMenuStrip = new ContextMenuStrip();
                    int selectedIndex = ledGroupCloud.SelectedIndex;
                    ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem(formMain.ML.GetStr("formMain_TreeView_Node_ContextMenuStrip_Item_Cloud_Group_All"));
                    if (selectedIndex == -2)
                    {
                        toolStripMenuItem.Checked = true;
                        arg = toolStripMenuItem.Text;
                    }
                    toolStripMenuItem.Tag    = 0;
                    toolStripMenuItem.Click += new EventHandler(this.tsmiGroupCloud_Click);
                    contextMenuStrip.Items.Add(toolStripMenuItem);
                    ToolStripSeparator value = new ToolStripSeparator();
                    contextMenuStrip.Items.Add(value);
                    ToolStripMenuItem toolStripMenuItem2 = new ToolStripMenuItem(formMain.ML.GetStr("formMain_TreeView_Node_ContextMenuStrip_Item_Cloud_Group_Ungroup"));
                    if (selectedIndex == -1)
                    {
                        toolStripMenuItem2.Checked = true;
                        arg  = toolStripMenuItem2.Text;
                        text = ledGroupCloud.ID;
                    }
                    toolStripMenuItem2.Tag    = ledGroupCloud.ID;
                    toolStripMenuItem2.Click += new EventHandler(this.tsmiGroupCloud_Click);
                    contextMenuStrip.Items.Add(toolStripMenuItem2);
                    ToolStripSeparator value2 = new ToolStripSeparator();
                    contextMenuStrip.Items.Add(value2);
                    if (ledGroupCloud.Subgroups != null)
                    {
                        int num = 0;
                        foreach (LedGroup current in ledGroupCloud.Subgroups)
                        {
                            ToolStripMenuItem toolStripMenuItem3 = new ToolStripMenuItem(current.Name);
                            if (selectedIndex == num)
                            {
                                toolStripMenuItem3.Checked = true;
                                arg  = toolStripMenuItem3.Text;
                                text = current.ID;
                            }
                            toolStripMenuItem3.Tag    = current.ID;
                            toolStripMenuItem3.Click += new EventHandler(this.tsmiGroupCloud_Click);
                            contextMenuStrip.Items.Add(toolStripMenuItem3);
                            num++;
                        }
                    }
                    treeNode.Text             = string.Format("{0}({1})", ledGroup.Name, arg);
                    treeNode.ContextMenuStrip = contextMenuStrip;
                }
                else
                {
                    treeNode.Text = ledGroup.Name;
                    text          = ledGroup.ID;
                }
                treeNode.ImageIndex         = 0;
                treeNode.SelectedImageIndex = 0;
                treeNode.Tag     = ledGroup;
                treeNode.Checked = true;
                foreach (LedPanel current2 in panels)
                {
                    if (current2.PortType != LedPortType.USB && (current2.PortType != LedPortType.GPRS || (current2.GPRSCommunicaitonMode != LedGPRSCommunicationMode.GprsServer && !@checked && !(current2.GetType() == typeof(LedPanel)) && this.IsCloudLogin)))
                    {
                        if (current2.PortType == LedPortType.Ethernet)
                        {
                            if (current2.EthernetCommunicaitonMode == LedEthernetCommunicationMode.CloudServer)
                            {
                                if (current2.GetType() == typeof(LedPanel) || @checked)
                                {
                                    continue;
                                }
                                if (!this.IsCloudLogin)
                                {
                                    continue;
                                }
                            }
                            else if (!@checked)
                            {
                                continue;
                            }
                        }
                        bool flag2 = false;
                        if (flag)
                        {
                            if (current2.GetType() != typeof(LedPanelCloud))
                            {
                                continue;
                            }
                            LedPanelCloud ledPanelCloud = (LedPanelCloud)current2;
                            if (string.IsNullOrEmpty(text) || ledPanelCloud.Group.Contains(text))
                            {
                                flag2 = true;
                            }
                        }
                        else
                        {
                            if (current2.GetType() != typeof(LedPanel))
                            {
                                continue;
                            }
                            if (text.Equals(current2.Group))
                            {
                                flag2 = true;
                            }
                        }
                        if (flag2)
                        {
                            TreeNode treeNode2 = new TreeNode(current2.TextName);
                            if (current2.State == LedPanelState.Online)
                            {
                                treeNode2.ImageIndex         = 1;
                                treeNode2.SelectedImageIndex = 1;
                                treeNode2.Checked            = true;
                                if ((current2.PortType == LedPortType.Ethernet && current2.EthernetCommunicaitonMode == LedEthernetCommunicationMode.LocalServer) || (current2.GetType() == typeof(LedPanelCloud) && (current2.EthernetCommunicaitonMode == LedEthernetCommunicationMode.CloudServer || (current2.PortType == LedPortType.GPRS && current2.GPRSCommunicaitonMode == LedGPRSCommunicationMode.CloudServer))))
                                {
                                    treeNode2.Text = formMain.ML.GetStr("formMain_TreeView_Node_Prefix_Online") + current2.TextName;
                                }
                            }
                            else
                            {
                                treeNode2.ImageIndex         = 2;
                                treeNode2.SelectedImageIndex = 2;
                                treeNode2.Checked            = false;
                                checked2 = false;
                                if ((current2.PortType == LedPortType.Ethernet && current2.EthernetCommunicaitonMode == LedEthernetCommunicationMode.LocalServer) || (current2.GetType() == typeof(LedPanelCloud) && (current2.EthernetCommunicaitonMode == LedEthernetCommunicationMode.CloudServer || (current2.PortType == LedPortType.GPRS && current2.GPRSCommunicaitonMode == LedGPRSCommunicationMode.CloudServer))))
                                {
                                    treeNode2.Text = formMain.ML.GetStr("formMain_TreeView_Node_Prefix_Offline") + current2.TextName;
                                }
                            }
                            treeNode2.Tag = current2;
                            treeNode.Nodes.Add(treeNode2);
                        }
                    }
                }
                if (treeNode.Nodes != null && treeNode.Nodes.Count > 0)
                {
                    this.tvwPanel.Nodes.Add(treeNode);
                    goto IL_558;
                }
                goto IL_558;
            }
            if (this.tvwPanel.Nodes.Count == 0)
            {
                checked2 = false;
            }
            this.checkBox_selectedall.Checked = checked2;
            this.tvwPanel.ExpandAll();
        }