Exemple #1
0
        private void Client_Load(object sender, EventArgs e)
        {
            try
            {
                ClientConfigurationSerializer serializer = new ClientConfigurationSerializer();
                myClientConfiguration = serializer.LoadClientConfiguration();

                lnChangeSettings.Visible = ConfigProfile.AllowConfiguration;
                //check the web service for update and newses

                try
                {

                    RemwaveCSWS.Service remwaveCSWS = new Remwave.Client.RemwaveCSWS.Service();

                    string[] version = remwaveCSWS.Version();

                    if (Application.ProductVersion != version[0])
                    {
                        //force update
                        string downloadlink = remwaveCSWS.Software();
                        if (MessageBox.Show(this, "New Version of nikotel client is  avaliable for download!\nClick [OK] to open the download page.", "Update avaliable.", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            System.Diagnostics.Process.Start(downloadlink);
                            Application.Exit();
                        };
                    }

                    if (myClientConfiguration.LastNews != version[1])
                    {
                        //display news
                        string newsLink = remwaveCSWS.News();
                        System.Diagnostics.Process.Start(newsLink);
                        myClientConfiguration.LastNews = version[1];

                    }

                }
                catch (Exception)
                {
                    // throw;
                    ;
                }



                if (ConfigProfile.AllowConfiguration)
                {
                    //check in services are configured
                    bool runConfiguration = false;
                    if (myClientConfiguration.SIPProxyAddress == "") runConfiguration = true;
                    if (myClientConfiguration.SIPProxyRealm == "") runConfiguration = true;
                    if (myClientConfiguration.VideoProxyAddress == "") runConfiguration = true;
                    if (myClientConfiguration.IMServerAddress == "") runConfiguration = true;
                    if (myClientConfiguration.RSIUrl == "") runConfiguration = true;
                    if (runConfiguration)
                    {
                        ConfigureClient(true);
                    }
                    ConfigureServices();
               }






                if (myClientConfiguration.RememberMe)
                {
                    myLoginRememberMeCheckBox.Checked = true;
                    myLoginPasswordInput.Text = myClientConfiguration.Password;
                    myLoginUsernameInput.Text = myClientConfiguration.Username;
                    if (myClientConfiguration.AutoLogin)
                    {
                        myLoginAutoLoginCheckBox.Checked = true;
                        myLoginButton.PerformClick();
                    }
                }

            }
            catch (Exception)
            {

                //
            }

        }