コード例 #1
0
 private void FileSystemWatcher_Changed(object sender, FileSystemEventArgs e)
 {
     LerLog();
     this.Invoke(new Action(() =>
     {
         LogBox.Focus();
         LogBox.Select(LogBox.Text.Length, 0);
     }));
 }
コード例 #2
0
 private void ServerSelectBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (connectedHost != null)
     {
         foreach (ServerInfo server in connectedHost.GetServerInfos())
         {
             if (ServerSelectBox.SelectedItem != null && ServerSelectBox.SelectedItem.ToString() == server.ServerName)
             {
                 selectedServer     = server;
                 ServerInfoBox.Text = server.ServerName;
                 LogBox.Text        = selectedServer.ConsoleBuffer.ToString();
                 LogBox.Select(LogBox.Text.Length, 0);
                 ComponentEnableManager();
             }
         }
     }
 }
コード例 #3
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;
        }
コード例 #4
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);
            }));
        }
コード例 #5
0
ファイル: MainFrm.cs プロジェクト: tomcat008/StartFrmApp
 private void GoTopMenuItem_Click(object sender, EventArgs e)
 {
     LogBox.Select(0, 0);
     LogBox.ScrollToCaret();
 }
コード例 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="message"></param>
 void Trace_OnTrace(string message)
 {
     LogBox.AppendText(message);
     LogBox.Select(LogBox.Text.Length, 0);
     LogBox.ScrollToCaret();
 }