Exemplo n.º 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)
            {

                //
            }

        }
Exemplo n.º 2
0
        private void myLoginButton_Click(object sender, EventArgs e)
        {

            if (!myUserAccount.LoggedIn())
            {

                if (NetworkInterface.GetIsNetworkAvailable())
                {

                    LoggingInProgress(true);

                    try
                    {
                        myClientConfiguration.Username = "";
                        myClientConfiguration.Password = "";
                        myClientConfiguration.RememberMe = false;
                        myClientConfiguration.AutoLogin = false;

                        ClientConfigurationSerializer serializer = new ClientConfigurationSerializer();
                        if (myLoginRememberMeCheckBox.Checked)
                        {
                            myClientConfiguration.RememberMe = true;
                            myClientConfiguration.Username = myLoginUsernameInput.Text;
                            myClientConfiguration.Password = myLoginPasswordInput.Text;

                            if (myLoginAutoLoginCheckBox.Checked)
                            {

                                myClientConfiguration.AutoLogin = true;
                            }
                        }
                        serializer.SaveClientConfiguration(myClientConfiguration);
                    }
                    catch (Exception)
                    {

                        //
                    }

                    if (InitializeClient())
                    {

                        myMainWindowSplitContainer.Panel1Collapsed = true;
                        myMainWindowSplitContainer.Panel2Collapsed = false;

                        //initialize WebContactsBook

                        getContactsBook();
                        getPrepaidStatus();

                        CallHistory tmpCallHistory = myCallHistorySerializer.LoadCallHistory(myUserAccount.Username);
                        if (tmpCallHistory.CallRecords != null)
                        {
                            myCallHistoryRecords.AddRange(tmpCallHistory.CallRecords);
                        }
                    }
                    //open login panel and process login
                    LoggingInProgress(false);
                }
                else
                {
                    myClientNotifyIcon.ShowBalloonTip(10, "IM - Network Unavaliable", "Client functionality will be limited, check your network.", ToolTipIcon.Warning);
                }
            }
        }