Ejemplo n.º 1
0
 private void FileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     LerLog();
     this.Invoke(new Action(() =>
     {
         LogBox.Focus();
         LogBox.Select(LogBox.Text.Length, 0);
     }));
 }
Ejemplo n.º 2
0
 private void prnt(string log)
 {
     //Special command that cleans the LogBox.
     if (log == "$LOG_CLEAN")
     {
         LogText = ""; StringsCount = 0;
     }
     else
     {
         LogText += log + "\n";  //Append text
     }
     //Scroll to the end.
     StringsCount++;
     LogBox.Text = LogText;
     if (StringsCount > 21)
     {
         LogBox.Focus();
         LogBox.SelectionStart = LogBox.Text.Length;
         LogBox.ScrollToCaret();
     }
 }
Ejemplo n.º 3
0
        private void prnt(string log)
        {
            CheckForIllegalCrossThreadCalls = false;

            //Special command that cleans the LogBox.
            if (log == "$LOG_CLEAN")
            {
                LogBox.Text = ""; StringsCount = 0;
            }
            else
            {
                LogBox.Text += log + "\n"; //Append text
            }
            //Scroll to the end.
            StringsCount++;
            if (StringsCount > 21)
            {
                LogBox.Focus();
                LogBox.SelectionStart = LogBox.Text.Length;
            }
        }
Ejemplo n.º 4
0
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            LoginButton.IsEnabled = false;
            using (DBContext db = new DBContext())
            {
                if (LogBox.Text.Length == 0)
                {
                    MessageBox.Show("Enter an email.");
                    LogBox.Focus();
                }
                else if (!Regex.IsMatch(LogBox.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"))
                {
                    MessageBox.Show("Enter a valid email.");
                    LogBox.Select(0, LogBox.Text.Length);
                    LogBox.Focus();
                }
                else
                {
                    string email    = LogBox.Text;
                    string password = PassBox.Password;

                    if (db.Users.Any(s => s.Email == email && s.Password == password))
                    {
                        Shop sp = new Shop();
                        sp.NameBlock.Text = db.Users.FirstOrDefault(s => s.Email == email && s.Password == password).Email;
                        if (db.Users.FirstOrDefault(s => s.Email == email && s.Password == password).Admin == true)
                        {
                            sp.Administration.Visibility = Visibility.Visible;
                        }
                        sp.Show();
                        Close();
                    }
                    else
                    {
                        MessageBox.Show("Sorry! Please enter existing email/password.");
                    }
                }
            }
            LoginButton.IsEnabled = true;
        }
Ejemplo n.º 5
0
        private void LerLog()
        {
            string newFileLines = "";

            using (FileStream stream = File.Open(caminholog,
                                                 FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                using (StreamReader reader = new StreamReader(stream))
                {
                    newFileLines = reader.ReadToEnd();
                }
            }

            LogBox.Invoke(new Action(() =>
            {
                LogBox.Focus();
                LogBox.Select(LogBox.Text.Length, 0);
                LogBox.Text += LogBox.Text + "\n" + newFileLines;
                LogBox.Focus();
                LogBox.Select(LogBox.Text.Length, 0);
            }));
        }
Ejemplo n.º 6
0
        private void prnt(string log)
        {
            CheckForIllegalCrossThreadCalls = false;

            //Special command that cleans the LogBox.
            if (log == "$LOG_CLEAN")
            {
                LogBox.Text = ""; StringsCount = 0;
            }
            else
            {
                LogBox.Text += log + "\n"; //Append text
            }
            //Scroll to the end.
            StringsCount++;
            if (StringsCount > 21)
            {
                LogBox.Focus();
                LogBox.SelectionStart = LogBox.Text.Length;
                LogBox.ScrollToCaret();
            }

            File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "RNXLOG.log", log + "\n");
        }
Ejemplo n.º 7
0
 public Login()
 {
     InitializeComponent();
     LogBox.Focus();
 }