Exemple #1
0
        internal void LoadSettings(SquiggleSettings settings)
        {
            viewModel.AutoSignIn = settings.PersonalSettings.AutoSignMeIn;
            viewModel.RememberMe = settings.PersonalSettings.RememberMe;

            if (viewModel.RememberMe)
            {
                viewModel.Username   = settings.PersonalSettings.Username;
                txtPassword.Password = settings.PersonalSettings.Password;
                viewModel.Domain     = settings.PersonalSettings.Domain;
                DisplayName          = settings.PersonalSettings.DisplayName;
                GroupName            = settings.PersonalSettings.GroupName;
            }
            LoadGroups(settings.ContactSettings.ContactGroups);
        }
Exemple #2
0
        public SettingsViewModel(SquiggleSettings settings) : this()
        {
            this.settings = settings;

            ChatSettings.ShowEmoticons          = settings.ChatSettings.ShowEmoticons;
            GeneralSettings.HideToSystemTray    = settings.GeneralSettings.HideToSystemTray;
            GeneralSettings.ShowPopups          = settings.GeneralSettings.ShowPopups;
            GeneralSettings.AudioAlerts         = settings.GeneralSettings.AudioAlerts;
            GeneralSettings.DownloadsFolder     = settings.GeneralSettings.DownloadsFolder;
            GeneralSettings.EnableStatusLogging = settings.GeneralSettings.EnableStatusLogging;
            GeneralSettings.CheckForUpdates     = settings.GeneralSettings.CheckForUpdates;

            ChatSettings.SpellCheck             = settings.ChatSettings.SpellCheck;
            ChatSettings.StealFocusOnNewMessage = settings.ChatSettings.StealFocusOnNewMessage;
            ChatSettings.ClearChatOnWindowClose = settings.ChatSettings.ClearChatOnWindowClose;
            ChatSettings.EnableLogging          = settings.ChatSettings.EnableLogging;

            ContactSettings.ContactListSortField = settings.ContactSettings.ContactListSortField;
            ContactSettings.GroupContacts        = settings.ContactSettings.GroupContacts;
            ContactSettings.ShowOfflineContacts  = settings.ContactSettings.ShowOfflineContacts;
            ContactSettings.ContactListView      = settings.ContactSettings.ContactListView;

            ConnectionSettings.BindToIP        = settings.ConnectionSettings.BindToIP;
            ConnectionSettings.ChatPort        = settings.ConnectionSettings.ChatPort;
            ConnectionSettings.KeepAliveTime   = settings.ConnectionSettings.KeepAliveTime;
            ConnectionSettings.PresenceAddress = settings.ConnectionSettings.PresenceAddress;
            ConnectionSettings.PresencePort    = settings.ConnectionSettings.PresencePort;

            PersonalSettings.DisplayMessage = settings.PersonalSettings.DisplayMessage;
            PersonalSettings.DisplayImage   = settings.PersonalSettings.DisplayImage;
            PersonalSettings.DisplayName    = settings.PersonalSettings.DisplayName;
            PersonalSettings.EmailAddress   = settings.PersonalSettings.EmailAddress;
            PersonalSettings.GroupName      = settings.PersonalSettings.GroupName;
            PersonalSettings.RememberMe     = settings.PersonalSettings.RememberMe;
            PersonalSettings.AutoSignMeIn   = settings.PersonalSettings.AutoSignMeIn;
            PersonalSettings.IdleTimeout    = settings.PersonalSettings.IdleTimeout;
        }
        private async void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (App.RunInBackground)
            {
                this.Hide();
            }

            chatWindows = new ChatWindowCollection();

            var settingsProvider      = SettingsProvider.Current;
            SquiggleSettings settings = settingsProvider.Settings;

            settings.ContactSettings.ContactGroups.FlushItems();
            settingsProvider.Save();

            HistoryManager history = new HistoryManagerFactory().CreateInstance();

            context = new SquiggleContextFactory(new PluginLoaderFactory(),
                                                 history,
                                                 this,
                                                 settings.ConnectionSettings.ClientID).CreateInstance();
            context.PluginLoader.LoadAll(context);

            SetupControls();

            TrayPopup.Instance.Enabled  = SettingsProvider.Current.Settings.GeneralSettings.ShowPopups;
            AudioAlert.Instance.Enabled = SettingsProvider.Current.Settings.GeneralSettings.AudioAlerts;

            chatControl.SignIn.LoadSettings(settings);

            var client = context.ChatClient;

            client.EnableLogging = settings.GeneralSettings.EnableStatusLogging;
            client.ChatStarted  += client_ChatStarted;
            client.BuddyUpdated += client_BuddyUpdated;
            client.BuddyOnline  += client_BuddyOnline;
            client.BuddyOffline += client_BuddyOffline;

            clientViewModel = new ClientViewModel(client);
            clientViewModel.CancelUpdateCommand = new RelayCommand <object>(CancelUpdateCommand_Execute);
            DataContext = chatControl.ChatContext = clientViewModel;

            autoSignout = new NetworkSignout(this.Dispatcher, options => SignIn(options, byUser: false), () => SignOut(byUser: false));

            var singleSignOn = chatControl.SignIn.lblSingleSignOn.Visibility == Visibility.Visible;

            if (singleSignOn || (settings.PersonalSettings.RememberMe && settings.PersonalSettings.AutoSignMeIn))
            {
                var signInOptions = new SignInOptions()
                {
                    Username = settings.PersonalSettings.Username,
                    Password = settings.PersonalSettings.Password,
                    Domain   = settings.PersonalSettings.Domain
                };
                await Task.Delay(5.Seconds());

                SignIn(signInOptions, false);
            }
            else if (settings.PersonalSettings.RememberMe)
            {
                chatControl.SignIn.RememberMe = true;
            }
        }
 public LoginOptionsFactory(SquiggleSettings settings, UserDetails userInfo, SignInOptions signInOptions)
 {
     this.settings      = settings;
     this.userInfo      = userInfo;
     this.signInOptions = signInOptions;
 }
Exemple #5
0
 public LoginHelper(IAuthenticationProvider authenticationProvider, SquiggleSettings settings, IChatClient client)
 {
     this.authenticationProvider = authenticationProvider;
     this.settings = settings;
     this.client   = client;
 }