Exemplo n.º 1
0
 static void Main()
 {
     Util.UserDebug("FolderTrack Gui Started");
     Util.DBug2("Program", "Started Gui");
     Application.EnableVisualStyles();
     Util.DBug2("Program", "EnableVisualStyles");
     Application.SetCompatibleTextRenderingDefault(false);
     Util.DBug2("Program", "SetCompatibleTextRenderingDefault");
     ftobjects = new FTObjects(new DataReceiver());
     Util.DBug2("Program", "Run Check");
      //   MainForm FolderTrackGui = new MainForm(ftobjects);
     Util.DBug2("Program", "Get Monitor Group Information");
     List<MonitorGroupInfo> monitorGrList = ftobjects.GetAllMonitorGroupInfor();
     mainform = new MainForm();
     mainform.SetFTBeforeOpenMonGr(ftobjects);
     //add main form so it can receive alerts and
     ftobjects.AddToCallList(mainform);
     if (monitorGrList.Count == 0)
     {
         Util.DBug2("Program", "No Monitor Groups Detected show window");
         NewMonitorGroupForm mgDia = new NewMonitorGroupForm();
         DialogResult di = mgDia.ShowDialog();
         if (di == DialogResult.OK)
         {
             mainform.HideNoMonitorGroup();
             Util.DBug2("Program", "Sending NameOfMonitor " + mgDia.LocationManager.NameOfMonitor);
             foreach (string loca in mgDia.LocationManager.MonitorLocation)
             {
                 Util.DBug2("Program", "Location " + loca);
             }
             new Thread(new ParameterizedThreadStart(SendNewMonitorGroup)).Start(mgDia);
         }
         else if (di == DialogResult.Cancel)
         {
          //   return;
         }
     }
     else
     {
         new Thread(SetFtOb).Start();
     }
     Util.DBug2("Program", "R");
     Application.Run(mainform);
 }
Exemplo n.º 2
0
        public MainForm(FTObjects ftobjects)
        {
            Util.DBug2("MainForm", "Starting");
            this.m_FTObjects = ftobjects;
            Util.DBug2("I", "Requesting Monitor Group Info");
            List<MonitorGroupInfo> monitorGrList = m_FTObjects.GetAllMonitorGroupInfor();
            Util.DBug2("I", "Received Monitor Group Info " + monitorGrList.Count+" items ");

            InitializeComponent();
            Util.DBug2("MainForm", "Done initilize components");
            ftobjects.SetMainForm(this);
            Util.DBug2("MainForm", "Done SetMainForm");
            m_FTObjects.AddToCallList(this);
            Util.DBug2("MainForm", "Done AddToCallList");
            PanelFromMonitorGInfo pan = new PanelFromMonitorGInfo();
            Util.DBug2("MainForm", "Done new pan");
            pan.mainfor = this;
            MonitorGrouPanLis.PanelFromData = pan;
            Util.DBug2("MainForm", "Done pan from data");
            this.Monitpanel.Controls.Add(this.MonitorGrouPanLis);
            Util.DBug2("MainForm", "Add panels");
            this.MonitorGrouPanLis.Dock = DockStyle.Fill;
            if (monitorGrList.Count == 1)
            {
                Util.DBug2("MainForm", "Open monitor group");
                OpenMonitorGroup(monitorGrList[0].name);
            }
            else
            {
                Util.DBug2("MainForm", "Show chooser");
                showMonitorChoser(monitorGrList);
            }

            //    this.allVersionPanel1.P_FTObjects = this.m_FTObjects;
              //      this.calendarPanel1.P_FTObjects = this.m_FTObjects;
             //       this.searchPanel1.P_FTObjects = this.m_FTObjects;
              //      this.explorerTab1.P_FTObjects = this.m_FTObjects;
        }
Exemplo n.º 3
0
        public void SetFtObjects(object ftobjectsO)
        {
            FTObjects ftobjects = (FTObjects)ftobjectsO;

            this.m_FTObjects = ftobjects;
            List<MonitorGroupInfo> monitorGrList = m_FTObjects.GetAllMonitorGroupInfor();

            m_FTObjects.AddToCallList(calendarPanel1);
            m_FTObjects.AddToCallGuiCallList(calendarPanel1);
            m_FTObjects.AddToCallList(searchPanel1);
            m_FTObjects.AddToCallGuiCallList(searchPanel1);
            m_FTObjects.AddToCallList(explorerTab1);
            m_FTObjects.AddToCallList(allVersionPanel1);
            m_FTObjects.AddToCallGuiCallList(allVersionPanel1);
            //this is not good programming practice should be changed
            m_FTObjects.AddToCallList(allVersionPanel1.relationpan);

            if (monitorGrList.Count == 1 && monitorGrList[0].error == false)
            {

                try
                {
                    NoMonitorGroupPanel.Invoke(new VoidNoArgDelegate(HideNoMonitorGroup));
                }
                catch (InvalidOperationException)
                {
                    NoMonGr = false;
                }
                OpenMonitorGroup(monitorGrList[0].name);
            }
            else if (monitorGrList.Count > 1 ||
                monitorGrList.Count == 1 && monitorGrList[0].error == true)
            {
                Util.DBug2("MainForm", "Show chooser");
              //  new Thread(HideNoMonitorGroup).Start();
                try
                {
                    this.NoMonitorGroupPanel.Invoke(new VoidNoArgDelegate(HideNoMonitorGroup));
                }
                catch (InvalidOperationException)
                {
                    NoMonGr = false;
                }
                showMonitorChoser(monitorGrList);
            }
            else
            {
                ShowNoMonitorGroup();
            }
        }