Beispiel #1
0
        private void cbAutoLogon_CheckedChanged(object sender, EventArgs e)
        {
            if (cbAutoLogon.Checked)
            {
                rainbowIniFileParser.WriteValue("AutoLogon", "Settings", "true");
            }
            else
            {
                rainbowIniFileParser.WriteValue("AutoLogon", "Settings", "false");
            }

            rainbowIniFileParser.Save();
        }
Beispiel #2
0
        public void RBLogin(String login, String password)
        {
            if (IsBusy)
            {
                return;
            }

            // We set to Busy
            IsNotBusy = false;

            // Hide error (if any)
            ErrorIsVisible = Visibility.Collapsed;
            ErrorString    = "";


            Task task = new Task(() =>
            {
                // Save AutoLogin option
                iniFileParser.WriteValue("AutoLogin", "Application", AutoLogin ? "True" : "False");
                iniFileParser.Save();

                if (CurrentApplication.RbApplication.ConnectionState() == ConnectionState.Disconnected)
                {
                    /*
                     * IPEndPoint ipEndPoint;
                     * var addresses = Dns.GetHostAddresses(currentApplication.HOST_NAME);
                     * ipEndPoint = new IPEndPoint(addresses[0], 0);
                     * currentApplication.RbApplication.SetIpEndPoint(ipEndPoint);
                     */

                    CurrentApplication.RbApplication.Login(login, password, callback =>
                    {
                        if (!callback.Result.Success)
                        {
                            if (System.Windows.Application.Current != null)
                            {
                                System.Windows.Application.Current.Dispatcher.Invoke(new Action(() =>
                                {
                                    String strError = "";
                                    if (callback.Result.ExceptionError != null)
                                    {
                                        strError = "Exception: " + callback.Result.ExceptionError.ToString();
                                    }
                                    else if (callback.Result.IncorrectUseError != null)
                                    {
                                        strError = callback.Result.IncorrectUseError.ErrorMsg;
                                        if (!String.IsNullOrEmpty(callback.Result.IncorrectUseError.ErrorDetails))
                                        {
                                            strError += ": " + callback.Result.IncorrectUseError.ErrorDetails;
                                        }
                                    }
                                    IsNotBusy      = true;
                                    ErrorIsVisible = Visibility.Visible;
                                    ErrorString    = strError;
                                }));
                            }
                        }
                    });
                }
                else
                {
                    CurrentApplication.RbApplication.Logout();
                }
            });

            task.Start();
        }