/// <summary> /// Initializes a new instance of the <see cref="SettingsViewModel" /> class. /// </summary> /// <param name="windowManager">The window manager.</param> /// <param name="keyboardHelper">The keyboard helper.</param> /// <param name="settingsService">The settings service.</param> /// <param name="hotkeyService">The key code service.</param> /// <param name="soundService">The sound service.</param> /// <param name="githubService">The github service.</param> /// <param name="pushBulletService">The PushBullet service.</param> public SettingsViewModel( IWindowManager windowManager, KeyboardHelper keyboardHelper, SettingsService settingsService, HotkeyService hotkeyService, SoundService soundService, GithubService githubService, PushBulletService pushBulletService) : base(windowManager) { this._keyboardHelper = keyboardHelper; this._settingService = settingsService; this._hotkeyService = hotkeyService; this._soundService = soundService; this.DisplayName = "Settings"; this._excludePropertyNames = this.GetExcludedPropertyNames(); this.PropertyChanged += this.SettingsViewModel_PropertyChanged; if (!AssetService.Exists(LottieFileName)) { AssetService.Create(LottieFileName, GetResourceContent(LottieFileName)); } this.BuildManager = new BuildManagerViewModel(this.ShowMessage, githubService); this.PushBullet = new PushBulletViewModel(pushBulletService); this.SetupHotkeys(); }
/// <summary> /// Initializes a new instance of the <see cref="TradebarViewModel" /> class. /// </summary> /// <param name="eventAggregator">The event aggregator.</param> /// <param name="clientLurker">The client lurker.</param> /// <param name="processLurker">The process lurker.</param> /// <param name="keyboardLurker">The keyboard lurker.</param> /// <param name="dockingHelper">The docking helper.</param> /// <param name="keyboardHelper">The keyboard helper.</param> /// <param name="settingsService">The settings service.</param> /// <param name="windowManager">The window manager.</param> /// <param name="soundService">The sound service.</param> /// <param name="pushBulletService">The PushBullet service.</param> public TradebarViewModel( IEventAggregator eventAggregator, ClientLurker clientLurker, ProcessLurker processLurker, KeyboardLurker keyboardLurker, DockingHelper dockingHelper, PoeKeyboardHelper keyboardHelper, SettingsService settingsService, IWindowManager windowManager, SoundService soundService, PushBulletService pushBulletService) : base(windowManager, dockingHelper, processLurker, settingsService) { this._eventAggregator = eventAggregator; this._keyboardHelper = keyboardHelper; this._soundService = soundService; this._clientLurker = clientLurker; this._pushBulletService = pushBulletService; this._keyboardLurker = keyboardLurker; this.TradeOffers = new ObservableCollection <OfferViewModel>(); this._soldOffers = new List <TradeEvent>(); this._context = new TradebarContext(this.RemoveOffer, this.AddActiveOffer, this.AddToSoldOffer, this.SetActiveOffer, this.ClearAll); this.DisplayName = "Poe Lurker"; }
/// <summary> /// Initializes a new instance of the <see cref="PushBulletViewModel" /> class. /// </summary> /// <param name="service">The service.</param> public PushBulletViewModel(PushBulletService service) { this._service = service; if (service.Device != null && service.Device.Id != null) { this.SelectedDevice = new DeviceViewModel(service.Device); } this.Devices = new ObservableCollection <DeviceViewModel>(); }
public NotificationController(UserService service, IMapper mapper, PushBulletService pushBulletService) { this.service = service; this.mapper = mapper; this.pushBulletService = pushBulletService; }
/// <summary> /// This method starts up the assistant core. /// After registration of very important events on Program.cs, control moves to here. /// This is basically the entry point of the application. /// </summary> /// <param name="args">The startup arguments. (if any)</param> /// <returns></returns> public static async Task <bool> InitCore(string[] args) { if (File.Exists(Constants.TraceLogPath)) { File.Delete(Constants.TraceLogPath); } Helpers.CheckMultipleProcess(); StartupTime = DateTime.Now; if (Helpers.CheckForInternetConnection()) { IsNetworkAvailable = true; } else { Logger.Log("No internet connection.", Enums.LogLevels.Warn); Logger.Log($"Starting {AssistantName} in offline mode..."); IsNetworkAvailable = false; } Config = Config.LoadConfig(); RunningPlatform = Helpers.GetOsPlatform(); AssistantName = Config.AssistantDisplayName; Logger.LogIdentifier = AssistantName; Config.ProgramLastStartup = StartupTime; Constants.LocalIP = Helpers.GetLocalIpAddress(); SecureLine = new SecureLineServer(IPAddress.Any, 7777); SecureLine.StartSecureLine(); SendLocalIp(!Helpers.IsNullOrEmpty(Constants.LocalIP)); Helpers.SetFileSeperator(); Helpers.GenerateAsciiFromText(Config.AssistantDisplayName); Constants.ExternelIP = Helpers.GetExternalIp(); File.WriteAllText("version.txt", Constants.Version.ToString()); if (Helpers.IsNullOrEmpty(Constants.ExternelIP)) { Constants.ExternelIP = "Failed."; } Helpers.InBackgroundThread(SetConsoleTitle, "Console Title Updater", true); Logger.Log($"X---------------- Starting {AssistantName} v{Constants.Version} ----------------X", Enums.LogLevels.Ascii); ConfigWatcher.InitConfigWatcher(); ParseStartupArguments(args); if (!Helpers.IsNullOrEmpty(Config.PushBulletApiKey)) { PushBulletService = new PushBulletService(Config.PushBulletApiKey); (bool status, UserDeviceListResponse currentPushDevices) = PushBulletService.InitPushService(); if (status) { Logger.Log("Push bullet service started.", Enums.LogLevels.Trace); } } if (!Helpers.IsRaspberryEnvironment()) { DisablePiMethods = true; IsUnknownOs = true; } if (Helpers.GetOsPlatform().Equals(OSPlatform.Windows)) { AssistantStatus = new ProcessStatus(); } else { Logger.Log("Could not start performence counters as it is not supported on this platform.", Enums.LogLevels.Trace); } await Update.CheckAndUpdateAsync(true).ConfigureAwait(false); if (Config.KestrelServer && !Helpers.IsNullOrEmpty(Config.KestrelServerUrl)) { await KestrelServer.Start().ConfigureAwait(false); } ModuleLoader = new ModuleInitializer(); ModuleLoader.LoadAndStartModulesOfType <IModuleBase>(); ModuleWatcher.InitModuleWatcher(); Controller = new PiController(true); CoreInitiationCompleted = true; await PostInitTasks().ConfigureAwait(false); return(true); }