Exemplo n.º 1
0
        private void HandleSettingsUpdate(ImmutableYakkaSettings msg)
        {
            bool firstLaunch = _settingsViewModel.ServerAddress == null;

            _settingsViewModel.Username = msg.Username;
            _settingsViewModel.ConnectAutomatically = msg.ConnectAutomatically;
            _settingsViewModel.LaunchOnStartup = msg.LaunchOnStartup;
            _settingsViewModel.RememberSettings = msg.RememberSettings;
            _settingsViewModel.ServerAddress = msg.ServerAddress;
            _settingsViewModel.ServerPort = msg.ServerPort;

            _settingsViewModel.UpdateSettings(msg);

            if (firstLaunch && msg.ConnectAutomatically)
            {
                Context.ActorSelection(ClientActorPaths.ShellViewModelActor.Path)
                       .Tell(new ConnectionActor.ConnectRequest());
            }
        }
Exemplo n.º 2
0
 public ConnectWithSettings(ImmutableYakkaSettings settings)
 {
     Settings = settings;
 }
Exemplo n.º 3
0
 public SaveSuccess(ImmutableYakkaSettings settings, IActorRef respondTo)
 {
     Settings = settings;
     RespondTo = respondTo;
 }
Exemplo n.º 4
0
 public InitiateSave(ImmutableYakkaSettings settings, IActorRef respondTo)
 {
     Settings = settings;
     RespondTo = respondTo;
 }
Exemplo n.º 5
0
 public SaveSettings(ImmutableYakkaSettings settings)
 {
     Settings = settings;
 }
Exemplo n.º 6
0
 public SaveSettingsRequest(ImmutableYakkaSettings settings)
 {
     Settings = settings;
 }
Exemplo n.º 7
0
 public LoadSettingsResponse(ImmutableYakkaSettings settings)
 {
     Settings = settings;
 }
Exemplo n.º 8
0
        private void Working()
        {
            _logger.Debug("Entering working state");

            Receive<SaveSettingsRequest>(msg =>
            {
                _logger.Debug("Deferring {0}", msg.GetType());
                Stash.Stash();
            });
            Receive<LoadSettingsRequest>(msg =>
            {
                _logger.Debug("Deferring {0}", msg.GetType());
                Stash.Stash();
            });
            Receive<RequestCurrentSettingsRequest>(msg =>
            {
                _logger.Debug("Deferring {0}", msg.GetType());
                Stash.Stash();
            });

            Receive<SettingsWorkerActor.LoadSuccess>(msg =>
            {
                _logger.Debug("Load success");
                _currentSettings = msg.Settings;
                msg.RespondTo.Tell(msg.Settings);
                Stash.UnstashAll();
                Become(Available);
            });
            Receive<SettingsWorkerActor.Failure>(msg =>
            {
                _errorHandler.Tell(
                    new ErrorDialogActor.ErrorMessage(
                        $"Failed to process {msg.MessageType} for {msg.RespondTo}",
                        msg.MessageType.Contains("Save")
                            ? "Failed to save settings."
                            : "Failed to load settings."));

                Stash.UnstashAll();
                Become(Available);
            });
            Receive<SettingsWorkerActor.SaveSuccess>(msg =>
            {
                _logger.Debug("Save success");
                msg.RespondTo.Tell(msg.Settings);
                Stash.UnstashAll();
                Become(Available);
            });
        }
Exemplo n.º 9
0
        private void HandleSaveSettingsRequest(SaveSettingsRequest msg)
        {
            _logger.Debug("Handling save settings request");
            _currentSettings = msg.Settings;

            var workerProps = Context.DI().Props<SettingsWorkerActor>();
            _dbWorker = Context.ActorOf(workerProps);

            _dbWorker.Tell(new SettingsWorkerActor.InitiateSave(msg.Settings, Sender), Self);

            Become(Working);
        }
Exemplo n.º 10
0
        public void UpdateSettings(ImmutableYakkaSettings msg)
        {
            _lastSettings = msg;

            NotifyOfPropertyChange(() => CanAcceptButton);
            NotifyOfPropertyChange(() => CanCancelButton);
        }