// Here are all the things, that open a window such as // Buddy list, Ignore list, Hosting a game, Settings // Opens a window to host a game private void GameHosting(object sender, RoutedEventArgs e) { if (gameListChannel == null || !gameListChannel.Joined) { MessageBox.Show(this, "You have to join a channel before host a game!", "Fail", MessageBoxButton.OK, MessageBoxImage.Stop); return; } if (!File.Exists(Path.GetFullPath("Hoster.exe"))) { MessageBox.Show(this, "Hoster.exe doesn't exist! You can't host without that file!", "Hoster.exe missing", MessageBoxButton.OK, MessageBoxImage.Stop); return; } if (!CheckWAExe()) { return; } if (gameProcess != null) { if (startedGameType == StartedGameTypes.Join) { MessageBox.Show(this, "You are in a game!", "Fail", MessageBoxButton.OK, MessageBoxImage.Information); return; } else { // Because of wormkit rehost module, this should be allowed gameProcess.Dispose(); gameProcess = null; } } if (SearchHere != null && Properties.Settings.Default.AskLeagueSearcherOff) { MessageBoxResult res = MessageBox.Show("Would you like to turn off league searcher?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { ClearSpamming(); } } if (Notifications.Count != 0 && Properties.Settings.Default.AskNotificatorOff) { MessageBoxResult res = MessageBox.Show("Would you like to turn off notificator?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { Notifications.Clear(); notificatorImage.Source = notificatorOff; } } string hexcc = "6487" + WormNetCharTable.Encode[GlobalManager.User.Country.CountryCode[1]].ToString("X") + WormNetCharTable.Encode[GlobalManager.User.Country.CountryCode[0]].ToString("X"); HostingWindow = new Hosting(ServerAddress, gameListChannel.Name.Substring(1), gameListChannel.Scheme, hexcc); HostingWindow.GameHosted += GameHosted; HostingWindow.Owner = this; HostingWindow.ShowDialog(); }
/// <summary> /// スタックをクリアする /// </summary> public static void Clear() { if (Notifications != null) { Notifications.Clear(); } }
void IServerModuleStateContext.Initialize() { // Activate logging LoggerManagement.ActivateLogging(this); LoggerManagement.AppendListenerToStream(ProcessLogMessage, LogLevel.Warning, Name); Logger.Log(LogLevel.Info, "{0} is initializing...", Name); // Get config and parse for container settings Config = ConfigManager.GetConfiguration <TConf>(); ConfigParser.ParseStrategies(Config, Strategies); // Initialize container with server module dll and this dll Container = ContainerFactory.Create(Strategies, GetType().Assembly) .Register <IParallelOperations, ParallelOperations>() // Register instances for this cycle .SetInstance(Config).SetInstance(Logger); OnInitialize(); // Execute SubInitializer var subInits = Container.ResolveAll <ISubInitializer>() ?? new ISubInitializer[0]; foreach (var subInitializer in subInits) { subInitializer.Initialize(Container); } Logger.Log(LogLevel.Info, "{0} initialized!", Name); // After initializing the module, all notifications are unnecessary Notifications.Clear(); }
private string Validate(string result) { if (Notifications != null) { Notifications.Clear(); } _isValid = true; NotifyIco = false; if (result != "0.") { Validators(result); } OnNotificationRaised(null); if (_isValid) { enebleForm(); } else { disableForm(); } return(result); }
public void ClearAllNotifications() { Notifications.Clear(); _appApplicationEnvironment.EventHub.Publish <UpdateNotifyBadgeMessage>(new UpdateNotifyBadgeMessage() { Value = Notifications.Count }); }
public async Task <IActionResult> ApiResponse <TResult>(Task <TResult> result = null) { IActionResult response; if (_notifications.HasNotifications()) { response = StatusCode((int)_notifications.GetStatusCode(), _notifications.GetMessages()); } else { response = Ok(await result); } _notifications.Clear(); return(response); }
public async Task LoadNotifications() { Notifications.Clear(); var notifications = (await _notificationService.GetAll()).ToList(); notifications.Reverse(); notifications.ForEach(notification => Notifications.Add(notification)); }
public void ClearMessages() { Notifications.Clear(); DeviceAlerts.Clear(); Warnings.Clear(); Errors.Clear(); CheckForMessages(); }
public void Reboot(bool isWarmBoot) { if (_currentNotification != null) { _currentNotification.IsActive = false; _currentNotification = null; } InteractionCancellation?.Cancel(); InteractionCancellation = new CancellationTokenSource(); Notifications.Clear(); IsRebooting = true; if (isWarmBoot) { if (UserProfile.Instance != null && !UserProfile.Instance.Saving) { UserProfile.Instance.SaveToFile(); } } else { UserProfile.Load(); G.Random = UserProfile.Instance.Random; UserProfile.Instance.AutoSave = false; } #if !DEBUG BootSequence = new BootSequencePlayer(); #endif InitializeSystemMemory(); InitializeVgaAdapter(); InitializeIoInterfaces(); InitializeCodeEditor(); InitializeShell(); InitializeCodeExecutionLayer(); LocalSystemContext = new SystemContext(UserProfile.Instance.RootDirectory); CurrentSystemContext = LocalSystemContext; if (!isWarmBoot) { if (UserProfile.Instance.IsInitialized) { UserProfile.Instance.AutoSave = true; } } if (isWarmBoot) { Memory.Poke(SystemMemoryAddresses.SoftResetCompleteFlag, (byte)1); } }
private async Task <bool> Monitor(bool isForRun = false) { if (IsConnected) { return(IsConnected); } SetCommandVisibility(false, true, false); Notifications.Clear(); hubConnection = new HubConnectionBuilder() .WithUrl($"{Strategy.StrategyServerUrl}/notificationhub?strategyname={Strategy.Name}") .Build(); hubConnection.On <object>("Connected", message => { ViewModelContext.UiDispatcher.Invoke(() => { NotificationsAdd(new Message { MessageType = MessageType.Info, Text = $"Connected - {message.ToString()}", Timestamp = DateTime.Now }); }); }); hubConnection.On <object>("Trade", (message) => { ViewModelContext.UiDispatcher.Invoke(() => { OnStrategyNotification(message); }); }); try { await hubConnection.StartAsync().ConfigureAwait(false); if (!isForRun) { SetCommandVisibility(false, false, true); } return(true); } catch (Exception ex) { NotificationsAdd(new Message { MessageType = MessageType.Error, Text = $"Monitor - {ex.Message}", TextVerbose = ex.ToString(), Timestamp = DateTime.Now }); SetCommandVisibility(true, false, false); await Disconnect().ConfigureAwait(false); return(false); } }
public async Task GetNotifications() { var notifications = await _usersApi.GetItems <List <Model.Notification> >(APIService.User.UserId, "Notifications"); notifications = notifications.OrderByDescending(n => n.Created).ToList(); Notifications.Clear(); foreach (var notification in notifications) { Notifications.Add(notification); } }
private void ActualiserListeNotifications(object sender, NotificationsEventArgs args) { Notification notificationSelectionneeTemporaire = NotificationSelectionnee; Notifications.Clear(); foreach (Notification notification in args.Notifications) { Notifications.Add(notification); } NotificationSelectionnee = notificationSelectionneeTemporaire; }
internal void ResetNotifications() { var t = _timerRunning; StopTimer(); Notifications.Clear(); if (t) { StartTimer(); } }
public void SignOut() { userService.SaveSetting("Fleetname", string.Empty, SettingType.String); userService.SaveSetting("PrivateMode", false, SettingType.Bool); userService.SaveSetting("Username", string.Empty, SettingType.String); userService.SaveSetting("DriverId", -1, SettingType.Int); userService.SaveSetting("Password", string.Empty, SettingType.String); userService.SaveSetting("Phone", string.Empty, SettingType.String); userService.SaveSetting("FleetCode", string.Empty, SettingType.String); userService.SaveSetting("RealName", string.Empty, SettingType.String); LoggedIn = false; Notifications.Clear(); JourneysList.Clear(); HasLoggedOut = true; }
public void Dispose() { if (IsDisposed) { return; } Notifications.Clear(); _buffer.Clear(); OnDispose.InvokeSafely(this, new EventArgs()); IsDisposed = true; GC.SuppressFinalize(this); }
public override void AddNotificationsByFluent(ValidationResult validationResult, bool overwrite = false) { if (validationResult is null) { throw new ValidationResultIsNullException(); } if (overwrite) { Notifications.Clear(); } foreach (var error in validationResult.Errors) { var notification = new Notification( error.PropertyName[(error.PropertyName.IndexOf('.') + 1)..],
public override void AddNotifications(IEnumerable <Notification> notifications, bool overwrite = false) { try { if (overwrite) { Notifications.Clear(); } Notifications.AddRange(notifications); } catch (ArgumentNullException) { throw new NotificationIsNullException(); } }
private void LoadNotifications() { string proc = PluginInitialization._work.OpenForm.ProcOpen("LoadNotifications"); try { CountAll = _repo.GetCountNotifications( SelectedFilterNotificationStatus, SelectedFilterPriority, SelectedFilterType, FilterText, COUNT_IN_PAGE, PageNum); if (Notifications == null) { Notifications = new ObservableCollection <NotificationVM>(); } else { Notifications.Clear(); } var data = _repo.GetNotifications( SelectedFilterNotificationStatus, SelectedFilterPriority, SelectedFilterType, FilterText, COUNT_IN_PAGE, PageNum); foreach (var item in data) { Notifications.Add(new NotificationVM(item, _repo)); } } catch (Exception ex) { PluginInitialization._work.OpenForm.ProcClose(proc); MessageBox.Show("Ошибка при получении уведомлений! Описание: " + ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Error); } finally { PluginInitialization._work.OpenForm.ProcClose(proc); } }
void window_NotificatorEvent(object sender, NotificatorEventArgs e) { this.Dispatcher.Invoke(new Action(delegate() { if (e == null) // Stop request { Notifications.Clear(); notificatorImage.Source = notificatorOff; } else { foreach (NotificatorClass nc in e.NotificatorList) { Notifications.Add(nc); } notificatorImage.Source = notificatorOn; } } )); }
private string Validate(string result) { if (Notifications != null) { Notifications.Clear(); } if (result != "0.") { double value = Convert.ToDouble(result, App.StandardRegionalInformation); if (value < 0) { disableForm(); AddNotification(CreateNotification(ValidatorMessage.Negative)); } else if (value > _upperLimit) { disableForm(); AddNotification(CreateNotification(ValidatorMessage.MaxValue)); } else if (result.Length == _calculator.MaxOutputLength - 1) { AddNotification(CreateNotification(ValidatorMessage.MaxOutputLength)); enebleForm(); } else if (isMaxDecimal(result, _calculator.MaxDecimal)) { AddNotification(CreateNotification(ValidatorMessage.MaxDecimalLength)); enebleForm(); } else { enebleForm(); } } return(result); }
public void RunPreSaveValidation() { Notifications.Clear(); RunPreSaveValidationCore(); }
/// <summary> /// Vide les propriétés de navigation. /// </summary> protected virtual void ClearNavigationProperties() { Notifications.Clear(); NotificationTypeSetting = null; }
protected virtual void ClearNavigationProperties() { Instruments.Clear(); Notifications.Clear(); }
public void Clear() { Notifications.Clear(this); }
private async Task <bool> MonitorAsync(bool isForRun = false) { if (IsConnected) { NotificationsAdd(new Message { MessageType = MessageType.Info, Text = $"Already connected to strategy", Timestamp = DateTime.Now }); return(IsConnected); } await SetCommandVisibility(StrategyRunnerCommandVisibility.Connecting).ConfigureAwait(true); Notifications.Clear(); if (string.IsNullOrWhiteSpace(strategyAssemblyManager.Id)) { throw new Exception("StrategyAssemblyManager has not loaded the strategy assemblies."); } socketClient = new SocketClient(new Uri(SelectedServer.Uri, "notificationhub"), strategyAssemblyManager.Id); socketClient.On("Connected", message => { ViewModelContext.UiDispatcher.Invoke(() => { NotificationsAdd(new Message { MessageType = MessageType.Info, Text = $"Connected - {message}", Timestamp = DateTime.Now }); }); }); socketClient.On("Notification", async(message) => { await ViewModelContext.UiDispatcher.Invoke(async() => { await OnStrategyNotificationAsync(message).ConfigureAwait(false); }).ConfigureAwait(false); }); socketClient.On("Trade", (message) => { ViewModelContext.UiDispatcher.Invoke(async() => { await OnTradeNotificationAsync(message).ConfigureAwait(false); }); }); socketClient.On("OrderBook", (message) => { ViewModelContext.UiDispatcher.Invoke(async() => { await OnOrderBookNotificationAsync(message).ConfigureAwait(false); }); }); socketClient.On("AccountInfo", (message) => { ViewModelContext.UiDispatcher.Invoke(() => { OnAccountNotification(message); }); }); socketClient.On("Candlesticks", (message) => { ViewModelContext.UiDispatcher.Invoke(async() => { await OnCandlesticksNotificationAsync(message).ConfigureAwait(false); }); }); socketClient.On("ParameterUpdate", (message) => { ViewModelContext.UiDispatcher.Invoke(async() => { await OnParameterUpdateNotificationAsync(message).ConfigureAwait(false); }); }); socketClient.Closed += async(sender, args) => { await ViewModelContext.UiDispatcher.Invoke(async() => { NotificationsAdd(new Message { MessageType = MessageType.Error, Text = $"socketClient.Closed", TextVerbose = args.ToString(), Timestamp = DateTime.Now }); await DisposeSocketAsync(false).ConfigureAwait(false); }).ConfigureAwait(false); }; socketClient.Error += async(sender, args) => { var ex = args as Exception; if (ex.InnerException is TaskCanceledException) { return; } await ViewModelContext.UiDispatcher.Invoke(async() => { NotificationsAdd(new Message { MessageType = MessageType.Error, Text = $"{args.Message}", TextVerbose = args.ToString(), Timestamp = DateTime.Now }); await DisposeSocketAsync(false).ConfigureAwait(false); }).ConfigureAwait(false); }; try { await socketClient.StartAsync(strategy.Name).ConfigureAwait(true); StrategyDisplayViewModel.IsActive = true; if (!isForRun) { await SetCommandVisibility(StrategyRunnerCommandVisibility.Connected).ConfigureAwait(false); } return(true); } catch (Exception ex) { Logger.Log($"MonitorAsync {ex}", Prism.Logging.Category.Exception, Prism.Logging.Priority.High); NotificationsAdd(new Message { MessageType = MessageType.Error, Text = $"Monitor - {ex.Message}", TextVerbose = ex.ToString(), Timestamp = DateTime.Now }); await SetCommandVisibility(StrategyRunnerCommandVisibility.ServerUnavailable).ConfigureAwait(false); await DisconnectSocketAsync().ConfigureAwait(false); return(false); } }
private void ClearNotifications(object param) { Notifications.Clear(); }
private async Task VerifyIntegrity() { _logger.Info("Verifying integrity"); Notifications.Clear(); // Verify installation path if (!await VerifyInstallationPath()) { _logger.Warn(Strings.ERROR_UNABLE_TO_LOCATE_GAME_DIRECTORY); Notifications.Add(new Notification(Icon.Error, Strings.ERROR_UNABLE_TO_LOCATE_GAME_DIRECTORY, async() => await BrowseGameDirectory(), Strings.BROWSE)); } // Verify binaries if (ActivePreset != null && !await VerifyBinaries(out string[] missingFiles)) { _logger.Warn(Strings.ERROR_MISSING_BINARIES); if (_configurationManager.Settings.ManageBinaries && await VerifyBinariesBackup()) { Notifications.Add(new Notification(Icon.Error, $"{Strings.ERROR_MISSING_BINARIES} ({string.Join(", ", missingFiles)})", async() => await RestoreBinaries(), Strings.RESTORE)); } else { Notifications.Add(new Notification(Icon.Error, $"{Strings.ERROR_MISSING_BINARIES} ({string.Join(", ", missingFiles)})", OpenLink, Strings.VISIT_ENBDEV)); } } else if (_configurationManager.Settings.ManageBinaries && !await VerifyBinariesBackup()) { _logger.Warn(Strings.WARNING_NO_BINARIES_BACKUP); Notifications.Add(new Notification(Icon.Warning, Strings.WARNING_NO_BINARIES_BACKUP, async() => await BackupBinaries(), Strings.BACKUP)); } else if (_configurationManager.Settings.ManageBinaries) { var versionMismatch = await VerifyBinariesVersion(); if (versionMismatch != VersionMismatch.Matching) { switch (versionMismatch) { // If older version is used in game dir case VersionMismatch.Above: _logger.Warn("Version mismatch: older version in game directory"); Notifications.Add(new Notification(Icon.Warning, Strings.WARNING_AN_OLDER_BINARY_VERSION_IS_CURRENTLY_USED, async() => await RestoreBinaries(), Strings.UPDATE)); break; // If newer version is used in game dir case VersionMismatch.Below: _logger.Warn("Version mismatch: newer version in game directory"); Notifications.Add(new Notification(Icon.Warning, Strings.WARNING_A_NEWER_BINARY_VERSION_IS_CURRENTLY_USED, async() => await BackupBinaries(), Strings.UPDATE)); break; } } else { _logger.Debug("Version match"); Notifications.Add(new Notification(Icon.Success, string.Join(" | ", _gameService.AppendBinaryVersions(Paths.GetBinariesBackupDirectory(_game.Module), _game.Binaries)), null, null)); } } // Verify active preset (compare files) if (_game.Presets.Count > 0 && _game.Presets.SingleOrDefault(x => x.IsActive) != null) { try { if (!await VerifyActivePreset()) { _logger.Info(Strings.WARNING_THE_ACTIVE_PRESET_DIFFERS_FROM_THE_PRESET_CURRENTLY_USED); Notifications.Add(new Notification(Icon.Warning, Strings.WARNING_THE_ACTIVE_PRESET_DIFFERS_FROM_THE_PRESET_CURRENTLY_USED, async() => await UpdatePreset(), Strings.UPDATE)); } } catch (FileNotFoundException) { _logger.Info(Strings.WARNING_FILES_ARE_MISSING_FROM_THE_ACTIVE_PRESET); Notifications.Add(new Notification(Icon.Warning, Strings.WARNING_FILES_ARE_MISSING_FROM_THE_ACTIVE_PRESET, async() => await UpdatePreset(), Strings.UPDATE)); } } }
// The method that will start the thread which will open the game private void JoinGame(Game game, bool silent = false, bool exit = false) { if (gameProcess != null) { MessageBox.Show(this, "You are already in a game!", "Fail", MessageBoxButton.OK, MessageBoxImage.Information); return; } if (!CheckWAExe()) { return; } if (SearchHere != null && Properties.Settings.Default.AskLeagueSearcherOff) { MessageBoxResult res = MessageBox.Show("Would you like to turn off league searcher?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { ClearSpamming(); } } if (Notifications.Count != 0 && Properties.Settings.Default.AskNotificatorOff) { MessageBoxResult res = MessageBox.Show("Would you like to turn off notificator?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Question); if (res == MessageBoxResult.Yes) { Notifications.Clear(); notificatorImage.Source = notificatorOff; } } if (gameListChannel != null && !snooperClosing) { SilentJoined = silent; ExitSnooper = exit; startedGameType = StartedGameTypes.Join; lobbyWindow = IntPtr.Zero; gameWindow = IntPtr.Zero; gameProcess = new Process(); gameProcess.StartInfo.UseShellExecute = false; gameProcess.StartInfo.FileName = Properties.Settings.Default.WaExe; gameProcess.StartInfo.Arguments = "wa://" + game.Address + "?gameid=" + game.ID + "&scheme=" + gameListChannel.Scheme; if (gameProcess.Start()) { if (Properties.Settings.Default.WAHighPriority) { gameProcess.PriorityClass = ProcessPriorityClass.High; } if (Properties.Settings.Default.MessageJoinedGame && !SilentJoined) { SendMessageToChannel("/me is joining a game: " + game.Name, gameListChannel); } if (Properties.Settings.Default.MarkAway) { SendMessageToChannel("/away", null); } } else { gameProcess.Dispose(); gameProcess = null; } } }
private void ClearNotifications() { Notifications.Clear(); }
private void NotificationsClear_Click(object sender, RoutedEventArgs e) { Notifications.Clear(); }