public void Log(String toLog, LogMode logMode, AlertMode alertMode, String msg = null, String userDirectory = null) { worker.Enqueue(() => { ReLog(toLog, logMode, alertMode); }, reseter); }
private static void OnModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { if (e.NewValue != e.OldValue) { AlertMode mode = (AlertMode)e.NewValue; SolidColorBrush brush = null; switch (mode) { case AlertMode.Accent: brush = Application.Current.Resources["SystemAccentColor"] as SolidColorBrush; break; case AlertMode.Success: brush = Application.Current.Resources["PrimaryBrush"] as SolidColorBrush; break; case AlertMode.Warning: brush = Application.Current.Resources["WarningBrush"] as SolidColorBrush; break; case AlertMode.Danger: brush = Application.Current.Resources["DangerBrush"] as SolidColorBrush; break; } var control = d as Alert; control.BorderBrush = brush; var backgroundBrush = new SolidColorBrush(brush.Color) { Opacity = .1 }; control.Background = backgroundBrush; } }
public void Log(Exception toLog, LogMode logMode, AlertMode alertMode, String msg = null, String userDirectory = null) { worker.Enqueue(() => { ReLog("Message: " + toLog.Message + "\nStacktrace: " + toLog.StackTrace, logMode, alertMode); }, reseter); }
protected override void OnOpened() { base.OnOpened(); UIAlertBoxContext tContext = _context as UIAlertBoxContext; if (tContext == null) { _mode = AlertMode.OkCancel; CloseSelf(); return; } _mode = tContext.mode; _content = tContext.content; titleTxt.text = tContext.title; contentTxt.text = tContext.content.Replace(" ", "\u00A0");; if (tContext.mode == AlertMode.Ok) { cancelBtn.gameObject.SetActive(false); } else { cancelBtn.gameObject.SetActive(true); } if (!string.IsNullOrEmpty(tContext.okBtnContent)) { okBtnTxt.text = tContext.okBtnContent; } if (!string.IsNullOrEmpty(tContext.cancelBtnContent)) { cancelBtnTxt.text = tContext.cancelBtnContent; } }
private void InitializeAlertToast(AlertMode mode, string message) { InitializeDialog(); HideAllStacks(); AlertStack.IsVisible = true; switch (mode) { case AlertMode.Error: AlertIcon.Source = SvgIcon.GetSvgImageSource("Kheling.Mobile.Resources.error.svg", 32, 32, Color.Red); AlertMessage.TextColor = Color.Red; break; case AlertMode.Warning: AlertIcon.Source = SvgIcon.GetSvgImageSource("Kheling.Mobile.Resources.warning.svg", 32, 32, Color.Yellow); AlertMessage.TextColor = Color.Black; break; case AlertMode.Info: AlertIcon.Source = SvgIcon.GetSvgImageSource("Kheling.Mobile.Resources.info.svg", 32, 32, Color.Green); AlertMessage.TextColor = Color.Black; break; } AlertMessage.Text = message; }
private void UpdateDatas(LogMode logMode, AlertMode alertMode, object data, bool haveToBeSend, string path) { this.logMode = logMode; this.haveToBeSend = haveToBeSend; this.path = path; this.alertMode = alertMode; this.data = data; }
public UIAlertBoxContext(string title, string content, AlertMode mode, string okContent = "", string cancelContent = "") { this.title = title; this.content = content; this.mode = mode; okBtnContent = okContent; cancelBtnContent = cancelContent; }
public async void DisplayToast(AlertMode mode, string message) { dialogView.InitializeToast(mode, message); dialog.Window.ClearFlags(WindowManagerFlags.DimBehind); dialog.Show(); await Task.Delay(2000); Hide(); }
public Logger2(string name = "Logger", LogMode logMode = LogMode.NONE, AlertMode alertMode = AlertMode.NONE) { this.name = name + ": "; this.logMode = logMode; this.alertMode = alertMode; reseter = new ManualResetEvent(false); worker = new CommandWorker(this.name); worker.Start(); }
public void Alert(string title, string msg, AlertMode mode, Action <AlertResult> cb = null) { UIAlertBoxContext context = new UIAlertBoxContext(title, msg, mode); Instance.ShowWindow(WindowID.UIAlertBox, context, (w) => { UIAlertBox win = w as UIAlertBox; win.OnCommit = cb; }); }
private void ReLog(string toLog, LogMode logMode, AlertMode alertMode) { AlertMode tempAlert = this.alertMode; LogMode tempLog = this.logMode; this.alertMode = alertMode; this.logMode = logMode; this.Log(toLog); this.alertMode = tempAlert; this.logMode = tempLog; }
public static void AddResultAlert(this IDictionary <string, object> data, AlertMode mode, Result result, string returnUrl = null, string returnText = null, string cancelUrl = null, string cancelText = null) { if (result.Success) { data.AddAlert(mode, AlertType.Success, result.Message, null, returnUrl, returnText, cancelUrl, cancelText); } else { data.AddAlert(mode, AlertType.Error, result.Message); } }
protected internal virtual async Task <string> GetHeadingAsync(AlertMode mode) { await Task.CompletedTask; return(mode switch { AlertMode.Danger => "Error", AlertMode.Info => "Information", AlertMode.Success => "Confirmation", AlertMode.Warning => "Warning", _ => "Unknown" });
public void Log(object msg, LogMode logMode = LogMode.NONE, AlertMode alertMode = AlertMode.NONE, object data = null, Boolean haveToBeSend = false, String path = "") { LogMode logModeBkp = this.logMode; Boolean haveToBeSendBkp = this.haveToBeSend; String pathBkp = this.path; AlertMode alertModeBkp = this.alertMode; object dataBkp = this.data; UpdateDatas(logMode, alertMode, data, haveToBeSend, path); Log(msg); UpdateDatas(logModeBkp, alertModeBkp, dataBkp, haveToBeSendBkp, pathBkp); }
public Logger(string tag = "Logger", LogMode logMode = LogMode.NONE, AlertMode alertMode = AlertMode.NONE, object data = null, Boolean haveToBeSend = false, String path = "") { this.tag = tag; this.logMode = logMode; this.haveToBeSend = haveToBeSend; this.path = path; this.alertMode = alertMode; this.data = data; commandWorker = new CommandWorker("Logger"); commandWorker.Start(); manualResetEvent = new ManualResetEvent(false); cancellationTS = new CancellationTokenSource(); locker = new object(); Console(INIT); }
public static void AddAlert(this IDictionary <string, object> data, AlertMode mode, AlertType type, string message, string title = null, string returnUrl = null, string returnText = null, string cancelUrl = null, string cancelText = null) { var alerts = data.TryGetValue(AlertDataKey, out object alertsJson) ? alertsJson.ToString().ToJsonObject <List <Alert> >() : new List <Alert>(); alerts.Add(new Alert() { Mode = mode, Type = type, Message = message, Title = title, ReturnUrl = returnUrl, ReturnText = returnText, CancelUrl = cancelUrl, CancelText = cancelText }); data[AlertDataKey] = alerts.ToJsonString(); }
public void Log(String toLog, String msg = null, String userDirectory = null) { if (msg == null) { msg = toLog; } if (userDirectory == null) { userDirectory = Path.GetTempPath() + "\\" + Application.Current.ToString().Split('.')[0]; } switch (this.LogMode) { case LogMode.NONE: break; case LogMode.CONSOLE: Console.WriteLine(msg); break; case LogMode.EXTERNAL: SaveToFile(toLog, userDirectory); break; case LogMode.CURRENT_FOLDER: SaveToFile(toLog, AppDomain.CurrentDomain.BaseDirectory); break; case LogMode.TEMP_FOLDER: String directory = Path.GetTempPath() + "\\" + Application.Current.ToString().Split('.')[0]; SaveToFile(toLog, directory); break; default: break; } switch (this.AlertMode) { case AlertMode.NONE: break; case AlertMode.CONSOLE: break; case AlertMode.MESSAGE_BOX: //MessageBox.Show(msg); MessageBoxResult result = MessageBox.Show(msg, "Attention", MessageBoxButton.YesNo, MessageBoxImage.Information); if (result == MessageBoxResult.Yes) { this.AlertMode = AlertMode.NONE; LogMode temp = this.LogMode; this.LogMode = LogMode.CURRENT_FOLDER; this.Log(toLog); this.AlertMode = AlertMode.MESSAGE_BOX; this.LogMode = temp; } break; default: break; } }
public void HighAlert() { CancelCountdown(); this.currentMode = AlertMode.HIGH_ALERT; }
public void Alerted() { CancelCountdown(); this.currentMode = AlertMode.ALERTED; countdown = StartCoroutine("StartCountdown"); }
public void DisplayAlert(AlertMode mode, string message) { dialogView.InitializeAlert(mode, message); dialog.Window.AddFlags(WindowManagerFlags.DimBehind); dialog.Show(); }
public void Patrol() { this.currentMode = AlertMode.PATROLLING; }
protected internal virtual async Task <Alert> CreateAlertAsync(string information, AlertMode mode, string heading = null, IEnumerable <string> details = null) { var alert = await Task.FromResult(new Alert { Heading = heading ?? await this.GetHeadingAsync(mode), Information = information, Mode = mode }); foreach (var item in details ?? Enumerable.Empty <string>()) { alert.Details.Add(item); } return(alert); }
public Logger(LogMode logMode, AlertMode alertMode) { this.logMode = logMode; this.alertMode = alertMode; }
public void InitializeToast(AlertMode mode, string message) { ParentStack.VerticalOptions = new LayoutOptions(LayoutAlignment.End, true); AlertButton.IsVisible = false; InitializeAlertToast(mode, message); }