public static void PrintOtherMes(TypeMessage typeMsg) { if (typeMsg == TypeMessage.StepCroupier) { Console.WriteLine("Ход крупье"); } if (typeMsg == TypeMessage.StepPlayer) { Console.WriteLine("Ход игрока"); } if (typeMsg == TypeMessage.CardCroupier) { Console.WriteLine("Карты крупье"); } if (typeMsg == TypeMessage.CardPlayer) { Console.WriteLine("Карты игрока"); } if (typeMsg == TypeMessage.MenuPlayer) { Console.WriteLine("F5 - взять карту, F6 - отказаться от последней карты, F7 - сказать достаточно\n"); } if (typeMsg == TypeMessage.FinishRound) { Console.WriteLine("Вы можете закончить раунд. Ничья (y/n)?"); } }
/// <summary> /// /// </summary> /// <param name="type">Type of message Warning</param> /// <param name="message">Message string.</param> private void WriteLog(TypeMessage type, string message) { Console.ForegroundColor = GetConsoleColor(type); DateTime currentDateTime = DateTime.Now; string currentDate = currentDateTime.ToString(Common.Culture.DateFormat); //this replace ToShortDateString() string logString = String.Format("type: {0} | date: {1} | message: {2}", (int)type, currentDate, message); if (LOG_CONSOLE) { Console.WriteLine(logString); } if (LOG_FILE) { FileManager.LogFile file = new FileManager.LogFile(); file.NewLog(currentDate, logString); if (!file.Success) { throw new Exception("Error while executing file manager."); } } if (LOG_DATABASE) { Database.RemoteServer db = new Database.RemoteServer(); db.NewLog((int)type, message, currentDateTime); if (!db.Success) { throw new Exception("Error while executing database server."); } } }
/// <summary> /// подготавливаем команду аутентификации /// </summary> /// <param name="user">отправитель</param> /// <returns>пакет для отправки</returns> public chatPacket authCommand(chatUser user) { userSender = user; command = Commands.AUTH; type = TypeMessage.SYSTEM;//отправляем с сервера return(this); }
void PrintSuccess(TypeMessage _type) { switch (_type) { case TypeMessage.save: failedText.text = "Save done"; break; case TypeMessage.load: failedText.text = "Load done"; bm.NameSave = textToFill.text; break; case TypeMessage.levelDone: failedText.text = "Well done !"; break; case TypeMessage.death: break; default: break; } StartCoroutine(TimerText()); }
public async Task <(bool, int, TypeMessage)> Impbresion(string input) { return(await Task.Run(() => { TypeMessage TP = TypeMessage.Normal; bool Impbresion = false; int line = 0; for (int i = 0; i < line; i++) { string token = input; if (input.Contains("Imp")) { if (!input.Contains("(") || !input.Contains(")")) { Impbresion = false; AsyncAdd(CONSOLEMESSAGE.MESSAGE, $"falta un parentesis.", TypeMessage.Error); } else if (!input.Contains(";")) { Impbresion = false; AsyncAdd(CONSOLEMESSAGE.MESSAGE, $"falta ';'.", TypeMessage.Error); } else { Impbresion = false; AsyncAdd(CONSOLEMESSAGE.MESSAGE, $"'Imp' no existe en el contexto actual.", TypeMessage.Error); } } } var tuple = (var_ : Impbresion, lin : line, Tipe : TP); return tuple; })); }
protected virtual void OnNotifyed(string text, TypeMessage typemsg) { Notify handler = Notifyed; Log.Write(text, typemsg); if (handler != null) handler(text, typemsg); }
public static void AddMessage(string p_Message, TypeMessage p_type, Control p_WebControl) { HtmlGenericControl _mydiv = new HtmlGenericControl("div"); if (p_type == TypeMessage.Message) { _mydiv.Attributes.Add("Class", "MessageSuccess MessageBox"); } if (p_type == TypeMessage.Alert) { _mydiv.Attributes.Add("Class", "MessageAlert MessageBox"); } if (p_type == TypeMessage.Error) { _mydiv.Attributes.Add("Class", "MessageError MessageBox"); } _mydiv.InnerText = p_Message; p_WebControl.Controls.Add(_mydiv); }
public static void Write(string message, TypeMessage type) { switch (type) { case TypeMessage.Debug: Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"{DateTime.Now} [Debug] {message}"); Console.ForegroundColor = ConsoleColor.White; break; case TypeMessage.Done: Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"{DateTime.Now} [+] : {message}"); Console.ForegroundColor = ConsoleColor.White; break; case TypeMessage.Error: Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"{DateTime.Now} [!] : {message}"); Console.ForegroundColor = ConsoleColor.White; break; case TypeMessage.Info: Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine($"{DateTime.Now} [?] : {message}"); Console.ForegroundColor = ConsoleColor.White; break; } }
public Message(TypeMessage t, string emetteur, Conge o) { Type = t; Emetteur = emetteur; //Date = DateTime.Now; Lu = false; switch (t) { case TypeMessage.NotifCongeAller: Titre = "Demande de congés"; //Contenu = "\nDu " + o.Debut + " au " + (o).Fin; if ((o).Statut == StatutConge.EnCours) { Contenu = ""; Redirection = "/ChefDeService/Index"; } else { Redirection = "/RH/Index"; } break; case TypeMessage.NotifCongeRetour: Titre = "Votre demande de congés"; Contenu = o.Statut.ToString(); Redirection = "/Conges/Index"; break; default: throw new HttpUnhandledException(); } }
public Message(string messageAffiche, string titreAffiche, TypeMessage typeMessage) { InitializeComponent(); this.typeMessage = typeMessage; message = messageAffiche; titre = titreAffiche; }
private void AppOnNotifyed(string text, TypeMessage typemsg) { ToolTipIcon icon; switch (typemsg) { case TypeMessage.Critical: case TypeMessage.Error: icon = ToolTipIcon.Error; break; case TypeMessage.Info: icon = ToolTipIcon.Info; break; case TypeMessage.Warning: icon = ToolTipIcon.Warning; break; default: icon = ToolTipIcon.None; break; } _ni.ShowBalloonTip(3000, "P2pProxy Proxy", text, icon); }
public LogMessage(string message, object tag, TypeMessage type ) : this() { Message = message; Type = type; Tag = tag; }
public void Write(string value, TypeMessage type) { if (sw == null || !_opened) { return; } ThreadPool.QueueUserWorkItem(state => { lock (sw) { string res = String.Format("[{0:HH:mm:ss.fff}] {1}: {2}", DateTime.Now, type, value); if (_dublConsole) { Console.WriteLine(res); } try { sw.WriteLine(res); } catch { Close(); } } }); }
/// <summary> /// подготавливаем команду аутентификации /// </summary> /// <param name="user">отправитель</param> /// <returns>пакет для отправки</returns> public chatPacket authCommand(chatUser user) { userSender = user; command = Commands.AUTH; type = TypeMessage.USER;//отправляем с клиента return(this); }
private bool CheckConnect(TypeMessage type = TypeMessage.Http) { var isConnect = CrossConnectivity.Current.IsConnected; if (!isConnect) { string message = string.Empty; switch (type) { case TypeMessage.Image: message = "Kết nối mạng không ổn định, tải ảnh lên chưa thành công"; break; case TypeMessage.File: message = "Kết nối mạng không ổn định, tải file lên chưa thành công"; break; case TypeMessage.Http: message = "Kết nối mạng không ổn định, thao tác không thành công"; break; default: message = "Kết nối mạng không ổn định, thao tác không thành công"; break; } message.ToToast(ToastNotificationType.Warning); } return(isConnect); }
public void Write(string value, TypeMessage type) { if (this.sw == null || !this._opened) return; ThreadPool.QueueUserWorkItem((WaitCallback)(state => { StreamWriter streamWriter = this.sw; bool lockTaken = false; try { Monitor.Enter((object)streamWriter, ref lockTaken); string str = string.Format("[{0:HH:mm:ss.fff}] {1}: {2}", DateTime.Now, type, value); if (this._dublConsole) Console.WriteLine(str); try { this.sw.WriteLine(str); } catch { this.Close(); } } finally { if (lockTaken) Monitor.Exit((object)streamWriter); } })); }
protected override void finish(int winning_index) { TypeMessage result = new TypeMessage(); result.key = winning_index; switch (winning_index) { case 0: { Debug.Assert(field0.have_value); result.choice0 = field0.value; break; } case 1: { Debug.Assert(field1.have_value); result.choice1 = field1.value; break; } default: { Debug.Assert(false); break; } } handle_result(result); }
public Message(string contenu, TypeMessage type) { string dossierImagesSysteme = ConfigurationManager.AppSettings["PathImagesSysteme"]; const string iconeOk = "IconeOk.png"; const string iconeErreur = "IconeErreur.png"; const string iconeInfo = "IconeInfo.png"; const string iconeAvertissement = "IconeAvertissement.png"; const string iconeInterdit = "IconeInterdit.png"; Type = type; Contenu = contenu; switch (type) { case TypeMessage.Ok: CheminImage = Path.Combine(dossierImagesSysteme, iconeOk); break; case TypeMessage.Info: CheminImage = Path.Combine(dossierImagesSysteme, iconeInfo); break; case TypeMessage.Avertissement: CheminImage = Path.Combine(dossierImagesSysteme, iconeAvertissement); break; case TypeMessage.Erreur: CheminImage = Path.Combine(dossierImagesSysteme, iconeErreur); break; case TypeMessage.Interdit: CheminImage = Path.Combine(dossierImagesSysteme, iconeInterdit); break; } }
public Message(TypeMessage t, Collaborateur c, LigneDeFrais n, bool refusé) { Type = t; Emetteur = c.Prenom + c.Nom + " - " + c.Service.Nom; //Date = DateTime.Now; Lu = false; switch (t) { case TypeMessage.NotifLigneRetour: if (refusé) { Titre = "Refus d'une ligne de frais"; } else { Titre = "Validation d'une ligne de Frais"; } Contenu = "nom : " + n.Nom + " | somme : " + n.Somme; Redirection = "/NoteDeFrais/Index"; break; default: throw new HttpUnhandledException(); } }
public async Task IncrementStatisticsAsync(ulong profileId, TypeMessage typeMessage) { var profile = await _profileService.GetProfileByIdAsync(profileId); if (profile == null) { return; } switch (typeMessage) { case TypeMessage.Text: profile.CountTextMessage++; break; case TypeMessage.Image: profile.CountMessageWithImage++; break; case TypeMessage.Url: profile.CountMessageWithUrl++; break; case TypeMessage.Any: break; default: throw new ArgumentOutOfRangeException(nameof(typeMessage), typeMessage, null); } await _db.SaveChangesAsync(); }
/// <summary> /// подготавливаем команду выдачи активных пользователей /// </summary> /// <param name="user">отправитель</param> /// <returns>пакет для отправки</returns> public chatPacket connectedUserList(chatUser user) { userSender = user; command = Commands.INFO; type = TypeMessage.SYSTEM;//отправляем с сервера return(this); }
public ModelStateMessages(string key, TypeMessage type, string[] messages) { this.Key = key; foreach (string msg in messages) { this.AddMessage(type, msg); } }
public TimerMessageBox(string message, int time, TypeMessage typeMessage = TypeMessage.Information) { Message = message; _sec = time; InitializeComponent(); timClose.Interval = 1000; timClose.Start(); }
static void Main01(string[] args) { TypeMessage msg = new TypeMessage(); Console.WriteLine(msg); Console.WriteLine(msg.GetType()); Console.ReadLine(); }
private static void AppOnNotifyed(string text, TypeMessage icon) { if (Console.CursorLeft != 0) Console.Write("\r\n"); string type = icon.ToString(); Console.WriteLine("[{2}]{0} : {1}", DateTime.Now, text, type); }
public HolderMessage(HolderMessage other) { have_data = other.haveData(); data = other.referenced(); if (have_data) { } }
public HolderMessage(TypeMessage init_data) { have_data = true; data = init_data; if (have_data) { } }
private void SetDisplayMessageType(MouseButtonEventArgs e, TypeMessage typeMessage) { if ((ErrorListExpander.IsExpanded) && (this.ViewModel.NodesCanvas.DisplayMessageType != typeMessage)) { e.Handled = true; } this.ViewModel.NodesCanvas.DisplayMessageType = typeMessage; }
public Messages() { Types = new TypeMessage(); Stages = new StageMessages(); Reasons = new ReasonMessage(); Associations = new Association.AssociationMessage(); TestCases = new TestCase.TestCaseMessage(); TestMethods = new TestMethod.TestMethodMessage(); }
public EventItem(string message, TypeMessage type, DispatcherTimer timer, Color backColor, Color foreColor) { this.Message = message; this.Timer = timer; this.Type = type; BackBrush = new SolidColorBrush(backColor); ForeBrush = new SolidColorBrush(foreColor); }
public void Add(string text, TypeMessage type) { if (string.IsNullOrEmpty(text)) { throw new ArgumentNullException("message"); } notificationMessages.Add(new Message(text, type)); }
public void WriteLine(string message, TypeMessage typeMessage = TypeMessage.Info) { var originalColor = Console.ForegroundColor; Console.ForegroundColor = GetTypeMessageColor(typeMessage); Console.WriteLine(message); Console.ForegroundColor = originalColor; }
private static void AppOnNotifyed(string text, TypeMessage icon) { if (Console.CursorLeft != 0) { Console.Write("\r\n"); } string type = icon.ToString(); Console.WriteLine("[{2}]{0} : {1}", DateTime.Now, text, type); }
protected virtual void OnNotifyed(string text, TypeMessage typemsg) { Notify handler = Notifyed; Log.Write(text, typemsg); if (handler != null) { handler(text, typemsg); } }
/// <summary> /// Retourne une instance de message de type indiqué /// </summary> /// <param name="type">Type du message voulu</param> /// <returns></returns> public static IMessage GetInstanceOf(TypeMessage type) { IMessage retour; switch (type) { case TypeMessage.DemandeCarte: retour = new MessageDemandeCarte(); break; case TypeMessage.IndicationClick: retour = new MessageIndicationClick(); break; case TypeMessage.DemandeDeplacement: retour = new MessageDemandeDeplacement(); break; case TypeMessage.ReponseDeplacement: retour = new MessageReponseDeplacement(); break; case TypeMessage.IndiquerPort: retour = new MessageIndiquerPort(); break; case TypeMessage.ReponseCarte: retour = new MessageReponseCarte(); break; case TypeMessage.Notif: retour = new MessageNotif(); break; case TypeMessage.ConnexionJoueur: retour = new MessageConnexion(); break; case TypeMessage.DeconnexionJoueur: retour = new MessageDeconnection(); break; case TypeMessage.DemandeTelep: retour = new MessageDemandeTelep(); break; case TypeMessage.Stop: retour = new MessageStop(); break; default: retour = null; break; } return retour; }
public void Write(string value, TypeMessage type) { if (sw == null || !_opened) return; ThreadPool.QueueUserWorkItem(state => { lock (sw) { string res = String.Format("[{0:HH:mm:ss.fff}] {1}: {2}", DateTime.Now, type, value); if (_dublConsole) Console.WriteLine(res); try { sw.WriteLine(res); } catch { Close(); } } }); }
/// <summary> /// Constructeur /// </summary> /// <param name="type">Type du message</param> /// <param name="nombre">Nombre de parametres pà prendre en compte</param> public Message(TypeMessage type, int nombre) { this._typeDuMessage = type; this._numParam = nombre; }
public void AppendMessage(string message, object obj, TypeMessage typeMessage) { _messages.Add(new LogMessage(message, obj, typeMessage)); }
public LogMessage(string message, TypeMessage type) : this() { Message = message; Type = type; }
public LogMessage(object tag, TypeMessage type) : this() { Type = type; Tag = tag; }
public static void log(string content, string header = "Message", TypeMessage type = TypeMessage.normal) { ConsoleColor headerForegroundColor; ConsoleColor headerBackgroundColor; ConsoleColor contentForegroundColor; ConsoleColor contentBackgroundColor; string timeNow = DateTime.Now.ToString(); lock (processLocker) { ConsoleColor currentForegroundColor = Console.ForegroundColor; ConsoleColor currentBackgroundColor = Console.BackgroundColor; switch (type) { case TypeMessage.unimportant: headerForegroundColor = ConsoleColor.DarkCyan; headerBackgroundColor = ConsoleColor.Black; contentForegroundColor = ConsoleColor.DarkGray; contentBackgroundColor = ConsoleColor.Black; header = "~~~ " + header + " ~~~"; break; case TypeMessage.normal: headerForegroundColor = ConsoleColor.White; headerBackgroundColor = ConsoleColor.DarkBlue; contentForegroundColor = ConsoleColor.Gray; contentBackgroundColor = ConsoleColor.Black; header = "-== " + header + " ==-"; break; case TypeMessage.important: headerForegroundColor = ConsoleColor.White; headerBackgroundColor = ConsoleColor.Blue; contentForegroundColor = ConsoleColor.DarkYellow; contentBackgroundColor = ConsoleColor.Black; header = "<<< " + header + " >>>"; break; case TypeMessage.warning: headerForegroundColor = ConsoleColor.Yellow; headerBackgroundColor = ConsoleColor.Blue; contentForegroundColor = ConsoleColor.Yellow; contentBackgroundColor = ConsoleColor.Black; header = "[[[ " + header + " ]]]"; break; case TypeMessage.caution: headerForegroundColor = ConsoleColor.Yellow; headerBackgroundColor = ConsoleColor.DarkRed; contentForegroundColor = ConsoleColor.Yellow; contentBackgroundColor = ConsoleColor.DarkMagenta; header = "<[[ " + header + " ]]>"; break; case TypeMessage.danger: headerForegroundColor = ConsoleColor.Yellow; headerBackgroundColor = ConsoleColor.Red; contentForegroundColor = ConsoleColor.Yellow; contentBackgroundColor = ConsoleColor.DarkRed; header = "<<{ " + header + " }>>"; break; case TypeMessage.error: headerForegroundColor = ConsoleColor.White; headerBackgroundColor = ConsoleColor.Red; contentForegroundColor = ConsoleColor.White; contentBackgroundColor = ConsoleColor.DarkRed; header = "+++ " + header + " +++"; break; case TypeMessage.terror: headerForegroundColor = ConsoleColor.Black; headerBackgroundColor = ConsoleColor.Yellow; contentForegroundColor = ConsoleColor.Black; contentBackgroundColor = ConsoleColor.Red; header = "*** " + header + " ***"; break; case TypeMessage.death: headerForegroundColor = ConsoleColor.Black; headerBackgroundColor = ConsoleColor.White; contentForegroundColor = ConsoleColor.Black; contentBackgroundColor = ConsoleColor.Yellow; header = "!!! " + header + " !!!"; break; default: headerForegroundColor = ConsoleColor.Green; headerBackgroundColor = ConsoleColor.DarkBlue; contentForegroundColor = ConsoleColor.Blue; contentBackgroundColor = ConsoleColor.DarkGreen; header = "___ " + header + " ___"; break; } if (writeLogFile) { try { if (!writeLogFileInitialised) LogFileInit(); lock (fileLocker) { logFile.Write("....... " + header + " (" + timeNow + ") \n"); logFile.Write(content + "\n"); } } catch (Exception e) { lock (fileLocker) { Console.WriteLine("***logger exception:"); Console.WriteLine("{0}", e); } } } if (writeLogConsole) { lock (consoleLocker) { Console.ForegroundColor = headerForegroundColor; Console.BackgroundColor = headerBackgroundColor; Console.WriteLine("....... " + header + " (" + timeNow + ")"); Console.ForegroundColor = contentForegroundColor; Console.BackgroundColor = contentBackgroundColor; Console.WriteLine(content); } } Console.ForegroundColor = currentForegroundColor; Console.BackgroundColor = currentBackgroundColor; } }