Exemplo n.º 1
0
        public MessageView(string message, string caption, MessageViewMode mode, bool autoClose = true)
        {
            InitializeComponent();
            this.Title     = caption;
            textBlock.Text = message;
            if (mode == MessageViewMode.Message)
            {
                btn.Visibility = Visibility.Collapsed;
                System.Timers.Timer timer = new System.Timers.Timer(2000);
                timer.AutoReset = false;
                timer.Elapsed  += Timer_Elapsed;
                timer.Enabled   = autoClose;
            }
            switch (mode)
            {
            case MessageViewMode.Message:
                image.Source = new BitmapImage(new Uri("Resources/Message.png", UriKind.Relative));
                break;

            case MessageViewMode.Attention:
                image.Source = new BitmapImage(new Uri("Resources/Attention.png", UriKind.Relative));
                break;

            case MessageViewMode.Error:
                image.Source = new BitmapImage(new Uri("Resources/Error.png", UriKind.Relative));
                break;
            }
        }
Exemplo n.º 2
0
        public MessageView(string message, string caption, MessageViewMode mode, bool autoClose = true)
        {
            InitializeComponent();
            this.Text   = caption;
            label1.Text = message;
            if (mode == MessageViewMode.Message)
            {
                this.Height     = 75;
                button1.Visible = false;
                System.Timers.Timer timer = new System.Timers.Timer(2000);
                timer.AutoReset = false;
                timer.Elapsed  += Timer_Elapsed;
                timer.Enabled   = autoClose;
            }
            switch (mode)
            {
            case MessageViewMode.Message:
                pictureBox1.Image = Properties.Resources.Message;
                break;

            case MessageViewMode.Attention:
                pictureBox1.Image = Properties.Resources.Attention;
                break;

            case MessageViewMode.Error:
                pictureBox1.Image = Properties.Resources.Error;
                break;
            }
        }
Exemplo n.º 3
0
        private static void WriteInFile(string path, string error, string message, string caption, MessageViewMode mode)
        {
            string       s  = DateTime.Now.ToString("########## dd.MM.yyyy HH:mm:ss");
            StreamWriter sw = new StreamWriter(path + "errors.txt", true, Encoding.Unicode);

            sw.WriteLine(s + "\n " + message + "\n" + error);
            sw.Close();
            if (caption != null)
            {
                MessageView mv = new MessageView(message, caption, mode);
                mv.ShowDialog();
            }
        }
Exemplo n.º 4
0
 public static void LogShow(string path, string message, string error, string caption, MessageViewMode mode)
 {
     WriteInFile(path, error, message, caption, mode);
 }