protected Sample(Microsoft.Xna.Framework.Game game) : base(game) { // Get services from the global service container. var services = (ServiceContainer)ServiceLocator.Current; SampleFramework = services.GetInstance<SampleFramework>(); ContentManager = services.GetInstance<ContentManager>(); UIContentManager = services.GetInstance<ContentManager>("UIContent"); InputService = services.GetInstance<IInputService>(); AnimationService = services.GetInstance<IAnimationService>(); Simulation = services.GetInstance<Simulation>(); ParticleSystemService = services.GetInstance<IParticleSystemService>(); GraphicsService = services.GetInstance<IGraphicsService>(); GameObjectService = services.GetInstance<IGameObjectService>(); UIService = services.GetInstance<IUIService>(); // Create a local service container which can be modified in samples: // The local service container is a child container, i.e. it inherits the // services of the global service container. Samples can add new services // or override existing entries without affecting the global services container // or other samples. Services = services.CreateChildContainer(); // Store a copy of the original graphics screens. _originalGraphicsScreens = GraphicsService.Screens.ToArray(); // Mouse is visible by default. SampleFramework.IsMouseVisible = true; }
public RoomState(IGameState previousState, IGameStateService gameStateService, IGuiService guiService, IInputService inputService, GraphicsDeviceManager graphics, ContentManager content) { this.gameStateService = gameStateService; this.guiService = guiService; this.inputService = inputService; this.graphics = graphics; this.content = content; this.previousState = previousState; this.mouseMove = new MouseMoveDelegate(mouseMoved); this.teamA = new List<Peer>(); this.teamB = new List<Peer>(); playerIDLabels = new List<LabelControl>(); panelVisibility = new List<bool>(); roomScreen = new Screen(1184, 682); Game1.main_console.StartEvent += Start; spriteBatch = new SpriteBatch(graphics.GraphicsDevice); LoadContent(roomScreen, content); }
public MainWindow( IAudioService audioService, IDictionaryService dictionaryService, IInputService inputService) { InitializeComponent(); this.audioService = audioService; this.dictionaryService = dictionaryService; this.inputService = inputService; managementWindowRequest = new InteractionRequest<NotificationWithServices>(); //Setup key binding (Alt-C and Shift-Alt-C) to open settings InputBindings.Add(new KeyBinding { Command = new DelegateCommand(RequestManagementWindow), Modifiers = ModifierKeys.Alt, Key = Key.M }); InputBindings.Add(new KeyBinding { Command = new DelegateCommand(RequestManagementWindow), Modifiers = ModifierKeys.Shift | ModifierKeys.Alt, Key = Key.M }); Title = string.Format(Properties.Resources.WINDOW_TITLE, DiagnosticInfo.AssemblyVersion); }
public EditorBase(Microsoft.Xna.Framework.Game game) : base(game) { // Get services from the global service container. var services = (ServiceContainer)ServiceLocator.Current; UIContentManager = services.GetInstance<ContentManager>("UIContent"); InputService = services.GetInstance<IInputService>(); AnimationService = services.GetInstance<IAnimationService>(); GraphicsService = services.GetInstance<IGraphicsService>(); GameObjectService = services.GetInstance<IGameObjectService>(); UIService = services.GetInstance<IUIService>(); // Create a local service container which can be modified in samples: // The local service container is a child container, i.e. it inherits the // services of the global service container. Samples can add new services // or override existing entries without affecting the global services container // or other samples. Services = services.CreateChildContainer(); // Load a UI theme, which defines the appearance and default values of UI controls. Theme theme = UIContentManager.Load<Theme>("BlendBlue/Theme"); FigureRenderer = new FigureRenderer(GraphicsService, 2000); DebugRenderer = new DebugRenderer(GraphicsService, UIContentManager.Load<SpriteFont>("BlendBlue/Default")); UIRenderer = new UIRenderer(GraphicsService.GraphicsDevice, theme); UIScreen = new UIScreen("Main Screen", UIRenderer) { Background = Color.TransparentBlack, }; UIService.Screens.Add(UIScreen); Scene = new Scene(); }
public override void Initialize() { base.Initialize(); inputService = (IInputService)this.Game.Services.GetService(typeof(IInputService)); #if WINDOWS spriteService = (ISpriteService)this.Game.Services.GetService(typeof(ISpriteService)); this.mousePointerTexture = this.Game.Content.Load<Texture2D>("Windows/Textures/Arrow"); this.mouseSprite = new TextureSprite( new SpriteTexture(this.mousePointerTexture, null), new Point(-this.mousePointerTexture.Width, -this.mousePointerTexture.Height), 0, true, null); spriteService.AttachSprite(this.mouseSprite); #endif IMouse mouse = this.inputService.GetMouse(); MouseState mouseState = mouse.GetState(); mousePosition = new Point (mouseState.X, mouseState.Y); mouse.Moved += new MouseMovedDelegate(Mouse_Moved); }
public GameController( Game game, ICollisionDetectionService collisionDetectionService, IPlayerService playerService, IEnemyService enemyService, IInputService inputService, IHeadUpDisplayService headUpDisplayService, ITerrainService terrainService, IAudioService audioService) : base(game) { this.game = game; this.collisionDetectionService = collisionDetectionService; this.playerService = playerService; this.enemyService = enemyService; this.inputService = inputService; this.headUpDisplayService = headUpDisplayService; this.terrainService = terrainService; this.audioService = audioService; this.inputService.AnalogPauseChanged += delegate { this.isGamePaused = !this.isGamePaused; }; this.inputService.PauseChanged += delegate { this.isGamePaused = !this.isGamePaused; }; this.fadeEffect = "FadeIn"; }
/// <summary> /// Initializes a new instance of the <see cref="GuiGraphicsScreen"/> class. /// </summary> /// <param name="services">The service locator.</param> public GuiGraphicsScreen(IServiceLocator services) : base(services.GetInstance<IGraphicsService>()) { Name = "GUI"; // Just for debugging. // Get required services. _inputService = services.GetInstance<IInputService>(); _uiService = services.GetInstance<IUIService>(); var contentManager = services.GetInstance<ContentManager>("UIContent"); // Load a UI theme and create the UI renderer and the UI screen. See the // DigitalRune Game UI documentation and samples for more details. var theme = contentManager.Load<Theme>("UI Themes/BlendBlue/Theme"); var renderer = new UIRenderer(GraphicsService.GraphicsDevice, theme); UIScreen = new UIScreen("Default", renderer) { Background = Color.Transparent, ZIndex = int.MaxValue, }; _uiService.Screens.Add(UIScreen); // When the background is hidden, the UIScreen should block all input. UIScreen.InputProcessed += (s, e) => { if (HideBackground) { // Set all input devices to 'handled'. _inputService.IsGamePadHandled(LogicalPlayerIndex.Any); _inputService.IsKeyboardHandled = true; _inputService.IsMouseOrTouchHandled = true; } }; }
public override void Update(GameTime gameTime) { if (m_InputService == null) { m_InputService = Game.Services.GetService(typeof(IInputService)) as IInputService; } m_IsKeyDown = false; m_WasPressed = false; foreach (Keys key in m_Keys) { if (Keyboard.GetState().IsKeyDown(key)) { m_IsKeyDown = true; break; } } foreach (Keys key in m_Keys) { if (m_InputService.WasKeyPressed(key)) { m_WasPressed = true; break; } } if (m_WasPressed && KeyWasPressed != null) { KeyWasPressed(this); } }
public Camera(Game game) : base(game) { _inputService = (IInputService)game.Services.GetService(typeof(IInputService)); ResetPose(); }
public MeazureRunner(ITaskService taskService, ITimeService timeService, IInputService inputService, IProjectService projectService) { _taskService = taskService; _timeService = timeService; _inputService = inputService; _projectService = projectService; }
public MainViewModel( IAudioService audioService, ICalibrationService calibrationService, IDictionaryService dictionaryService, IKeyStateService keyStateService, ISuggestionStateService suggestionService, ICapturingStateManager capturingStateManager, ILastMouseActionStateManager lastMouseActionStateManager, IInputService inputService, IKeyboardOutputService keyboardOutputService, IMouseOutputService mouseOutputService, IWindowManipulationService mainWindowManipulationService, List<INotifyErrors> errorNotifyingServices) { this.audioService = audioService; this.calibrationService = calibrationService; this.dictionaryService = dictionaryService; this.keyStateService = keyStateService; this.suggestionService = suggestionService; this.capturingStateManager = capturingStateManager; this.lastMouseActionStateManager = lastMouseActionStateManager; this.inputService = inputService; this.keyboardOutputService = keyboardOutputService; this.mouseOutputService = mouseOutputService; this.mainWindowManipulationService = mainWindowManipulationService; this.errorNotifyingServices = errorNotifyingServices; calibrateRequest = new InteractionRequest<NotificationWithCalibrationResult>(); SelectionMode = SelectionModes.Key; InitialiseKeyboard(mainWindowManipulationService); AttachScratchpadEnabledListener(); AttachKeyboardSupportsCollapsedDockListener(mainWindowManipulationService); AttachKeyboardSupportsSimulateKeyStrokesListener(); }
public CalculatorReplLoop(ICalculator calculator, IInputService inputService, IOutputService outputService, IInputParserService parsingService) { this.calculator = calculator; this.inputService = inputService; this.outputService = outputService; this.parsingService = parsingService; }
public Heroi(Game game, IMap map) : base(game, game.Content.Load<Texture2D>("Textures/CarroHeroi")) { this.game = game; this.map = map; Collidable = true; //Move(new Vector2(listadepistas.ElementAt(1), 0)); botaoEsquerda = game.Content.Load<Texture2D>("Widgets/botaoEsquerda"); botaoDireita = game.Content.Load<Texture2D>("Widgets/botaoDireita"); retEsquerda = new Rectangle(20, game.Window.ClientBounds.Height - game.Window.ClientBounds.Height /4, 120, 120); retDireita = new Rectangle(game.Window.ClientBounds.Width - 150, game.Window.ClientBounds.Height - game.Window.ClientBounds.Height / 4, 120, 120); input = (IInputService)game.Services.GetService(typeof(IInputService)); _fixY = game.Window.ClientBounds.Height - (Texture.Height * 2); Location= new Vector2( game.Window.ClientBounds.Width / 2 , _fixY); int TheSeed = (int)DateTime.Now.Ticks; random = new Random(TheSeed); timeCount = 1000; }
public LobbyState(IGameStateService gameStateService, IGuiService guiService, IInputService inputService, GraphicsDeviceManager graphics, ContentManager content, String username) { allRoom = Game1.main_console.ListRooms(); this.gameStateService = gameStateService; this.guiService = guiService; this.inputService = inputService; this.graphics = graphics; this.content = content; this.username = username; this.page = 0; roomIDLabels = new List<LabelControl>(); roomCapLabels = new List<LabelControl>(); joinButtons = new List<ButtonControl>(); panelVisibility = new List<bool>(); joinEventHandlers = new List<EventHandler>(); this.mouseMove = new MouseMoveDelegate(mouseMoved); lobbyScreen = new Screen(1194, 692); /*mainMenuScreen.Desktop.Bounds = new UniRectangle( new UniScalar(0.1f, 0.0f), new UniScalar(0.1f, 0.0f), // x and y = 10% new UniScalar(0.8f, 0.0f), new UniScalar(0.8f, 0.0f) // width and height = 80% );*/ spriteBatch = new SpriteBatch(graphics.GraphicsDevice); LoadContent(lobbyScreen, content); }
public PlayerService(Game game, IInputService inputService, IAudioService audioService, IPlayerFactory playerFactory, ITerrainService terrainService) : base(game) { this.inputService = inputService; this.audioService = audioService; this.playerFactory = playerFactory; this.terrainService = terrainService; }
//-------------------------------------------------------------- #region Creation & Cleanup //-------------------------------------------------------------- public VehicleCameraObject(IGeometricObject vehicle, IServiceLocator services) { Name = "VehicleCamera"; _vehicle = vehicle; _services = services; _inputService = services.GetInstance<IInputService>(); }
private bool _showSleeping = true; // Determines whether sleeping objects should be visualized. #endregion Fields #region Constructors public RigidBodyRenderer(Game game) : base(game) { _inputService = (IInputService)game.Services.GetService(typeof(IInputService)); _simulation = (Simulation)game.Services.GetService(typeof(Simulation)); DrawWireFrame = true; }
public MenuScreen(Microsoft.Xna.Framework.Game game) : base() { _game = (GameManager)game; _contentService = (ContentManager)game.Services.GetService(typeof(ContentManager)); _inputService = (IInputService)game.Services.GetService(typeof(IInputService)); _uiService = (IUIService)game.Services.GetService(typeof(IUIService)); }
public MainMenuComponent(Microsoft.Xna.Framework.Game game, IServiceLocator services) : base(game) { _services = services; _inputService = services.GetInstance<IInputService>(); _graphicsService = services.GetInstance<IGraphicsService>(); _uiService = services.GetInstance<IUIService>(); }
public ExplosionObject(IServiceLocator services) { Name = "Explosion"; _inputService = services.GetInstance<IInputService>(); _simulation = services.GetInstance<Simulation>(); _gameObjectService = services.GetInstance<IGameObjectService>(); }
//-------------------------------------------------------------- #region Creation & Cleanup //-------------------------------------------------------------- public ThirdPersonCameraObject(CharacterControllerObject characterControllerObject, IServiceLocator services) { Name = "ThirdPersonCamera"; _characterControllerObject = characterControllerObject; _services = services; _inputService = services.GetInstance<IInputService>(); }
public JiraRunner(IOutputService outputService, ITaskService taskService, ITimeService timeService, IProjectService projectService, IInputService inputService) { _outputService = outputService; _taskService = taskService; _timeService = timeService; _projectService = projectService; _inputService = inputService; }
public void Update(GameTime gameTime, IInputService input) { _menuButton1.Update(gameTime); _menuButton2.Update(gameTime); _menuButton3.Update(gameTime); if (input.CheckMouseLeft()) MouseClicked(input.CheckMousePosition().X, input.CheckMousePosition().Y); }
public JiraProjectRepository(ISettingsService settingsService, IInputService inputService) : base(settingsService, inputService) { // the project and time repositories use different API's but the same user and password // question: how do I best go about getting the correct urls? // do I just assume that the last portion of the url will always be the same? // we'll go down that route for now _api = new JiraApi(JiraUser, ApiBaseUrl); }
public NaggerRunner(ITimeService timeService, IInputService inputService, IOutputService outputService, IRemoteRunner remoteRunner, ISettingsService settingsService) { _timeService = timeService; _inputService = inputService; _outputService = outputService; _remoteRunner = remoteRunner; _settingsService = settingsService; }
public BallShooterObject(IServiceLocator services) { Name = "BallShooter"; Speed = 100; _inputService = services.GetInstance<IInputService>(); _simulation = services.GetInstance<Simulation>(); _gameObjectService = services.GetInstance<IGameObjectService>(); }
public Menu(Game game, string backgroundAsset, string playAsset) : base(game) { this.backgroundAsset = backgroundAsset; this.playAsset = playAsset; inputManager = (IInputService)game.Services.GetService(typeof(IInputService)); spriteBatch = (SpriteBatch)game.Services.GetService(typeof(SpriteBatch)); }
protected override sealed void SpecificInitialize() { m_InputService = Game.Services.GetService(typeof(IInputService)) as IInputService; m_SoundService = Game.Services.GetService(typeof(ISoundService)) as ISoundService; m_Menu.Position = new Vector2(30); CreateMenuItems(); m_Menu.Initialize(); }
public WorldCursor(WorldModel model) { m_Network = Service.Get<INetworkClient>(); m_UserInterface = Service.Get<UserInterfaceService>(); m_Input = Service.Get<IInputService>(); m_World = model; InternalRegisterInteraction(); }
public Editor2DCameraObject(IServiceLocator services) { Name = "Editor2DCamera"; _services = services; _inputService = services.GetInstance<IInputService>(); _animationService = services.GetInstance<IAnimationService>(); IsEnabled = true; }
public ConstraintVehicleObject(IServiceLocator services) { Name = "Vehicle"; _services = services; _inputService = services.GetInstance <IInputService>(); _simulation = services.GetInstance <Simulation>(); // Load models for rendering. var contentManager = services.GetInstance <ContentManager>(); _vehicleModelNode = contentManager.Load <ModelNode>("Car/Car").Clone(); _wheelModelNodes = new ModelNode[4]; _wheelModelNodes[0] = contentManager.Load <ModelNode>("Car/Wheel").Clone(); _wheelModelNodes[1] = _wheelModelNodes[0].Clone(); _wheelModelNodes[2] = _wheelModelNodes[0].Clone(); _wheelModelNodes[3] = _wheelModelNodes[0].Clone(); // Add wheels under the car model node. _vehicleModelNode.Children.Add(_wheelModelNodes[0]); _vehicleModelNode.Children.Add(_wheelModelNodes[1]); _vehicleModelNode.Children.Add(_wheelModelNodes[2]); _vehicleModelNode.Children.Add(_wheelModelNodes[3]); // ----- Create the chassis of the car. // The Vehicle needs a rigid body that represents the chassis. This can be any shape (e.g. // a simple BoxShape). In this example we will build a convex polyhedron from the car model. // 1. Extract the vertices from the car model. // The car model has ~10,000 vertices. It consists of a MeshNode for the glass // parts and a MeshNode "Car" for the chassis. var meshNode = _vehicleModelNode.GetDescendants() .OfType <MeshNode>() .First(mn => mn.Name == "Car"); var mesh = MeshHelper.ToTriangleMesh(meshNode.Mesh); // Apply the transformation of the mesh node. mesh.Transform(meshNode.PoseWorld * Matrix.CreateScale(meshNode.ScaleWorld)); // 2. (Optional) Create simplified convex hull from mesh. // We could also skip this step and directly create a convex polyhedron from the mesh using // var chassisShape = new ConvexPolyhedron(mesh.Vertices); // However, the convex polyhedron would still have 500-600 vertices. // We can reduce the number of vertices by using the GeometryHelper. // Create a convex hull for mesh with max. 64 vertices. Additional, shrink the hull by 4 cm. var convexHull = GeometryHelper.CreateConvexHull(mesh.Vertices, 64, -0.04f); // 3. Create convex polyhedron shape using the vertices of the convex hull. var chassisShape = new ConvexPolyhedron(convexHull.Vertices.Select(v => v.Position)); // (Note: Building convex hulls and convex polyhedra are time-consuming. To save loading time // we should build the shape in the XNA content pipeline. See other DigitalRune Physics // Samples.) // The mass properties of the car. We use a mass of 800 kg. var mass = MassFrame.FromShapeAndMass(chassisShape, Vector3.One, 800, 0.1f, 1); // Trick: We artificially modify the center of mass of the rigid body. Lowering the center // of mass makes the car more stable against rolling in tight curves. // We could also modify mass.Inertia for other effects. var pose = mass.Pose; pose.Position.Y -= 0.5f; // Lower the center of mass. pose.Position.Z = -0.5f; // The center should be below the driver. // (Note: The car model is not exactly centered.) mass.Pose = pose; // Material for the chassis. var material = new UniformMaterial { Restitution = 0.1f, StaticFriction = 0.2f, DynamicFriction = 0.2f }; var chassis = new RigidBody(chassisShape, mass, material) { Pose = new Pose(new Vector3(0, 2, 0)), // Start position UserData = "NoDraw", // (Remove this line to render the collision model.) }; // ----- Create the vehicle. Vehicle = new ConstraintVehicle(_simulation, chassis); // Add 4 wheels. Vehicle.Wheels.Add(new ConstraintWheel { Offset = new Vector3(-0.9f, 0.6f, -2.0f), Radius = 0.36f, SuspensionRestLength = 0.55f, MinSuspensionLength = 0.25f, Friction = 2 }); // Front left Vehicle.Wheels.Add(new ConstraintWheel { Offset = new Vector3(0.9f, 0.6f, -2.0f), Radius = 0.36f, SuspensionRestLength = 0.55f, MinSuspensionLength = 0.25f, Friction = 2 }); // Front right Vehicle.Wheels.Add(new ConstraintWheel { Offset = new Vector3(-0.9f, 0.6f, 0.98f), Radius = 0.36f, SuspensionRestLength = 0.55f, MinSuspensionLength = 0.25f, Friction = 1.8f }); // Back left Vehicle.Wheels.Add(new ConstraintWheel { Offset = new Vector3(0.9f, 0.6f, 0.98f), Radius = 0.36f, SuspensionRestLength = 0.55f, MinSuspensionLength = 0.25f, Friction = 1.8f }); // Back right // Vehicles are disabled per default. This way we can create the vehicle and the simulation // objects are only added when needed. Vehicle.Enabled = false; }
InstallationPluginOptions IInstallationPluginOptionsFactory.Aquire(Target target, IOptionsService optionsService, IInputService inputService, RunLevel runLevel) => new NullInstallationOptions();
public override SftpOptions Aquire(Target target, IOptionsService optionsService, IInputService inputService, RunLevel runLevel) { return(new SftpOptions(BaseAquire(target, optionsService, inputService, runLevel)) { Credential = new NetworkCredentialOptions(optionsService, inputService) }); }
public SelfHosting(ScheduledRenewal renewal, Target target, string identifier, ILogService log, IInputService input, ProxyService proxy) : base(log, input, proxy, renewal, target, identifier) { try { var prefix = $"http://+:{target.ValidationPort ?? 80}/.well-known/acme-challenge/"; _files = new Dictionary <string, string>(); _listener = new HttpListener(); _listener.Prefixes.Add(prefix); _listener.Start(); _listeningTask = Task.Run(RecieveRequests); } catch { _log.Error("Unable to activate HttpListener, this may be due to non-Microsoft webserver using port 80"); throw; } }
public EasingWindow(IServiceLocator services) : base(services) { _inputService = services.GetInstance <IInputService>(); _animationService = services.GetInstance <IAnimationService>(); Title = "EasingWindow"; StackPanel stackPanel = new StackPanel { Margin = new Vector4(8) }; Content = stackPanel; TextBlock textBlock = new TextBlock { Text = "Test different Easing Functions in this window.", Margin = new Vector4(0, 0, 0, 8), }; stackPanel.Children.Add(textBlock); StackPanel horizontalPanel = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Vector4(0, 0, 0, 8) }; stackPanel.Children.Add(horizontalPanel); textBlock = new TextBlock { Text = "Easing Function:", Width = 80, Margin = new Vector4(0, 0, 8, 0), }; horizontalPanel.Children.Add(textBlock); _functionDropDown = new DropDownButton { Width = 100, // The DropDownButton automatically converts the items to string (using ToString) and // displays this string. This is not helpful for this sort of items. We want to display // the type name of the items instead. The following is a callback which creates a // TextBlock for each item. It is called when the drop-down list is opened. CreateControlForItem = item => new TextBlock { Text = item.GetType().Name }, }; horizontalPanel.Children.Add(_functionDropDown); _functionDropDown.Items.Add(new BackEase()); _functionDropDown.Items.Add(new BounceEase()); _functionDropDown.Items.Add(new CircleEase()); _functionDropDown.Items.Add(new CubicEase()); _functionDropDown.Items.Add(new ElasticEase()); _functionDropDown.Items.Add(new ExponentialEase()); _functionDropDown.Items.Add(new LogarithmicEase()); _functionDropDown.Items.Add(new HermiteEase()); _functionDropDown.Items.Add(new PowerEase()); _functionDropDown.Items.Add(new QuadraticEase()); _functionDropDown.Items.Add(new QuinticEase()); _functionDropDown.Items.Add(new SineEase()); _functionDropDown.SelectedIndex = 0; horizontalPanel = new StackPanel { Orientation = Orientation.Horizontal, Margin = new Vector4(0, 0, 0, 8) }; stackPanel.Children.Add(horizontalPanel); textBlock = new TextBlock { Text = "Easing Mode:", Width = 80, Margin = new Vector4(0, 0, 8, 0), }; horizontalPanel.Children.Add(textBlock); _modeDropDown = new DropDownButton { Width = 100, }; horizontalPanel.Children.Add(_modeDropDown); _modeDropDown.Items.Add(EasingMode.EaseIn); _modeDropDown.Items.Add(EasingMode.EaseOut); _modeDropDown.Items.Add(EasingMode.EaseInOut); _modeDropDown.SelectedIndex = 0; _slider = new Slider { Margin = new Vector4(0, 16, 0, 0), SmallChange = 0.01f, LargeChange = 0.1f, Minimum = -0.5f, Maximum = 1.5f, Width = 250, HorizontalAlignment = HorizontalAlignment.Center, }; stackPanel.Children.Add(_slider); // Display the current value of the slider. var valueLabel = new TextBlock { Text = _slider.Value.ToString("F2"), HorizontalAlignment = HorizontalAlignment.Center, Margin = new Vector4(0, 0, 0, 8), }; stackPanel.Children.Add(valueLabel); // Update the text every time the slider value changes. var valueProperty = _slider.Properties.Get <float>("Value"); valueProperty.Changed += (s, e) => valueLabel.Text = e.NewValue.ToString("F2"); Button button = new Button { Content = new TextBlock { Text = "Animate" }, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Vector4(0, 0, 0, 8), }; button.Click += OnButtonClicked; stackPanel.Children.Add(button); textBlock = new TextBlock { Text = "(Press the Animate button to animate the slider\n" + "value using the selected EasingFunction.\n" + "The slider goes from -0.5 to 1.5. The animation\n" + "animates the value to 0 or to 1.)", }; stackPanel.Children.Add(textBlock); // When the window is loaded, the window appears under the mouse cursor and flies to // its position. Vector2F mousePosition = _inputService.MousePosition; // The loading animation is a timeline group of three animations: // - One animations animates the RenderScale from (0, 0) to its current value. // - The other animations animate the X and Y positions from the mouse position // to current values. // The base class AnimatedWindow will apply this timeline group on this window // when the window is loaded. TimelineGroup timelineGroup = new TimelineGroup { new Vector2FFromToByAnimation { TargetProperty = "RenderScale", From = new Vector2F(0, 0), Duration = TimeSpan.FromSeconds(0.3), EasingFunction = new HermiteEase { Mode = EasingMode.EaseOut }, }, new SingleFromToByAnimation { TargetProperty = "X", From = mousePosition.X, Duration = TimeSpan.FromSeconds(0.3), }, new SingleFromToByAnimation { TargetProperty = "Y", From = mousePosition.Y, Duration = TimeSpan.FromSeconds(0.3), EasingFunction = new QuadraticEase { Mode = EasingMode.EaseIn }, }, }; // The default FillBehavior is "Hold". But this animation can be removed when it is finished. // It should not "Hold" the animation value. If FillBehavior is set to Hold, we cannot // drag the window with the mouse because the animation overrides the value. timelineGroup.FillBehavior = FillBehavior.Stop; LoadingAnimation = timelineGroup; // The closing animation is a timeline group of three animations: // - One animations animates the RenderScale to (0, 0). // - The other animations animate the X and Y positions to the mouse position. // The base class AnimatedWindow will apply this timeline group on this window // when the window is loaded. ClosingAnimation = new TimelineGroup { new Vector2FFromToByAnimation { TargetProperty = "RenderScale", To = new Vector2F(0, 0), Duration = TimeSpan.FromSeconds(0.3), EasingFunction = new HermiteEase { Mode = EasingMode.EaseIn }, }, new SingleFromToByAnimation { TargetProperty = "X", To = mousePosition.X, Duration = TimeSpan.FromSeconds(0.3), }, new SingleFromToByAnimation { TargetProperty = "Y", To = mousePosition.Y, Duration = TimeSpan.FromSeconds(0.3), EasingFunction = new QuadraticEase { Mode = EasingMode.EaseOut }, }, }; }
private async void App_OnStartup(object sender, StartupEventArgs e) { try { Log.Info("Boot strapping the services and UI."); //Apply theme applyTheme(); //Define MainViewModel before services so I can setup a delegate to call into the MainViewModel //This is to work around the fact that the MainViewModel is created after the services. MainViewModel mainViewModel = null; Action <KeyValue> fireKeySelectionEvent = kv => { if (mainViewModel != null) //Access to modified closure is a good thing here, for once! { mainViewModel.FireKeySelectionEvent(kv); } }; //Create services var errorNotifyingServices = new List <INotifyErrors>(); IAudioService audioService = new AudioService(); IDictionaryService dictionaryService = new DictionaryService(); IPublishService publishService = new PublishService(); ISuggestionStateService suggestionService = new SuggestionStateService(); ICalibrationService calibrationService = CreateCalibrationService(); ICapturingStateManager capturingStateManager = new CapturingStateManager(audioService); ILastMouseActionStateManager lastMouseActionStateManager = new LastMouseActionStateManager(); IKeyStateService keyStateService = new KeyStateService(suggestionService, capturingStateManager, lastMouseActionStateManager, calibrationService, fireKeySelectionEvent); IInputService inputService = CreateInputService(keyStateService, dictionaryService, audioService, calibrationService, capturingStateManager, errorNotifyingServices); IKeyboardOutputService keyboardOutputService = new KeyboardOutputService(keyStateService, suggestionService, publishService, dictionaryService, fireKeySelectionEvent); IMouseOutputService mouseOutputService = new MouseOutputService(publishService); errorNotifyingServices.Add(audioService); errorNotifyingServices.Add(dictionaryService); errorNotifyingServices.Add(publishService); errorNotifyingServices.Add(inputService); //Release keys on application exit ReleaseKeysOnApplicationExit(keyStateService, publishService); //Compose UI var mainWindow = new MainWindow(audioService, dictionaryService, inputService); IWindowManipulationService mainWindowManipulationService = new WindowManipulationService( mainWindow, () => Settings.Default.MainWindowOpacity, () => Settings.Default.MainWindowState, () => Settings.Default.MainWindowPreviousState, () => Settings.Default.MainWindowFloatingSizeAndPosition, () => Settings.Default.MainWindowDockPosition, () => Settings.Default.MainWindowDockSize, () => Settings.Default.MainWindowFullDockThicknessAsPercentageOfScreen, () => Settings.Default.MainWindowCollapsedDockThicknessAsPercentageOfFullDockThickness, () => Settings.Default.MainWindowMinimisedPosition, o => { Settings.Default.MainWindowOpacity = o; try { Settings.Default.Save(); } catch (ConfigurationErrorsException cee) { Log.Warn("Exception encountered (and handled) when attempting to update and save the user settings", cee); Settings.Default.Reload(); Settings.Default.MainWindowOpacity = o; Settings.Default.Save(); } }, state => { Settings.Default.MainWindowState = state; try { Settings.Default.Save(); } catch (ConfigurationErrorsException cee) { Log.Warn("Exception encountered (and handled) when attempting to update and save the user settings", cee); Settings.Default.Reload(); Settings.Default.MainWindowState = state; Settings.Default.Save(); } }, state => { Settings.Default.MainWindowPreviousState = state; try { Settings.Default.Save(); } catch (ConfigurationErrorsException cee) { Log.Warn("Exception encountered (and handled) when attempting to update and save the user settings", cee); Settings.Default.Reload(); Settings.Default.MainWindowPreviousState = state; Settings.Default.Save(); } }, rect => { Settings.Default.MainWindowFloatingSizeAndPosition = rect; try { Settings.Default.Save(); } catch (ConfigurationErrorsException cee) { Log.Warn("Exception encountered (and handled) when attempting to update and save the user settings", cee); Settings.Default.Reload(); Settings.Default.MainWindowFloatingSizeAndPosition = rect; Settings.Default.Save(); } }, pos => { Settings.Default.MainWindowDockPosition = pos; try { Settings.Default.Save(); } catch (ConfigurationErrorsException cee) { Log.Warn("Exception encountered (and handled) when attempting to update and save the user settings", cee); Settings.Default.Reload(); Settings.Default.MainWindowDockPosition = pos; Settings.Default.Save(); } }, size => { Settings.Default.MainWindowDockSize = size; try { Settings.Default.Save(); } catch (ConfigurationErrorsException cee) { Log.Warn("Exception encountered (and handled) when attempting to update and save the user settings", cee); Settings.Default.Reload(); Settings.Default.MainWindowDockSize = size; Settings.Default.Save(); } }, t => { Settings.Default.MainWindowFullDockThicknessAsPercentageOfScreen = t; try { Settings.Default.Save(); } catch (ConfigurationErrorsException cee) { Log.Warn("Exception encountered (and handled) when attempting to update and save the user settings", cee); Settings.Default.Reload(); Settings.Default.MainWindowFullDockThicknessAsPercentageOfScreen = t; Settings.Default.Save(); } }, t => { Settings.Default.MainWindowCollapsedDockThicknessAsPercentageOfFullDockThickness = t; try { Settings.Default.Save(); } catch (ConfigurationErrorsException cee) { Log.Warn("Exception encountered (and handled) when attempting to update and save the user settings", cee); Settings.Default.Reload(); Settings.Default.MainWindowCollapsedDockThicknessAsPercentageOfFullDockThickness = t; Settings.Default.Save(); } }); errorNotifyingServices.Add(mainWindowManipulationService); mainViewModel = new MainViewModel( audioService, calibrationService, dictionaryService, keyStateService, suggestionService, capturingStateManager, lastMouseActionStateManager, inputService, keyboardOutputService, mouseOutputService, mainWindowManipulationService, errorNotifyingServices); mainWindow.MainView.DataContext = mainViewModel; //Setup actions to take once main view is loaded (i.e. the view is ready, so hook up the services which kicks everything off) Action postMainViewLoaded = mainViewModel.AttachServiceEventHandlers; if (mainWindow.MainView.IsLoaded) { postMainViewLoaded(); } else { RoutedEventHandler loadedHandler = null; loadedHandler = (s, a) => { postMainViewLoaded(); mainWindow.MainView.Loaded -= loadedHandler; //Ensure this handler only triggers once }; mainWindow.MainView.Loaded += loadedHandler; } //Show the main window mainWindow.Show(); //Display splash screen and check for updates (and display message) after the window has been sized and positioned for the 1st time EventHandler sizeAndPositionInitialised = null; sizeAndPositionInitialised = async(_, __) => { mainWindowManipulationService.SizeAndPositionInitialised -= sizeAndPositionInitialised; //Ensure this handler only triggers once await ShowSplashScreen(inputService, audioService, mainViewModel); inputService.RequestResume(); //Start the input service await CheckForUpdates(inputService, audioService, mainViewModel); }; if (mainWindowManipulationService.SizeAndPositionIsInitialised) { sizeAndPositionInitialised(null, null); } else { mainWindowManipulationService.SizeAndPositionInitialised += sizeAndPositionInitialised; } } catch (Exception ex) { Log.Error("Error starting up application", ex); throw; } }
Target ITargetPlugin.Aquire(IOptionsService optionsService, IInputService inputService, RunLevel runLevel) { var input = inputService.RequestString("Enter comma-separated list of host names, starting with the primary one"); return(Create(input)); }
public Mars(IInputService inputService, IOutputService outputService, IDirection direction) { this.inputService = inputService; this.outputService = outputService; this.direction = direction; }
private void App_OnStartup(object sender, StartupEventArgs e) { try { Log.Info("Boot strapping the services and UI."); // We manually close this because automatic closure steals focus from the // dynamic splash screen. splashScreen.Close(TimeSpan.FromSeconds(0.5f)); //Apply theme applyTheme(); //Define MainViewModel before services so I can setup a delegate to call into the MainViewModel //This is to work around the fact that the MainViewModel is created after the services. MainViewModel mainViewModel = null; Action <KeyValue> fireKeySelectionEvent = kv => { if (mainViewModel != null) //Access to modified closure is a good thing here, for once! { mainViewModel.FireKeySelectionEvent(kv); } }; CleanupAndPrepareCommuniKateInitialState(); ValidateDynamicKeyboardLocation(); // Handle plugins. Validate if directory exists and is accessible and pre-load all plugins, building a in-memory list of available ones. ValidatePluginsLocation(); if (Settings.Default.EnablePlugins) { PluginEngine.LoadAvailablePlugins(); } var presageInstallationProblem = PresageInstallationProblemsDetected(); //Create services var errorNotifyingServices = new List <INotifyErrors>(); IAudioService audioService = new AudioService(); IDictionaryService dictionaryService = new DictionaryService(Settings.Default.SuggestionMethod); IPublishService publishService = new PublishService(); ISuggestionStateService suggestionService = new SuggestionStateService(); ICalibrationService calibrationService = CreateCalibrationService(); ICapturingStateManager capturingStateManager = new CapturingStateManager(audioService); ILastMouseActionStateManager lastMouseActionStateManager = new LastMouseActionStateManager(); IKeyStateService keyStateService = new KeyStateService(suggestionService, capturingStateManager, lastMouseActionStateManager, calibrationService, fireKeySelectionEvent); IInputService inputService = CreateInputService(keyStateService, dictionaryService, audioService, calibrationService, capturingStateManager, errorNotifyingServices); IKeyboardOutputService keyboardOutputService = new KeyboardOutputService(keyStateService, suggestionService, publishService, dictionaryService, fireKeySelectionEvent); IMouseOutputService mouseOutputService = new MouseOutputService(publishService); errorNotifyingServices.Add(audioService); errorNotifyingServices.Add(dictionaryService); errorNotifyingServices.Add(publishService); errorNotifyingServices.Add(inputService); ReleaseKeysOnApplicationExit(keyStateService, publishService); //Compose UI var mainWindow = new MainWindow(audioService, dictionaryService, inputService, keyStateService); IWindowManipulationService mainWindowManipulationService = CreateMainWindowManipulationService(mainWindow); errorNotifyingServices.Add(mainWindowManipulationService); mainWindow.WindowManipulationService = mainWindowManipulationService; //Subscribing to the on closing events. mainWindow.Closing += dictionaryService.OnAppClosing; mainViewModel = new MainViewModel( audioService, calibrationService, dictionaryService, keyStateService, suggestionService, capturingStateManager, lastMouseActionStateManager, inputService, keyboardOutputService, mouseOutputService, mainWindowManipulationService, errorNotifyingServices); mainWindow.SetMainViewModel(mainViewModel); //Setup actions to take once main view is loaded (i.e. the view is ready, so hook up the services which kicks everything off) Action postMainViewLoaded = () => { mainViewModel.AttachErrorNotifyingServiceHandlers(); mainViewModel.AttachInputServiceEventHandlers(); }; mainWindow.AddOnMainViewLoadedAction(postMainViewLoaded); //Show the main window mainWindow.Show(); if (Settings.Default.LookToScrollShowOverlayWindow) { // Create the overlay window, but don't show it yet. It'll make itself visible when the conditions are right. new LookToScrollOverlayWindow(mainViewModel); } //Display splash screen and check for updates (and display message) after the window has been sized and positioned for the 1st time EventHandler sizeAndPositionInitialised = null; sizeAndPositionInitialised = async(_, __) => { mainWindowManipulationService.SizeAndPositionInitialised -= sizeAndPositionInitialised; //Ensure this handler only triggers once await ShowSplashScreen(inputService, audioService, mainViewModel, OptiKey.Properties.Resources.OPTIKEY_CHAT_DESCRIPTION); await mainViewModel.RaiseAnyPendingErrorToastNotifications(); await AttemptToStartMaryTTSService(inputService, audioService, mainViewModel); await AlertIfPresageBitnessOrBootstrapOrVersionFailure(presageInstallationProblem, inputService, audioService, mainViewModel); inputService.RequestResume(); //Start the input service await CheckForUpdates(inputService, audioService, mainViewModel); }; if (mainWindowManipulationService.SizeAndPositionIsInitialised) { sizeAndPositionInitialised(null, null); } else { mainWindowManipulationService.SizeAndPositionInitialised += sizeAndPositionInitialised; } Current.Exit += (o, args) => { mainWindowManipulationService.PersistSizeAndPosition(); Settings.Default.Save(); }; } catch (Exception ex) { Log.Error("Error starting up application", ex); throw; } }
public InputFeature(Contexts contexts, IInputService inputService) : base("Input Systems") { Add(new EmitInputSystem(contexts, inputService)); Add(new LevelScreenInputSystem(contexts, inputService)); Add(new ViewInventoryScreenSystem(contexts)); }
public Ftp(ScheduledRenewal renewal, Target target, ILogService log, IInputService input, ProxyService proxy, string identifier) : base(log, input, proxy, renewal, target, identifier) { _ftpClient = new FtpClient(target.HttpFtpOptions, log); }
/// <summary> /// Initializes behaviors. /// </summary> private void InitializeBehaviors(IInputService inputService) { Interaction.GetBehaviors(this).Add(new SystemPaintBehavior(inputService)); }
public override void Aquire(Target target, IOptionsService optionsService, IInputService inputService, RunLevel runLevel) { base.Aquire(target, optionsService, inputService, runLevel); target.HttpFtpOptions = new FtpOptions(optionsService, inputService); }
private static void Main(string[] args) { // Setup DI _container = AutofacBuilder.Global(args, new PluginService(_log)); // Basic services _log = _container.Resolve <ILogService>(); _optionsService = _container.Resolve <IOptionsService>(); _options = _optionsService.Options; if (_options == null) { return; } _input = _container.Resolve <IInputService>(); // .NET Framework check var dn = _container.Resolve <DotNetVersionService>(); if (!dn.Check()) { return; } // Show version information _input.ShowBanner(); // Advanced services _renewalService = _container.Resolve <IRenewalService>(); ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; // Main loop do { try { if (_options.Renew) { CheckRenewals(_options.ForceRenewal); CloseDefault(); } else if (!string.IsNullOrEmpty(_options.Plugin)) { if (_options.Cancel) { CancelRenewal(); } else { CreateNewCertificate(RunLevel.Unattended); } CloseDefault(); } else { MainMenu(); } } catch (Exception ex) { HandleException(ex); } if (!_options.CloseOnFinish) { _options.Plugin = null; _options.Renew = false; _options.ForceRenewal = false; Environment.ExitCode = 0; } } while (!_options.CloseOnFinish); }
public override IISWebOptions Aquire(Target target, IArgumentsService arguments, IInputService inputService, RunLevel runLevel) { var args = arguments.GetArguments <IISWebArguments>(); var ret = new IISWebOptions(args); var ask = true; if (target.IIS) { if (runLevel.HasFlag(RunLevel.Advanced)) { ask = inputService.PromptYesNo("Use different site for installation?", false); } else { ask = false; } } if (ask) { var chosen = inputService.ChooseFromList("Choose site to create new bindings", _iisClient.WebSites, x => Choice.Create(x.Id, x.Name, x.Id.ToString())); ret.SiteId = chosen; } return(ret); }
public abstract Task <TOptions> Aquire(IInputService inputService, RunLevel runLevel);
public override void Aquire(Target target, IOptionsService optionsService, IInputService inputService, RunLevel runLevel) { }
async Task <CsrPluginOptions?> ICsrPluginOptionsFactory.Aquire(IInputService inputService, RunLevel runLevel) => await Aquire(inputService, runLevel);
public Solution202105Part2(ILogger <Solution202105Part2> logger, IInputService inputService) { _logger = logger; _inputService = inputService; }
public InputFormatService(IInputService inputService) { _inputService = inputService; }
/// <summary> /// Single round of aquiring settings /// </summary> /// <param name="input"></param> /// <param name="allBindings"></param> /// <param name="visibleBindings"></param> /// <param name="allSites"></param> /// <param name="visibleSites"></param> /// <param name="runLevel"></param> /// <returns></returns> private async Task <IISOptions?> TryAquireSettings( IInputService input, List <IISHelper.IISBindingOption> allBindings, List <IISHelper.IISBindingOption> visibleBindings, List <IISHelper.IISSiteOption> allSites, List <IISHelper.IISSiteOption> visibleSites, RunLevel runLevel) { input.CreateSpace(); input.Show(null, "Please select which website(s) should be scanned for host names. " + "You may input one or more site identifiers (comma separated) to filter by those sites, " + "or alternatively leave the input empty to scan *all* websites."); var options = new IISOptions(); await input.WritePagedList( visibleSites.Select(x => Choice.Create( item: x, description: $"{x.Name} ({x.Hosts.Count()} binding{(x.Hosts.Count() == 1 ? "" : "s")})", command: x.Id.ToString(), color: x.Https ? ConsoleColor.DarkGray : (ConsoleColor?)null))); var raw = await input.RequestString("Site identifier(s) or <Enter> to choose all"); if (!ParseSiteOptions(raw, allSites, options)) { return(null); } var filtered = _iisHelper.FilterBindings(visibleBindings, options); await ListBindings(input, filtered); input.CreateSpace(); input.Show(null, "Listed above are the bindings found on the selected site(s). By default all of " + "them will be included, but you may either pick specific ones by typing the host names " + "or identifiers (comma seperated) or filter them using one of the options from the " + "menu."); var askExclude = true; var filters = new List <Choice <Func <Task> > > { Choice.Create <Func <Task> >(() => { return(InputPattern(input, options)); }, "Pick bindings based on a search pattern", command: "P"), Choice.Create <Func <Task> >(() => { askExclude = false; return(Task.CompletedTask); }, "Pick *all* bindings", @default: true, command: "A") }; if (runLevel.HasFlag(RunLevel.Advanced)) { filters.Insert(1, Choice.Create <Func <Task> >(() => { askExclude = true; return(InputRegex(input, options)); }, "Pick bindings based on a regular expression", command: "R")); } var chosen = await input.ChooseFromMenu( "Binding identifiers(s) or menu option", filters, (unknown) => { return(Choice.Create <Func <Task> >(() => { askExclude = false; return ProcessInputHosts( unknown, allBindings, filtered, options, () => options.IncludeHosts, x => options.IncludeHosts = x); })); }); await chosen.Invoke(); filtered = _iisHelper.FilterBindings(allBindings, options); // Exclude specific bindings if (askExclude && filtered.Count > 1 && runLevel.HasFlag(RunLevel.Advanced)) { await ListBindings(input, filtered); input.CreateSpace(); input.Show(null, "The listed bindings match your current filter settings. " + "If you wish to exclude one or more of them from the certificate, please " + "input those bindings now. Press <Enter> to include all listed bindings."); await InputHosts("Exclude bindings", input, allBindings, filtered, options, () => options.ExcludeHosts, x => options.ExcludeHosts = x); if (options.ExcludeHosts != null) { filtered = _iisHelper.FilterBindings(allBindings, options); } } // Now the common name if (filtered.Select(x => x.HostUnicode).Distinct().Count() > 1) { await InputCommonName(input, filtered, options); } return(options); }
public virtual void Aquire(Target target, IOptionsService optionsService, IInputService inputService) { }
void IInstallationPluginFactory.Aquire(ScheduledRenewal renewal, IOptionsService optionsService, IInputService inputService, RunLevel runLevel) { }
/// <summary> /// Describe the plugin to the user /// </summary> /// <param name="input"></param> public virtual void Show(IInputService input) { }
public BaseJiraRepository(ISettingsService settingsService, IInputService inputService) { _baseRepository = new BaseRepository(settingsService, inputService); }
//block method. blocking call public static Game LoadFromFile(string filename, IOutputService output, IInputService input) { return(Load(File.ReadAllText(filename), output, input)); }
public override Task <SelfHostingOptions?> Aquire(Target target, IInputService inputService, RunLevel runLevel) => Default(target);
private async Task <bool> ShowSplashScreen(IInputService inputService, IAudioService audioService, MainViewModel mainViewModel) { var taskCompletionSource = new TaskCompletionSource <bool>(); //Used to make this method awaitable on the InteractionRequest callback if (Settings.Default.ShowSplashScreen) { Log.Debug("Showing splash screen."); var message = new StringBuilder(); message.AppendLine(string.Format("Version: {0}", DiagnosticInfo.AssemblyVersion)); message.AppendLine(string.Format("Language: {0}", Settings.Default.Language.ToDescription())); message.AppendLine(string.Format("Pointing: {0}", Settings.Default.PointsSource.ToDescription())); var keySelectionSb = new StringBuilder(); keySelectionSb.Append(Settings.Default.KeySelectionTriggerSource.ToDescription()); switch (Settings.Default.KeySelectionTriggerSource) { case TriggerSources.Fixations: keySelectionSb.Append(string.Format(" ({0:#,###}ms)", Settings.Default.KeySelectionTriggerFixationCompleteTime.TotalMilliseconds)); break; case TriggerSources.KeyboardKeyDownsUps: keySelectionSb.Append(string.Format(" ({0})", Settings.Default.KeySelectionTriggerKeyboardKeyDownUpKey)); break; case TriggerSources.MouseButtonDownUps: keySelectionSb.Append(string.Format(" ({0})", Settings.Default.KeySelectionTriggerMouseDownUpButton)); break; } message.AppendLine(string.Format("Key selection: {0}", keySelectionSb)); var pointSelectionSb = new StringBuilder(); pointSelectionSb.Append(Settings.Default.PointSelectionTriggerSource.ToDescription()); switch (Settings.Default.PointSelectionTriggerSource) { case TriggerSources.Fixations: pointSelectionSb.Append(string.Format(" ({0:#,###}ms)", Settings.Default.PointSelectionTriggerFixationCompleteTime.TotalMilliseconds)); break; case TriggerSources.KeyboardKeyDownsUps: pointSelectionSb.Append(string.Format(" ({0})", Settings.Default.PointSelectionTriggerKeyboardKeyDownUpKey)); break; case TriggerSources.MouseButtonDownUps: pointSelectionSb.Append(string.Format(" ({0})", Settings.Default.PointSelectionTriggerMouseDownUpButton)); break; } message.AppendLine(string.Format("Point selection: {0}", pointSelectionSb)); message.AppendLine("Management console: ALT + M"); message.AppendLine("Website: www.optikey.org"); inputService.RequestSuspend(); audioService.PlaySound(Settings.Default.InfoSoundFile, Settings.Default.InfoSoundVolume); mainViewModel.RaiseToastNotification( "OptiKey : Type · Click · Speak", message.ToString(), NotificationTypes.Normal, () => { inputService.RequestResume(); taskCompletionSource.SetResult(true); }); } else { taskCompletionSource.SetResult(false); } return(await taskCompletionSource.Task); }
public override Task <ManualOptions?> Aquire(Target target, IInputService inputService, RunLevel runLevel) => Task.FromResult <ManualOptions?>(new ManualOptions());
public async Task <string?> TryGetArgument(string?providedValue, IInputService input, string what, bool secret = false) => await TryGetArgument(providedValue, input, new[] { what }, secret);