예제 #1
0
        public static void Main(string[] args)
        {
            //string[] args = new string[1] { "" };

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    clientalive = new MasterAlive();
                    myfrmMain = new frmMain(clientalive);

                    clientalive.PSClientTerm(args);
                    Application.Run(myfrmMain);
        }
        /// <summary>
        /// frmMain form  konstruktor, elindítja az SQLDependecy-t, létrehoz egy új frmMessage form-t
        /// </summary>
        /// <author> VT </author> 
        /// <date>  2013.09.25.  </date>
        public frmMain(MasterAlive clientalive)
        {
            //reg.SetValue("Time Report", Application.ExecutablePath.ToString());

            InitializeComponent();

            //Uri uri = new Uri(TR_SiteUrl);
            //this.webBrowser1.Url = uri;

            _clientalive = clientalive;

            this.TRwebBrowser.Url = null;

            try
            {
                this.ShowInTaskbar = false;
                this.Visible = false;

               this.TRtabPage01.Controls.Add(TRpanel);
               this.TRtabPage02.Controls.Add(Outlookpanel);

               this.TRpanel.Controls.Add(TRtoolStrip);
               this.TRLabel.Text = TR_LabelText;

               this.Outlookpanel.Controls.Add(OutlooktoolStrip);
               this.OutlookLabel.Text = Outlook_SiteUrl;

               //Telepítve van-e IE 9-nél alacsonyabb verziójú böngésző
               if (CheckIEBrowserVersion() < IEBrowserVersion)
               {
                   HasOptimalBrowser = false;
                   ContextMenuProperty("remove", "timeReportToolStripMenuItem");
                   ContextMenuProperty("remove", "refreshToolStripMenuItem");
               }
               else
               {
                   HasOptimalBrowser = true;
               }

            }
            catch (Exception ex)
            {
                ExceptionHandler.WriteLog(ex);
            }

            //Events Declaration
            NetworkChange.NetworkAvailabilityChanged += new NetworkAvailabilityChangedEventHandler(AvailabilityChangedCallback);
            SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged);

            this.TIMEREPORT.Text = "PS Time Report " + GetRunningVersion().ToString();
            actualMessage = new Controls.frmMessage();

            isNetwork = NetworkInterface.GetIsNetworkAvailable();
            isProcessNetwork = IsConnectedToProcessNetwork(Constans.sProcessNetworkIpAddress);

            if (isNetwork && isProcessNetwork)
            {
                sqlpushnotifyStart();

                SqlExecute(sConnectionString, sSqlUpdateOnStart);
            }

            //#KZ20150409 SqlDependencyTimer call has been retired from frmMain constructor.
            //Because, another method (AvailabilityChangedCallback) has already handled network connection issues.
                //SqlDependencyTimer();

            //SystemEvents.PowerModeChanged += OnPowerChange;
        }