public SetShellStatePacket(Guid clientUniqueId, Guid shellUniqueId, ShellState shellState) { ClientUniqueId = clientUniqueId; ShellUniqueId = shellUniqueId; ShellState = shellState; Type = "SetShellStatePacket"; }
protected override void OnClosing(CancelEventArgs e) { if (_isFullScreen) { ToggleFullscreen(); } ShellState state = new ShellState(); SaveShellState(ref state); try { using (MemoryStream stream = new MemoryStream()) { BinaryFormatter bin = new BinaryFormatter(); bin.Serialize(stream, state); var data = stream.ToArray(); Utils.BblRegistryKey.GetKey().SetValue("WindowCoords", data, RegistryValueKind.Binary); } } catch (IOException) { } base.OnClosing(e); }
protected override void OnExit(ExitEventArgs e) { var apiServer = _containerProvider.Resolve <IApiServer>(); apiServer.Stop(); if (_shell != null) { var state = new ShellState { Width = _shell.Width, Height = _shell.Height, Top = _shell.Top, Left = _shell.Left, State = _shell.WindowState }; var settingsService = _containerProvider.Resolve <ISettingsService>(); settingsService.SetSettingAsync(AppGlobals.SettingKeys.ShellState, state).GetAwaiter().GetResult(); _shell = null; } base.OnExit(e); Logger.Info("Exiting..."); }
public void Suggest(string commandText, params string[] expectedResults) { HttpState httpState = GetHttpState(out MockedFileSystem fileSystem, out _); ICoreParseResult parseResult = CreateCoreParseResult(commandText); IConsoleManager consoleManager = new LoggingConsoleManagerDecorator(new NullConsoleManager()); DefaultCommandDispatcher <HttpState> commandDispatcher = DefaultCommandDispatcher.Create((ss) => { }, httpState); commandDispatcher.AddCommand(new ClearCommand()); commandDispatcher.AddCommand(new ChangeDirectoryCommand()); commandDispatcher.AddCommand(new RunCommand(fileSystem)); IShellState shellState = new ShellState(commandDispatcher, consoleManager: consoleManager); HelpCommand helpCommand = new HelpCommand(); IEnumerable <string> result = helpCommand.Suggest(shellState, httpState, parseResult); Assert.NotNull(result); List <string> resultList = result.ToList(); Assert.Equal(expectedResults.Length, resultList.Count); for (int index = 0; index < expectedResults.Length; index++) { Assert.Contains(expectedResults[index], resultList, StringComparer.OrdinalIgnoreCase); } }
public ShellStateSetPacket(Guid clientUniqueId, Guid shellUniqueId, ShellState shellState, bool success) { ClientUniqueId = clientUniqueId; ShellUniqueId = shellUniqueId; ShellState = shellState; Success = success; Type = "ShellStateSetPacket"; }
/// <summary> /// Shows the view within the region and for the specified state. /// </summary> /// <typeparam name="T">The view to activate</typeparam> /// <param name="region">The region.</param> /// <param name="state">The state.</param> private void ShowView <T>(string region, ShellState state) where T : IStatefulView { var view = regionManager.Regions[region].Views.Where(aView => aView is T).FirstOrDefault(bView => ((T)bView).RegionToken == state); if (view != null) { regionManager.Regions[region].Activate(view); } }
protected override void GetHit() { _body.SetActive(false); _shell.SetActive(true); anim = _shellAnim; curStage = CurStage.shell; shellState = ShellState.idle; _isShellMoving = false; StartCoroutine("OnRecover"); }
/// <summary> /// Registers a view with a region and a shell state /// </summary> /// <typeparam name="T">The view that will be registered</typeparam> /// <param name="mainScreenRegion">The main screen region.</param> /// <param name="regionToken">The region token.</param> public static void RegisterWithRegionAndState <T>(string mainScreenRegion, ShellState regionToken) where T : IStatefulView { regionManager.RegisterViewWithRegion(mainScreenRegion, () => { var a = unityContainer.Resolve <T>(regionToken.ToString()); a.RegionToken = regionToken; return(a); }); }
private void RestoreShellState(ref ShellState state) { WindowStyle = state.windowStyle; ResizeMode = state.resizeMode; WindowState = state.windowState; Width = state.size.Width; Height = state.size.Height; Left = state.position.X; Top = state.position.Y; SetValue(WindowChrome.WindowChromeProperty, state.windowChrome); }
private void SaveShellState(ref ShellState state) { state.position.X = Left; state.position.Y = Top; state.size.Width = Width; state.size.Height = Height; state.windowState = WindowState; state.resizeMode = ResizeMode; state.windowStyle = WindowStyle; state.windowChrome = GetValue(WindowChrome.WindowChromeProperty) as WindowChrome; }
private void OnEnterShell(Collider2D col) { if (_shellState == ShellState.availabe) { haveIsOwnShell = !haveIsOwnShell; _shellState = ShellState.taken; Shell.SwapWithPlayer(); _save.SetFriendship((int)_initialShell - 1, haveIsOwnShell); } }
public MockedShellState() { DefaultCommandDispatcher<object> defaultCommandDispatcher = DefaultCommandDispatcher.Create(x => { }, new object()); Mock<IConsoleManager> mockedConsoleManager = new Mock<IConsoleManager>(); Mock<IWritable> mockedErrorWritable = new Mock<IWritable>(); mockedErrorWritable.Setup(x => x.WriteLine(It.IsAny<string>())).Callback((string s) => ErrorMessage = s); mockedConsoleManager.Setup(x => x.Error).Returns(mockedErrorWritable.Object); mockedConsoleManager.Setup(x => x.Write(It.IsAny<string>())).Callback((string s) => _output.Append(s)); mockedConsoleManager.Setup(x => x.WriteLine(It.IsAny<string>())).Callback((string s) => _output.AppendLine(s)); _shellState = new ShellState(defaultCommandDispatcher, consoleManager: mockedConsoleManager.Object); }
public async Task ExecuteAsync_CallsConsoleManagerClear() { HttpState httpState = GetHttpState(out _, out _); ICoreParseResult parseResult = CreateCoreParseResult("clear"); DefaultCommandDispatcher <HttpState> dispatcher = DefaultCommandDispatcher.Create((ss) => { }, httpState); LoggingConsoleManagerDecorator consoleManager = new LoggingConsoleManagerDecorator(new NullConsoleManager()); IShellState shellState = new ShellState(dispatcher, consoleManager: consoleManager); ClearCommand clearCommand = new ClearCommand(); await clearCommand.ExecuteAsync(shellState, httpState, parseResult, CancellationToken.None); Assert.True(consoleManager.WasClearCalled); }
protected void Awake() { Shell.OnEnterShell = OnEnterShell; _shellState = ShellState.notAvailable; _audioSource = this.GetComponent <AudioSource>(); savedPosition = this.transform.position; savedRotation = this.transform.rotation; _save = GameObject.Find("SaveController").GetComponent <Save>(); system = this.GetComponentsInChildren <ParticleSystem>(); _initialShell = Shell.Type; }
public async Task <ShellState> GetShellStateAsync() { if (_shellState != null) { return(_shellState); } _shellState = await _session.QueryAsync <ShellState>().FirstOrDefault(); if (_shellState == null) { _shellState = new ShellState(); UpdateShellState(); } return(_shellState); }
private IShellState GetShellState(string inputBuffer, HttpState httpState) { DefaultCommandDispatcher <HttpState> defaultCommandDispatcher = DefaultCommandDispatcher.Create(x => { }, httpState); defaultCommandDispatcher.AddCommand(new SetHeaderCommand(new NullTelemetry())); Mock <IConsoleManager> mockConsoleManager = new Mock <IConsoleManager>(); MockInputManager mockInputManager = new MockInputManager(inputBuffer); ShellState shellState = new ShellState(defaultCommandDispatcher, consoleManager: mockConsoleManager.Object, commandHistory: new CommandHistory(), inputManager: mockInputManager); Shell shell = new Shell(shellState); return(shell.ShellState); }
public async Task <ShellState> GetShellStateAsync() { if (_shellState != null) { return(_shellState); } _shellState = await new ValueTask <ShellState>(_context.Set <ShellState>().FirstOrDefault()); if (_shellState == null) { _shellState = new ShellState(); _context.Set <ShellState>().Add(_shellState); _context.SaveChanges(); } return(_shellState); }
private ShellFeatureState GetOrAddFeatureState(string featureName) { var shellState = GetShellState(); var feature = shellState.Features.SingleOrDefault(f => f.Name == featureName); if (feature == null) { feature = new ShellFeatureState { Name = featureName }; shellState.Features = shellState.Features.Union(new[] { feature }); } ShellState = shellState; return(feature); }
/// <summary> /// Called when [shell state changed]. /// dependind on <see cref="ShellState" /> a specific module is visible /// </summary> /// <param name="shellState">State of the shell.</param> private void OnShellStateChanged(ShellState shellState) { switch (shellState) { case ShellState.DentalRecords: // Parent.IsLoginVisible = Visibility.Collapsed; //Parent.IsContentVisible = Visibility.Visible; eventAggregator.GetEvent <UpdateDentalRecordsEvent>().Publish(null); //Parent.HorizontalTabsViewModel.OnSelectReportsTab("Pacienti"); ShowView <IWorkAreaView>(MainScreenRegions.WorkRegion, shellState); break; case ShellState.Settings: eventAggregator.GetEvent <UpdateSettingsEvent>().Publish(null); ShowView <IWorkAreaView>(MainScreenRegions.WorkRegion, shellState); break; case ShellState.Filters: eventAggregator.GetEvent <UpdateFiltersEvent>().Publish(null); ShowView <IWorkAreaView>(MainScreenRegions.WorkRegion, shellState); break; case ShellState.Reports: eventAggregator.GetEvent <UpdateReportsEvent>().Publish(null); ShowView <IWorkAreaView>(MainScreenRegions.WorkRegion, shellState); break; case ShellState.Financial: eventAggregator.GetEvent <UpdateFinancialEvent>().Publish(null); ShowView <IWorkAreaView>(MainScreenRegions.WorkRegion, shellState); break; case ShellState.PersonalData: eventAggregator.GetEvent <UpdatePersonalInfoEvent>().Publish(null); ShowView <IWorkAreaView>(MainScreenRegions.WorkRegion, shellState); break; case ShellState.Login: Parent.IsLoginVisible = Visibility.Visible; Parent.IsContentVisible = Visibility.Collapsed; ShowView <ILoginView>(MainScreenRegions.LoginRegion, shellState); break; } }
private IEnumerator Bump(Collision2D col) { Col.isTrigger = true; var start = Time.time; yield return(YieldPlay(ANIM_HIT)); _shellState = ShellState.availabe; yield return(new WaitForSeconds(HitIdle)); yield return(YieldPlay(ANIM_BACK)); _shellState = ShellState.notAvailable; Vector3 position = transform.position; Quaternion rotation = transform.rotation; float time = 0f; while (transform.position.x != savedPosition.x) { time += 0.02f; transform.position = Vector3.Lerp(position, savedPosition, time / timePositionReset); transform.rotation = Quaternion.Lerp(rotation, savedRotation, time / timePositionReset); yield return(new WaitForSeconds(0.02f)); } if (dialogueMad != null) { if (!haveIsOwnShell) { currentDialogue = Instantiate(dialogueMad, this.transform); } else { currentDialogue = Instantiate(dialogueHappy, this.transform); } } Col.isTrigger = false; _bumping = null; }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); byte[] data = Utils.BblRegistryKey.GetKey().GetValue("WindowCoords") as byte[]; if (data != null) { using (MemoryStream stream = new MemoryStream(data)) { BinaryFormatter bin = new BinaryFormatter(); try { ShellState state = new ShellState(); state = (ShellState)bin.Deserialize(stream); state.resizeMode = ResizeMode.CanResize; state.windowStyle = WindowStyle.SingleBorderWindow; state.windowChrome = this._defaultChrome; RestoreShellState(ref state); } catch { Console.WriteLine("Failed to restore main window state on Initialisation."); } } } }
private void _EnterShellMove() { var temp = this.transform.position - _player.transform.position; if (temp.x > 0) { dir.x = 1; } else { dir.x = -1; } _isCheck = true; isHit = false; shellState = ShellState.move; speed = _shellSpeed; anim.Play("Shell", 0, 0); StopCoroutine("OnRecover"); }
private Shell CreateShell(ConsoleKeyInfo consoleKeyInfo, string previousCommand, string nextCommand, out CancellationTokenSource cancellationTokenSource) { var defaultCommandDispatcher = DefaultCommandDispatcher.Create(x => { }, new object()); cancellationTokenSource = new CancellationTokenSource(); MockConsoleManager mockConsoleManager = new MockConsoleManager(consoleKeyInfo, cancellationTokenSource); Mock <ICommandHistory> mockCommandHistory = new Mock <ICommandHistory>(); mockCommandHistory.Setup(s => s.GetPreviousCommand()) .Returns(previousCommand); mockCommandHistory.Setup(s => s.GetNextCommand()) .Returns(nextCommand); ShellState shellState = new ShellState(defaultCommandDispatcher, consoleManager: mockConsoleManager, commandHistory: mockCommandHistory.Object); return(new Shell(shellState)); }
public async Task <ShellState> GetShellStateAsync() { _shellState = await Store.GetOrCreateAsync(CancellationToken); return(_shellState); }
/// <summary> /// Called when [shell state changed]. /// dependind on <see cref="ShellState" /> a specific module is visible /// </summary> /// <param name="shellState">State of the shell.</param> private void OnShellStateChanged(ShellState shellState) { }