public Command( String word, String shortInfo, String longInfo, RunLogic logic, List<String> argNames = null, int security = 0, String alias = null, String subdomainTitle = null ) : base(word, shortInfo, longInfo, security, alias, subdomainTitle) { //Log.Trace("Running constructor for command", "ctr"); if (argNames == null) argNames = new List<String>(); ArgNames = argNames; Logic = logic; ArgCount = argNames.Count; ArgsErrorNotice = new ChatNotification() { Text = "Expected " + ArgCount + " arguments." }; InvokeErrorNotice = new ChatNotification() { Text = "Error invoking command.", Sender = "Server" }; //Log.Trace("Finished running constructor for command", "ctr"); }
public void Add(Notifications.Notification obj) { BeginAnimation(HeightProperty, null); Height = double.NaN; Animate.Opacity(NotificationBorder, 1, 300); NotificationBorder.Visibility = Visibility.Visible; Notifications.Children.Add(obj); obj.Click += Close_Notification; obj.Opacity = 0; Animate.Opacity(obj, 1, 300); }
private Notifications.Notification[] NotificationsFrom(StoredEvent[] storedEvents) { Notifications.Notification[] notifications = new Notifications.Notification[storedEvents.Length]; for(int i = 0; i < storedEvents.Length; i++) { IDomainEvent domainEvent = storedEvents[i].ToDomainEvent(); Notifications.Notification notification = new Notifications.Notification(storedEvents[i].EventId, domainEvent); notifications[i] = notification; } return notifications; }
public static async Task PublishForUser(this NotificationsDbContext ns, int userId, string entityType, string entityKey, string summary, string description) { var notification = new Notifications.Notification( new EntityReference(NotificationRecipientType.UserId.Value, userId.ToString()), new EntityReference(entityType, entityKey), summary, description); ns.Notifications.Add(notification); await ns.SaveChangesAsync(); }
private void OnTorrentStateChanged(object sender, TorrentStateChangedEventArgs args) { TorrentManager manager = (TorrentManager)sender; Gtk.Application.Invoke(delegate { if (args.OldState == TorrentState.Downloading) { logger.Debug("Removing " + manager.Torrent.Name + " from download label"); mainWindow.DownloadingLabel.RemoveTorrent(manager); } else if (args.OldState == TorrentState.Seeding) { logger.Debug("Removing " + manager.Torrent.Name + " from upload label"); mainWindow.SeedingLabel.RemoveTorrent(manager); } if (args.NewState == TorrentState.Downloading) { logger.Debug("Adding " + manager.Torrent.Name + " to download label"); mainWindow.DownloadingLabel.AddTorrent(manager); } else if (args.NewState == TorrentState.Seeding) { logger.Debug("Adding " + manager.Torrent.Name + " to upload label"); mainWindow.SeedingLabel.AddTorrent(manager); } if (!prefSettings.EnableNotifications) { return; } if (args.NewState != TorrentState.Seeding) { return; } if (args.OldState != TorrentState.Downloading) { return; } Notifications.Notification notify = new Notifications.Notification("Download Complete", manager.Torrent + " has finished downloading."); notify.AttachToWidget(mainWindow.TrayIcon); notify.Timeout = 5000; notify.Show(); }); }
/// <summary> /// FullCommand can change depending on command's position in the Tree /// </summary> /// <param name="security"></param> public override void Refresh(int security) { RefreshFullCommand(); String fullCommandWithArgs = FullCommand + " " + String.Join(" ", ArgNames); InfoAsTop = fullCommandWithArgs + "\n\n" + LongInfo; //InfoBadusage = "Incorrect usage.\n\n" + InfoAsTop; InfoAsChild = fullCommandWithArgs + " - " + ShortInfo; InfoNotice = new WindowNotification() { Text = InfoAsTop, BigLabel = BigLabel, SmallLabel = SmallLabel }; ArgsErrorNotice = new ChatNotification() { Text = "Expected " + ArgCount + " arguments -\n" + fullCommandWithArgs }; }
private void RealNotifyUser(string title, string message, NotificationType type) { var icon = Stock.Info; switch (type) { case NotificationType.Information: icon = Stock.DialogInfo; break; case NotificationType.Warning: icon = Stock.DialogWarning; break; case NotificationType.Error: icon = Stock.DialogError; break; } var notification = new Notifications.Notification(title, message, Stock.Info); notification.Show(); }
public Command( String word, String shortInfo, String longInfo, RunLogic logic, List <String> argNames = null, int security = 0, String alias = null, String subdomainTitle = null ) : base(word, shortInfo, longInfo, security, alias, subdomainTitle) { //Log.Trace("Running constructor for command", "ctr"); if (argNames == null) { argNames = new List <String>(); } ArgNames = argNames; Logic = logic; ArgCount = argNames.Count; ArgsErrorNotice = new ChatNotification() { Text = "Expected " + ArgCount + " arguments." }; InvokeErrorNotice = new ChatNotification() { Text = "Error invoking command.", Sender = "Server" }; //Log.Trace("Finished running constructor for command", "ctr"); }
void HandleStateChanged(object sender, StateChangedEventArgs args) { // Update toolbar updateToolBar (); Download manager = (Download) sender; if (args.NewState == Monsoon.State.Stopped) PeerListStore.Clear (); this.updateView (); if (!Preferences.EnableNotifications) return; if (args.NewState != Monsoon.State.Seeding) return; if (args.OldState != Monsoon.State.Downloading) return; try { Notifications.Notification notify = new Notifications.Notification (_("Download Complete"), manager.Torrent.Name, Stock.GoDown); if (Preferences.EnableTray) notify.Show (); notify.Urgency = Notifications.Urgency.Low; notify.Timeout = 5000; notify.Show (); notify.AddAction("reveal-item", "Show", delegate { System.Diagnostics.Process.Start("\"file://" + manager.SavePath + "\""); }); } catch (Exception ex) { logger.Error ("Could not display notification"); logger.Error (ex.ToString()); } }
public async void Show(Notifications.Notification notification) { Panel parent = Database.MainWindow.ContentClip; if (parent.Children.Count >= 3) { _lock = true; } if (_lock) { await WaitLock(); } foreach (FrameworkElement child in parent.Children) { if (child is Snackbar) { Animate.Margin(child, new Thickness(25, 0, 0, child.Margin.Bottom + 60)); //Animate.Margin(child, new Thickness(0, child.Margin.Top + 60, 25, 0)); } } _lock = true; var obj = new Notifications.Notification { Icon = notification.Icon, Content = notification.Content, Description = notification.Description, }; HorizontalAlignment = HorizontalAlignment.Left; VerticalAlignment = VerticalAlignment.Bottom; //HorizontalAlignment = HorizontalAlignment.Right; //VerticalAlignment = VerticalAlignment.Top; Margin = new Thickness(25, 0, 0, -45); //Margin = new Thickness(0, -45, 25, 0); ContentPanel.Children.Add(obj); parent.Children.Add(this); await Animate.Margin(this, new Thickness(25, 0, 0, 25)); //await Animate.Margin(this, new Thickness(0, 15, 25, 0)); _lock = false; await Task.Delay(3000); _lock = true; if (Margin.Bottom > 25) { Animate.Opacity(this, 0); await Animate.Margin(this, new Thickness(25, 0, 0, Margin.Bottom + 25)); } else { await Animate.Margin(this, new Thickness(25, 0, 0, -45)); } //if (Margin.Top > 15) //{ // Animate.Opacity(this, 0); // await Animate.Margin(this, new Thickness(0, Margin.Top + 25, 25, 0)); //} //else //{ // await Animate.Margin(this, new Thickness(0, -45, 25, -45)); //} parent.Children.Remove(this); _lock = false; }
void CheckDebugGameInputs() { if (Input.GetKeyDown(KeyCode.F1)) { overlayManager.SelectOverlay(OverlayType.Default); } if (Input.GetKeyDown(KeyCode.F2)) { overlayManager.SelectOverlay(OverlayType.Type); } if (Input.GetKeyDown(KeyCode.F3)) { overlayManager.SelectOverlay(OverlayType.FireRisks); } if (Input.GetKeyDown(KeyCode.F4)) { overlayManager.SelectOverlay(OverlayType.Food); } if (Input.GetKeyDown(KeyCode.F5)) { overlayManager.SelectOverlay(OverlayType.Habitation); } if (Input.GetKeyDown(KeyCode.F6)) { overlayManager.SelectOverlay(OverlayType.Power); } if (Input.GetKeyDown(KeyCode.F7)) { overlayManager.SelectOverlay(OverlayType.Density); } if (Input.GetKeyDown(KeyCode.F12)) { FindObjectOfType <DebugInterface>().SpawnEventDebugWindow(); } if (Input.GetKeyDown(KeyCode.End)) { temporality.timeScale = 100; } if (Input.GetKeyDown(KeyCode.N)) { Notifications.Notification not = new Notifications.Notification( new string[] { "cannotBuild", "notLinked", "newPeople" }[Mathf.FloorToInt(Random.value * 3)], new Color[] { Color.red, Color.blue, Color.yellow, Color.Lerp(Color.red, Color.yellow, 0.5f) }[Mathf.FloorToInt(Random.value * 4)] ); FindObjectOfType <Notifications>().Notify(not); } if (Input.GetKeyDown(KeyCode.P)) { temporality.PauseTime(); } if (Input.GetKeyDown(KeyCode.Delete)) { eventManager.TriggerEvent(1000, true); } if (Input.GetKeyDown(KeyCode.KeypadPlus)) { eventManager.TriggerEvent(15); } // Pause if (Input.GetKeyDown(KeyCode.Escape) && IsInGame() && FindObjectsOfType <PauseWindow>().Length <= 0) { FindObjectOfType <Interface>().SpawnPauseWindow(); } // Reset camera if (Input.GetKeyDown(KeyCode.V)) { FindObjectOfType <CameraController>().ResetPosition(); } // Hide tooltip if (Input.GetKeyDown(KeyCode.H)) { try { FindObjectOfType <TooltipGO>().Disable(); } catch {} } // Unlock all if (Input.GetKeyDown(KeyCode.T)) { foreach (BlockScheme s in library.blocks) { cityManager.UnlockBuilding(s.ID); } } // Spawns 5 cit if (Input.GetKeyDown(KeyCode.U)) { populationManager.SpawnCitizens(populationManager.populationTypeList[Mathf.FloorToInt(populationManager.populationTypeList.Length * Random.value)], 5); } // Affect a block under the mouse if (Input.GetButtonDown("Select")) // LEFT MOUSE CLICK { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Block block = hit.collider.gameObject.GetComponent <Block>(); if (block != null) { if (Input.GetKey(KeyCode.F)) { if (!block.states.ContainsKey(State.OnFire)) { FireManager.Ignite(block); } else { block.RemoveState(State.OnFire); } } if (Input.GetKey(KeyCode.R)) { if (!block.states.ContainsKey(State.OnRiot)) { block.AddState(State.OnRiot); } else { block.RemoveState(State.OnRiot); } } if (Input.GetKey(KeyCode.D)) { if (!block.states.ContainsKey(State.Damaged)) { block.AddState(State.Damaged); } else { block.RemoveState(State.Damaged); } } } } } // Saves the game if (Input.GetKeyDown(KeyCode.M)) { Save(); } // Loads the game if (Input.GetKeyDown(KeyCode.L)) { saveManager.StartCoroutine( saveManager.ReadSaveData( cityManager.cityName, delegate { saveManager.LoadSaveData(saveManager.loadedData, delegate { FindObjectOfType <Notifications>().Notify( new Notifications.Notification("FINISHED LOADING", Color.green) ); }); } ) ); } if (Input.GetKeyDown(KeyCode.G)) { animationManager.EndElevateTower(new Vector2Int(cursorManagement.posInGrid.x, cursorManagement.posInGrid.z)); } // Goes forward in time by 1 cycle if (Input.GetKeyDown(KeyCode.C)) { temporality.AddCycle(); } if (Input.GetKeyDown(KeyCode.K)) { eventManager.LoadEvents(); } if (Input.GetKeyDown(KeyCode.B)) { temporality.AddMicroCycle(); } if (Input.GetKeyDown(KeyCode.W)) { populationManager.GenerateMoodModifier(populationManager.populationTypeList[0], 100, 10, 1000); } }
private void OnTorrentStateChanged(object sender, TorrentStateChangedEventArgs args) { TorrentManager manager = (TorrentManager)sender; Gtk.Application.Invoke (delegate { if (args.OldState == TorrentState.Downloading) { logger.Debug("Removing " + manager.Torrent.Name + " from download label"); mainWindow.DownloadingLabel.RemoveTorrent(manager); } else if (args.OldState == TorrentState.Seeding) { logger.Debug("Removing " + manager.Torrent.Name + " from upload label"); mainWindow.SeedingLabel.RemoveTorrent(manager); } if (args.NewState == TorrentState.Downloading) { logger.Debug("Adding " + manager.Torrent.Name + " to download label"); mainWindow.DownloadingLabel.AddTorrent(manager); } else if (args.NewState == TorrentState.Seeding) { logger.Debug("Adding " + manager.Torrent.Name + " to upload label"); mainWindow.SeedingLabel.AddTorrent(manager); } if (!prefSettings.EnableNotifications) return; if (args.NewState != TorrentState.Seeding) return; if (args.OldState != TorrentState.Downloading) return; Notifications.Notification notify = new Notifications.Notification ("Download Complete", manager.Torrent + " has finished downloading."); notify.AttachToWidget (mainWindow.TrayIcon); notify.Timeout = 5000; notify.Show (); }); }