private void RedirectionMenu(RenderWindow window, MainMenu mainMenu, StartGame startGame) { switch (_chooseOptionMenu) { case 0: // Mode Player versus A.I //_characterMenu.Draw(mainMenu, this, window); this._state = new CharacterMenu(window); break; case 1: // Mode Player Versus Player //_characterMenu.Draw(mainMenu, this, window); this._state = new CharacterMenu(window); break; case 2: // Mode online //OnlineMenu _onlineMenu = new OnlineMenu(window); //this._state = _onlineMenu; this._state = new OnlineMenu(window); // _onlineMenu.Draw(mainMenu, this, window); break; case 3: // Option : "Retour" mainMenu._chooseOptionMenu = -1; this._chooseOptionMenu = -1; break; } }
public GetBoardsQueryHandler( IAppState appState, IResultsResolver <Board> boardResultsResolver, IHttpClientFactory httpClientFactory) : base(appState, httpClientFactory) { _boardResultsResolver = boardResultsResolver; }
//The Xamarin.Forms.DependencyService is a SERVICE LOCATOR and not an IoC CONTAINER //if it was an IoC container, we could inject these into the constructor like this: //public MockDataStore(IAppState appState, ILogging logging)... public MockDataStore() { _appState = DependencyService.Get <IAppState>(); _logging = DependencyService.Get <ILogging>(); items = new List <Item>() { new Item { Id = Guid.NewGuid().ToString(), Text = "First item", Description = "This is an item description." }, new Item { Id = Guid.NewGuid().ToString(), Text = "Second item", Description = "This is an item description." }, new Item { Id = Guid.NewGuid().ToString(), Text = "Third item", Description = "This is an item description." }, new Item { Id = Guid.NewGuid().ToString(), Text = "Fourth item", Description = "This is an item description." }, new Item { Id = Guid.NewGuid().ToString(), Text = "Fifth item", Description = "This is an item description." }, new Item { Id = Guid.NewGuid().ToString(), Text = "Sixth item", Description = "This is an item description." } }; }
public ParameterDistributionViewModel( IAppState appState, IAppService appService, IAppSettings appSettings, DistributionType distributionsInView, bool allowTruncation = false ) { var simulation = appState.Target.AssertSome(); _parameters = simulation.SimConfig.SimInput.SimParameters; var distributionTypes = Distribution.GetDistributionTypes(distributionsInView); var distributionViewModelTypes = distributionTypes .Map( dt => typeof(IDistributionViewModel).Assembly .GetType($"{nameof(RVisUI)}.{nameof(AppInf)}.{dt}DistributionViewModel") .AssertNotNull($"{nameof(RVisUI)}.{nameof(AppInf)}.{dt}DistributionViewModel not found") ); _distributionViewModels = distributionViewModelTypes .Select(t => Activator.CreateInstance(t, new object[] { appService, appSettings })) .Cast <IDistributionViewModel>() .ToArr(); foreach (var distributionViewModel in _distributionViewModels) { distributionViewModel.AllowTruncation = allowTruncation; } var displayNames = distributionViewModelTypes.Select( t => t.GetCustomAttribute <DisplayNameAttribute>()?.DisplayName ?? t.Name ); DistributionNames = displayNames.ToArr(); _reactiveSafeInvoke = appService.GetReactiveSafeInvoke(); this.ObservableForProperty(vm => vm.SelectedDistributionName).Subscribe( _reactiveSafeInvoke.SuspendAndInvoke <object>( ObserveSelectedDistributionName ) ); _distributionViewModels.Iter(dvm => ((INotifyPropertyChanged)dvm) .GetWhenPropertyChanged() .Subscribe( _reactiveSafeInvoke.SuspendAndInvoke <string?>( pn => ObserveDistributionViewModelProperty(dvm, pn) ) ) ); this.ObservableForProperty(vm => vm.ParameterState).Subscribe( _reactiveSafeInvoke.SuspendAndInvoke <object>( ObserveParameterState ) ); }
internal ViewModel(IAppState appState, IAppService appService, IAppSettings appSettings) { _appState = appState; _appService = appService; _simulation = appState.Target.AssertSome("No simulation"); _evidence = appState.SimEvidence; Import = ReactiveCommand.Create(HandleImport); _moduleState = ModuleState.LoadOrCreate(_simulation, _evidence); _browseViewModel = new BrowseViewModel(appState, appSettings, appService, _moduleState); _manageViewModel = new ManageViewModel(appState, appService, _moduleState); _reactiveSafeInvoke = appService.GetReactiveSafeInvoke(); _subscriptions = new CompositeDisposable( _moduleState.ObservationsChanges.Subscribe( _reactiveSafeInvoke.SuspendAndInvoke <(Arr <SimObservations>, ObservableQualifier)>( ObserveModuleStateObservationsChange ) ), _appState.SimSharedState.ObservationsSharedStateChanges.Subscribe( _reactiveSafeInvoke.SuspendAndInvoke <(Arr <SimObservationsSharedState>, ObservableQualifier)>( ObserveSharedStateObservationsChange ) ) ); }
internal SearchBar(RenderWindow window) { _searchBar = new RectangleShape() { FillColor = Color.White, Size = new Vector2f(800f, 30f), Position = new Vector2f(200f, 300f), OutlineThickness = 5, OutlineColor = Color.Black, }; _searchText = new Text() { Style = Text.Styles.Regular, FillColor = Color.Blue, Font = new Font("../../../../Ui/Resources/Fonts/karate2/karate2.otf"), CharacterSize = 15, DisplayedString = "Entrez l'adresse IP de votre adversaire : ", }; window.MouseButtonReleased += (sender, e) => ClickOnSearchBar(e); window.TextEntered += (sender, e) => WriteAdressIP(e); window.KeyPressed += (sender, e) => RemoveAdressIP(e); _nextState = this; }
public GetUserStoriesQueryHandler( IAppState appState, IResultsResolver <UserStory> userStoryResultsResolver, IHttpClientFactory httpClientFactory) : base(appState, httpClientFactory) { _userStoryResultsResolver = userStoryResultsResolver; }
internal RCConfigurationViewModel(IAppState appState, IAppService appService) { _appService = appService; Cancel = ReactiveCommand.Create(HandleCancel); IsMc2dInstalled = appState.InstalledRPackages.Exists(p => p.Package == "mc2d"); _rcSetKeyboardTarget = ReactiveCommand.Create <RCParameterViewModel>(HandleSetKeyboardTarget); Disable = ReactiveCommand.Create(HandleDisable); OK = ReactiveCommand.Create( HandleOK, this.ObservableForProperty(vm => vm.CanOK, _ => CanOK) ); UpdateEnable(); _reactiveSafeInvoke = appService.GetReactiveSafeInvoke(); this .ObservableForProperty( vm => vm.Correlations ) .Subscribe( _reactiveSafeInvoke.SuspendAndInvoke <object>( ObserveCorrelations ) ); }
// Constructor public AppSystem(IForegroundWindowHook fgHook, IWindowUpdateHook winHook, IMouseHook msHook) { _state = new InitialState(); _stateContext = new AppStateContext { PathModeLocksToHandle = false, ForegroundHook = fgHook, WindowHook = winHook, MouseHook = msHook, SetCurrentState = (next) => SetCurrentState(next), SendLockStateChange = () => LockStateChanged.Invoke(this, new Events.LockStateChangedEventArgs { IsLocked = IsLocked }), SendPathChange = (path) => PathChanged.Invoke(this, new Events.PathChangedEventArgs { Path = path }), SendTitleChange = (title) => TitleChanged.Invoke(this, new Events.TitleChangedEventArgs { Title = title }), SendDimensionsChange = (dimensions) => DimensionsChanged.Invoke(this, new Events.DimensionsChangedEventArgs { Dimensions = dimensions }), SendForegroundChange = (inForeground) => ForegroundChanged.Invoke(this, new Events.ForegroundStateChangedEventArgs { InForeground = inForeground }) }; fgHook.ForegroundWindowChanged += ForegroundHook_ForegroundWindowChanged; winHook.WindowClosed += WindowHook_WindowClosed; winHook.DimensionsChanged += WindowHook_DimensionsChanged; winHook.TitleChanged += WindowHook_TitleChanged; }
public OpenCacheViewModel(IScreen hostScreen, IAppState appState) { HostScreen = hostScreen; var isCachePathValid = this.WhenAny( x => x.CachePath, x => x.OpenAsEncryptedCache, x => x.OpenAsSqlite3Cache, (cp, _, sql) => new { Path = cp.Value, Sqlite3 = sql.Value }) .Throttle(TimeSpan.FromMilliseconds(250), RxApp.MainThreadScheduler) .Select(x => x.Sqlite3 ? File.Exists(x.Path) : Directory.Exists(x.Path)); OpenCache = new ReactiveCommand(isCachePathValid); OpenCache.SelectMany(_ => openAkavacheCache(CachePath, OpenAsEncryptedCache, OpenAsSqlite3Cache)) .LoggedCatch(this, Observable.Return <IBlobCache>(null)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { if (x == null) { UserError.Throw("Couldn't open this cache"); return; } appState.CurrentCache = x; hostScreen.Router.Navigate.Execute(new CacheViewModel(hostScreen, appState)); }); BrowseForCache = new ReactiveCommand(); BrowseForCache.Subscribe(_ => CachePath = browseForFolder( Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Browse for cache")); }
public CacheViewModel(IScreen hostScreen, IAppState appState) { HostScreen = hostScreen; appState.WhenAny(x => x.CachePath, x => x.Value) .Where(x => !String.IsNullOrWhiteSpace(x)) .Select(x => (new DirectoryInfo(x)).Name) .ToProperty(this, x => x.UrlPathSegment, out _UrlPathSegment); Keys = new ReactiveList<string>(); appState.WhenAny(x => x.CurrentCache, x => x.Value) .SelectMany(x => Observable.Start(() => x.GetAllKeys(), RxApp.TaskpoolScheduler)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(newKeys => { Keys.Clear(); newKeys.ForEach(x => Keys.Add(x)); }); FilteredKeys = Keys.CreateDerivedCollection( key => key, key => FilterText == null || key.IndexOf(FilterText, StringComparison.OrdinalIgnoreCase) > -1, signalReset: this.WhenAny(x => x.FilterText, x => x.Value)); SelectedViewer = "Text"; this.WhenAny(x => x.SelectedKey, x => x.SelectedViewer, (k, v) => k.Value) .Where(x => x != null && SelectedViewer != null) .SelectMany(x => appState.CurrentCache.GetAsync(x).Catch(Observable.Return(default(byte[])))) .Select(x => createValueViewModel(x, SelectedViewer)) .LoggedCatch(this, Observable.Return<ICacheValueViewModel>(null)) .ToProperty(this, x => x.SelectedValue, out _SelectedValue); }
private void ClickSelectMap(MouseButtonEventArgs e, RenderWindow window) { if (e.Button == Mouse.Button.Left && _Map1.GetGlobalBounds().Contains(MousePosition.X, MousePosition.Y) == true) { // Map 1 this._nextState = new GameUI(new Game(new Time(), Factory.NewCharacter(_characterMenu._avatars._characterPlayer1.ToLower()), Factory.NewCharacter(_characterMenu._avatars._characterPlayer2.ToLower()), Factory.NewStage("stage1"), window)); } ; if (e.Button == Mouse.Button.Left && _Map2.GetGlobalBounds().Contains(MousePosition.X, MousePosition.Y) == true) { // Map 2 this._nextState = new GameUI(new Game(new Time(), Factory.NewCharacter(_characterMenu._avatars._characterPlayer1.ToLower()), Factory.NewCharacter(_characterMenu._avatars._characterPlayer2.ToLower()), Factory.NewStage("stage2"), window)); } ; if (e.Button == Mouse.Button.Left && _Map3.GetGlobalBounds().Contains(MousePosition.X, MousePosition.Y) == true) { // Map 3 this._nextState = new GameUI(new Game(new Time(), Factory.NewCharacter(_characterMenu._avatars._characterPlayer1.ToLower()), Factory.NewCharacter(_characterMenu._avatars._characterPlayer2.ToLower()), Factory.NewStage("stage3"), window)); } ; if (e.Button == Mouse.Button.Left && _Map4.GetGlobalBounds().Contains(MousePosition.X, MousePosition.Y) == true) { // Map 4 this._nextState = new GameUI(new Game(new Time(), Factory.NewCharacter(_characterMenu._avatars._characterPlayer1.ToLower()), Factory.NewCharacter(_characterMenu._avatars._characterPlayer2.ToLower()), Factory.NewStage("stage4"), window)); } ; if (e.Button == Mouse.Button.Left && _Map5.GetGlobalBounds().Contains(MousePosition.X, MousePosition.Y) == true) { // Map 5 this._nextState = new GameUI(new Game(new Time(), Factory.NewCharacter(_characterMenu._avatars._characterPlayer1.ToLower()), Factory.NewCharacter(_characterMenu._avatars._characterPlayer2.ToLower()), Factory.NewStage("stage5"), window)); } ; if (e.Button == Mouse.Button.Left && _Map6.GetGlobalBounds().Contains(MousePosition.X, MousePosition.Y) == true) { // Map 6 this._nextState = new GameUI(new Game(new Time(), Factory.NewCharacter(_characterMenu._avatars._characterPlayer1.ToLower()), Factory.NewCharacter(_characterMenu._avatars._characterPlayer2.ToLower()), Factory.NewStage("stage6"), window)); } ; }
private void RedirectionMenu(/*MainMenu mainMenu, StartGame startGame,*/ RenderWindow window) { switch (_chooseOptionMenu) { case 0: // Button "Back to menu" this._chooseOptionMenu = -1; //startGame._chooseOptionMenu = -1; //mainMenu._chooseOptionMenu = -1; _avatars._characterPlayer1 = string.Empty; _avatars._characterPlayer2 = string.Empty; this._nextState = new Menus(window); break; case 1: // Button "Random Character" Random random = new Random(); _avatars._characterPlayer1 = _avatars._nameAvatars[random.Next(0, 7)]; _avatars._characterPlayer2 = _avatars._nameAvatars[random.Next(0, 7)]; this._nextState = new Map(window, this); break; case 2: // Button "Next" //this._nextState = new GameUI( new Game(new Time(), Factory.NewCharacter(_avatars._characterPlayer1.ToLower()), Factory.NewCharacter(_avatars._characterPlayer2.ToLower()), Factory.NewStage("stage1"), window) ); this._nextState = new Map(window, this); Console.WriteLine("Perso 1 : " + _avatars._characterPlayer1 + " \nPerso 2 : " + _avatars._characterPlayer2); break; } }
private void SetCurrentAppState(ComponentType appStateType) { Action onReady = () => { _currentAppState = _appStates[appStateType]; _currentAppState.StateChangeRequested += StateChangeRequestedHandler; _currentAppState.AppSize = _graphicsBase.ScreenBounds; _currentAppStateRenderer = _appStateRenderers[appStateType]; _currentAppStateRenderer.Component = _currentAppState; _currentAppStateRenderer.GraphicsBase = _graphicsBase; _gestureRecognizer.CurrentAppState = _currentAppState; _currentAppState.OnTransitionTo(); }; if (_currentAppState != null) { _currentAppState.StateChangeRequested -= StateChangeRequestedHandler; _currentAppState.OnTransitionFrom(onReady); } else { onReady(); } }
public OpenCacheViewModel(IScreen hostScreen, IAppState appState) { HostScreen = hostScreen; var isCachePathValid = this.WhenAny( x => x.CachePath, x => x.OpenAsEncryptedCache, x => x.OpenAsSqlite3Cache, (cp, _, sql) => new { Path = cp.Value, Sqlite3 = sql.Value }) .Throttle(TimeSpan.FromMilliseconds(250), RxApp.MainThreadScheduler) .Select(x => x.Sqlite3 ? File.Exists(x.Path) : Directory.Exists(x.Path)); OpenCache = new ReactiveCommand(isCachePathValid); OpenCache.SelectMany(_ => openAkavacheCache(CachePath, OpenAsEncryptedCache, OpenAsSqlite3Cache)) .LoggedCatch(this, Observable.Return<IBlobCache>(null)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(x => { if (x == null) { UserError.Throw("Couldn't open this cache"); return; } appState.CurrentCache = x; hostScreen.Router.Navigate.Execute(new CacheViewModel(hostScreen, appState)); }); }
private void LinkState(IAppState appState, bool Link) { if (Link) { appState?.Load(); if (appState.StateKeyboardLayout != null) { keyboard?.AddRange(appState.StateKeyboardLayout); } //if (appState.GUI != null) //Myra.Graphics2D.UI.Desktop.Widgets.Add(appState.GUI); } else { appState?.Save(); if (appState.StateKeyboardLayout != null) { keyboard?.RemoveRange(appState.StateKeyboardLayout); } //if (appState.GUI != null) //Myra.Graphics2D.UI.Desktop.Widgets.Remove(appState.GUI ?? null); } }
internal Command(IAppState appState, string name, ICommsPort commsPort, bool isLogging) { _appState = appState; _name = name; _commsPort = commsPort; _isLogging = isLogging; }
public GetMetaQueryHandler( IAppState appState, IResultResolver <Meta> metaResultResolver, IHttpClientFactory httpClientFactory) : base(appState, httpClientFactory) { _metaResultResolver = metaResultResolver; }
public SelectSimulationViewModel( SimLibrary simLibrary, IAppState appState, IAppService appService ) { _simLibrary = simLibrary; _appState = appState; _appService = appService; SimulationVMs = new ObservableCollection <ISimulationViewModel>(); PopulateSimulations(); simLibrary.Loaded += HandleSimLibraryLoaded; simLibrary.Deleted += HandleSimulationDeleted; var svmObservable = this.ObservableForProperty(vm => vm.SelectedSimulationVM, svm => null != svm); OpenSimulation = ReactiveCommand.Create(HandleOpenSimulation, svmObservable); DeleteSimulation = ReactiveCommand.Create(HandleDeleteSimulation, svmObservable); var major = _appState.RVersion.Single(t => t.Name == "major").Value; var minor = _appState.RVersion.Single(t => t.Name == "minor").Value; RVersion = $"{major}.{minor}"; }
protected override void OnStart() { //Remember, there is always a semi-colon at the end of each! AppCenter.Start("ios={Your iOS App secret here};" + "uwp={Your UWP App secret here};" + "android={Your Droid App secret here};", typeof(Analytics), typeof(Crashes)); IAppState AppState = DependencyService.Get <IAppState>(); AppState.Init(); //initialize the log levels for the app and for what messages are sent to the console #if DEBUG //this will dictate the AppCenter logs sent to the console AppState.SetAppCenterConsoleLogLevel(LogLevel.Verbose); //this will dictate what log level we will send to AppCenter AppState.SetAppLogLevel(AppLogLevel.Verbose); #else //this will dictate the AppCenter logs sent to the console AppState.SetAppCenterConsoleLogLevel(LogLevel.Warn); //this will dictate what log level we will send to AppCenter AppState.SetAppLogLevel(AppLogLevel.Info); #endif }
public OnlineMenu(RenderWindow window) { _searchBar = new SearchBar(window); _imgBackGround = this.CreateImgBackGround(); _imgButtons = this.CreateImgButtons(); _textButtonLobby = this.CreateTextButtonLobby(); _backLobby = new RectangleShape { OutlineThickness = 8, OutlineColor = Color.Black, Size = new Vector2f(1200f, 780f), Position = new Vector2f(30, 170f), FillColor = new Color(0, 0, 0, 110), }; _textTitleLobby = this.CreateTextTitleLobby(); _returnButton = new Sprite(new Texture("../../../../img/Menu/return_button.png")) { Scale = new Vector2f(0.35f, 0.25f), Position = new Vector2f(55f, 890f) }; _textReturnButton = new Text() { Style = Text.Styles.Regular, Font = new Font("../../../../Ui/Resources/Fonts/Cocogoose/CocogooseBold.ttf"), CharacterSize = 30, DisplayedString = "Retour", Position = new Vector2f(95f, 900f), }; _nextState = this; }
internal OutputsSelectedSampleViewModel(IAppState appState, IAppService appService, ModuleState moduleState) { _appState = appState; _moduleState = moduleState; _simulation = appState.Target.AssertSome(); ShareParameterValues = ReactiveCommand.Create( HandleShareParameterValues, this.ObservableForProperty( vm => vm.SelectedSample, _ => SelectedSample != NOT_FOUND ) ); _reactiveSafeInvoke = appService.GetReactiveSafeInvoke(); _subscriptions = new CompositeDisposable( this .ObservableForProperty(vm => vm.SelectedSample) .Subscribe( _reactiveSafeInvoke.SuspendAndInvoke <object>( ObserveSelectedSample ) ) ); }
public BaseHandler( IAppState appState, IHttpClientFactory httpClientFactory) { _appState = appState; _httpClientFactory = httpClientFactory; }
void Update() { if (eNextAppState != appState.State) { if (eNextAppState == EAppState.None) { Application.Quit(); return; } else { if (appState != null) { appState.OnExit(); } appState = AppStateFactory.Create(eNextAppState); eNextAppState = appState.State; appState.OnEnter(); } } eNextAppState = appState.OnUpdate(); UIManager.I.Update(); }
public OpenFileStripCommand(IAppState appState, MainForm mainForm, ColorForm colorForm, OpenFileDialog openFileDialog, ICommsPort commsPort) : base(appState) { _mainForm = mainForm; _colorForm = colorForm; _commsPort = commsPort; _openFileDialog = openFileDialog; }
public UploadColorsStripCommand(IAppState appState, ColorForm colorForm, IColorTarget colorTarget, ICommsPort commsPort) : base(appState) { _commsPort = commsPort; _colorForm = colorForm; _colorTarget = colorTarget; }
/// <summary> /// Изменить активное состояние /// </summary> /// <param name="newStateID">ID нового состояния</param> private async void ChangeState(StateBuilder.StateID newStateID) { //old state if (currentState != null) { LinkState(currentState, false); } /* * LOADING SCREEN * Нужно легкое состояние, которое будет быстро загружаться, Фон картинка, какой либо текст подсказка(игровая), иконка загрузки * */ //new state currentState = await StateBuilder.GetStateAsync(newStateID); LinkState(currentState, true); //Myra.Graphics2D.UI.Desktop.Widgets.Add(); if (currentState.Initialized) { return; } currentState.ChangeStateRequest += ChangeState; currentState.Initialized = true; }
public CacheViewModel(IScreen hostScreen, IAppState appState) { HostScreen = hostScreen; appState.WhenAny(x => x.CachePath, x => x.Value) .Where(x => !String.IsNullOrWhiteSpace(x)) .Select(x => (new DirectoryInfo(x)).Name) .ToProperty(this, x => x.UrlPathSegment, out _UrlPathSegment); Keys = new ReactiveList <string>(); appState.WhenAny(x => x.CurrentCache, x => x.Value) .SelectMany(x => Observable.Start(() => x.GetAllKeys(), RxApp.TaskpoolScheduler)) .ObserveOn(RxApp.MainThreadScheduler) .Subscribe(newKeys => { Keys.Clear(); newKeys.ForEach(x => Keys.Add(x)); }); FilteredKeys = Keys.CreateDerivedCollection( key => key, key => FilterText == null || key.IndexOf(FilterText, StringComparison.OrdinalIgnoreCase) > -1, signalReset: this.WhenAny(x => x.FilterText, x => x.Value)); SelectedViewer = "Text"; this.WhenAny(x => x.SelectedKey, x => x.SelectedViewer, (k, v) => k.Value) .Where(x => x != null && SelectedViewer != null) .SelectMany(x => appState.CurrentCache.GetAsync(x).Catch(Observable.Return(default(byte[])))) .Select(x => createValueViewModel(x, SelectedViewer)) .LoggedCatch(this, Observable.Return <ICacheValueViewModel>(null)) .ToProperty(this, x => x.SelectedValue, out _SelectedValue); }
internal OutputErrorViewModel( IAppState appState, IAppService appService ) : this(appState, appService, ErrorModelType.All) { }
public Menus(RenderWindow window) { _mainMenu = new MainMenu(window); _startGame = new StartGame(window); _credit = new Credit(window); _nextState = this; }
public CharacterMenu(RenderWindow window) { _avatars = new SelectCharacter(window); _imgBackGround = this.ImgBackGround(); _buttons = Buttons(); CharaterName(); _nextState = this; }
/// <summary> /// Sets the state of the application. /// </summary> /// <param name="appState">State of the application.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public bool SetAppState(IAppState appState) { lock (dbLock) { Database.AppState = Mapper.Map <IAppState>(appState); return(true); } }
public NotificationManager(IDonkyClientDataContext dataContext, INotificationService notificationService, IModuleManager moduleManager, IAppState appState, IJsonSerialiser serialiser, ILogger logger) { _dataContext = dataContext; _notificationService = notificationService; _moduleManager = moduleManager; _appState = appState; _serialiser = serialiser; _logger = logger; }
private void onLoad(object sender, EventArgs e) { Application.Idle += onIdle; AppStateInfo _savedStateData = StatusMgr.LoadSavedStateVariables(); if (_savedStateData != null) { InitializeLoadedState(_savedStateData); } else { _currentAppState = new NormalState(this);//Application starts in the normal state for new user. _currentAppState.InitializeNew(); } }
public OpenCacheViewModel(IScreen hostScreen, IAppState appState) { HostScreen = hostScreen; var isCachePathValid = this.WhenAny(x => x.CachePath, x => x.OpenAsEncryptedCache, (cp, _) => cp.Value) .Throttle(TimeSpan.FromMilliseconds(250), RxApp.DeferredScheduler) .Select(Directory.Exists); OpenCache = new ReactiveCommand(isCachePathValid); OpenCache.SelectMany(_ => openAkavacheCache(OpenAsEncryptedCache)) .LoggedCatch(this, Observable.Return<IBlobCache>(null)) .Subscribe(x => { if (x == null) { UserError.Throw("Couldn't open this cache"); return; } appState.CurrentCache = x; hostScreen.Router.Navigate.Execute(RxApp.GetService<ICacheViewModel>()); }); }
public CacheViewModel(IScreen hostScreen, IAppState appState) { HostScreen = hostScreen; appState.WhenAny(x => x.CachePath, x => x.Value) .Where(x => !String.IsNullOrWhiteSpace(x)) .Select(x => (new DirectoryInfo(x)).Name) .ToProperty(this, x => x.UrlPathSegment); Keys = new ReactiveCollection<string>(); appState.WhenAny(x => x.CurrentCache, x => x.Value).Subscribe(cache => { Keys.Clear(); cache.GetAllKeys().ForEach(x => Keys.Add(x)); }); SelectedViewer = "Text"; this.WhenAny(x => x.SelectedKey, x => x.SelectedViewer, (k,v) => k.Value) .Where(x => x != null && SelectedViewer != null) .SelectMany(x => appState.CurrentCache.GetAsync(x)) .Select(x => createValueViewModel(x, SelectedViewer)) .LoggedCatch(this, Observable.Return<ICacheValueViewModel>(null)) .ToProperty(this, x => x.SelectedValue); }
private static IPresenter PerformBinding( IView candidate, IPresenterDiscoveryStrategy presenterDiscoveryStrategy, IAppState appState, Action<IPresenter> presenterCreatedCallback, IPresenterFactory presenterFactory) { var bindings = GetBindings( candidate, presenterDiscoveryStrategy); var newPresenter = BuildPresenter( presenterCreatedCallback, //appState, presenterFactory, new[] {bindings}); return newPresenter; }
public bool Load(IAppState state){ return false; }
private void InitializeLoadedState(AppStateInfo loadedState) { if (string.Compare(loadedState.CurrentState, "RetakeState") == 0) { _currentAppState = new RetakeState(this); QABot.FailedQuestions = loadedState.FailedQuestionsList; } else if (string.Compare(loadedState.CurrentState, "NormalState") == 0) { _currentAppState = new NormalState(this); } QABot.ExerciseCount = loadedState.CurrentExerciseNo; QABot.QuestionCount = loadedState.CurrentQuestionNo; QABot.SavedAnswers = loadedState.SavedAnswers; _currentAppState.InitializeNew(); }
private void SetCurrentAppState(ComponentType appStateType) { Action onReady = () => { _currentAppState = _appStates[appStateType]; _currentAppState.StateChangeRequested += StateChangeRequestedHandler; _currentAppState.AppSize = _graphicsBase.ScreenBounds; _currentAppStateRenderer = _appStateRenderers[appStateType]; _currentAppStateRenderer.Component = _currentAppState; _currentAppStateRenderer.GraphicsBase = _graphicsBase; _gestureRecognizer.CurrentAppState = _currentAppState; _currentAppState.OnTransitionTo(); }; if (_currentAppState != null) { _currentAppState.StateChangeRequested -= StateChangeRequestedHandler; _currentAppState.OnTransitionFrom(onReady); } else onReady(); }
public DropRepoViewModel(IScreen hostScreen, IAppState appState, IRepoAnalysisProvider analyzeFunc) { HostScreen = hostScreen; AnalyzeRepo = new ReactiveAsyncCommand(); CoreUtility.ExtractLibGit2(); var scanResult = AnalyzeRepo.RegisterAsyncObservable(x => analyzeFunc.AnalyzeRepo((string) x)); scanResult.Select(x => x.Item1).ToProperty(this, x => x.CurrentRepoPath); scanResult .Select(x => x.Item2.Select(y => (IBranchInformationViewModel)new BranchInformationViewModel(y.Key, y.Value))) .Select(x => new ReactiveCollection<IBranchInformationViewModel>(x)) .ToProperty(this, x => x.BranchInformation); this.WhenAny(x => x.BranchInformation, x => x.Value != null ? Visibility.Visible : Visibility.Hidden) .ToProperty(this, x => x.RepairButtonVisibility); RepairButton = new ReactiveCommand(); RepairButton.Subscribe(_ => { appState.BranchInformation = BranchInformation.Where(x => x.BranchName != Constants.WorkingDirectory).ToArray(); appState.WorkingDirectoryInformation = BranchInformation.First(x => x.BranchName == Constants.WorkingDirectory).Model; appState.CurrentRepo = CurrentRepoPath; HostScreen.Router.Navigate.Execute(RxApp.GetService<IRepairViewModel>()); }); var viewStates = Observable.Merge( AnalyzeRepo.ItemsInflight.Where(x => x > 0).Select(_ => "Analyzing"), scanResult.Select(_ => "RepoAdded")); MessageBus.Current.RegisterMessageSource(viewStates, "DropRepoViewState"); this.WhenNavigatedTo(() => MessageBus.Current.Listen<string>("DropFolder").Subscribe(path => AnalyzeRepo.Execute(path))); }
public CommonMessagingManager(INotificationManager notificationManager, IAppState appState) { _notificationManager = notificationManager; _appState = appState; }
public DynamicQueryViewModel(IScreen hostScreen, IAppState appState) { HostScreen = hostScreen; }
public bool Store(IAppState state){ return false; }