예제 #1
0
        private void RemoveSystem(string name)
        {
            ControlVseSystem vseSys = _vseSystems.GetByName(name);

            if (vseSys != null)
            {
                _vseSystems.Remove(vseSys);
                tabControl1.TabPages.Remove((TD.SandDock.TabPage)vseSys.Parent);
            }
        }
예제 #2
0
        private void OpenSystem(object obj)
        {
            UdpMessage message = (UdpMessage)obj;

            //label1.Visible = true;
            status1.Text = "Initializing..." + message.Recipient;
            TD.SandDock.TabPage sysTab = new TD.SandDock.TabPage(message.Recipient);
            tabControl1.TabPages.Add(sysTab);//tabControl1 now contains sysTab
            this.Refresh();

            ControlVseSystem vseSys = new ControlVseSystem();

            vseSys.Name = message.Recipient;
            vseSys.Setup(message.Recipient);//Sets the database name for the console, also sets the statName.Text
            vseSys.Dock              = DockStyle.Fill;
            vseSys.SendUdpBroadcast += new UdpDelegate(SendUdpBroadcast);
            sysTab.Controls.Add(vseSys);    //sysTab contains VseSystemControl

            if (message.Info == "Open-Off")
            {
                vseSys.OnOpenOff();
            }
            else if (message.Info == "Open-Disconnected")
            {
                vseSys.OnDisconnected("");
            }
            else if (message.Info == "Open-Ready")
            {
                vseSys.OnConnected();
            }
            else//Must be initializing
            {
                vseSys.OnInitializing(message.Info.TrimStart(new char[5] {
                    'O', 'p', 'e', 'n', '-'
                }));
            }

            _vseSystems.Add(vseSys);//Add to the collection of defined systems
            #region Make sure we didn't miss any messages
            object[] mMessages = missedMessages.ToArray();
            foreach (UdpMessage mMess in mMessages)
            {
                if (mMess.Recipient == message.Recipient)
                {
                    missedMessages.Remove(mMess);
                    UdpBroadcast1_MessageRcvd(mMess);
                }
            }
            #endregion
            status1.Text = "";
            //label1.Visible = false;
            this.Refresh();
        }
예제 #3
0
        private void CreateSystem(string name)
        {
            ControlVseSystem vseSysOpen = _vseSystems.GetByName(name);

            if (vseSysOpen == null)
            {
                ControlVseSystem vseSys = new ControlVseSystem();
                vseSys.Name = name;
                //vseSys.SetName(name);
                vseSys.Dock              = DockStyle.Fill;
                vseSys.SendUdpBroadcast += new UdpDelegate(SendUdpBroadcast);
                _vseSystems.Add(vseSys);//Add to the collection of defined systems

                TD.SandDock.TabPage sysTab = new TD.SandDock.TabPage(name);
                sysTab.Controls.Add(vseSys);      //sysTab now contains vseSys
                tabControl1.TabPages.Add(sysTab); //tabControl1 now contains sysTab
            }
        }
예제 #4
0
        public int IndexOf(string name)
        {
            ControlVseSystem item = GetByName(name);

            return(List.IndexOf(item));
        }
예제 #5
0
        public bool Contains(string name)
        {
            ControlVseSystem item = GetByName(name);

            return(List.Contains(item));
        }
예제 #6
0
        public void Remove(string name)
        {
            ControlVseSystem item = GetByName(name);

            List.Remove(item);
        }
예제 #7
0
 public int IndexOf(ControlVseSystem item)
 {
     return(List.IndexOf(item));
 }
예제 #8
0
 public bool Contains(ControlVseSystem item)
 {
     return(List.Contains(item));
 }
예제 #9
0
 public void Remove(ControlVseSystem item)
 {
     List.Remove(item);
 }
예제 #10
0
 public void Insert(int index, ControlVseSystem item)
 {
     List.Insert(index, item);
 }
예제 #11
0
 public int Add(ControlVseSystem item)
 {
     return(List.Add(item));
 }
예제 #12
0
        private void DispatchSysMessage(object obj)
        {
            UdpMessage       message = (UdpMessage)obj;
            ControlVseSystem vseSys  = _vseSystems.GetByName(message.Recipient);

            if (vseSys == null)
            {
                missedMessages.Add(message);
            }                                                   //In case the system is still being opened
            else
            {
                switch (message.Type)
                {
                case 100: vseSys.OnDisconnected(message.Info);
                    break;

                case 101: vseSys.OnStatus(message.Info);
                    break;

                case 102: vseSys.OnStatus(message.Info);
                    break;

                case 110: vseSys.OnConnected();
                    break;

                case 120: int count; int lastID = DecodeUdpLastID(out count, message.Info);
                    vseSys.OnMessageRcvd(lastID, count);
                    break;

                case 121: vseSys.OnCommandNotSent(message.Timestamp, message.Info);
                    break;

                case 122: vseSys.OnCommandProcRcvd(message.Timestamp, message.Info);
                    break;

                case 130: vseSys.OnPollDataRcvd(message.Timestamp);
                    break;

                case 131: int count2; int lastID2 = DecodeUdpLastID(out count2, message.Info);
                    vseSys.OnConnectRecRcvd(lastID2, count2);
                    break;

                case 132: int count3; int lastID3 = DecodeUdpLastID(out count3, message.Info);
                    vseSys.OnFtpRecRcvd(lastID3, count3);
                    break;

                case 133: int count4; int lastID4 = DecodeUdpLastID(out count4, message.Info);
                    vseSys.OnJobStepRecRcvd(lastID4, count4);
                    break;

                case 140: vseSys.OnTraceDataRcvd(message.Timestamp, message.Info);
                    break;

                case 151:
                    RemoveSystem(message.Recipient);
                    MessageBox.Show(message.Info, "Sql Error");             //Create Database Error
                    break;

                case 152: MessageBox.Show(message.Info, "Sql Error");       //Rename Database Error
                    break;

                case 153: MessageBox.Show(message.Info, "Sql Error");       //Drop Database Error
                    break;

                default:    //Communication Error = 100XX
                    vseSys.OnCommError((CommErrorType)message.Type, message.Info);
                    break;
                }
            }
        }