public MainWindow() { InitializeComponent(); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> Application started..."); //Időzítő indítása timer.Tick += Timer_Tick; timer.Interval = new TimeSpan(0, 0, 0, 0, 500); timer.Start(); CommandText.Focus(); CommandPalette.Visibility = Visibility.Visible; CommandLoader.Visibility = Visibility.Collapsed; }
private void ConnectButton_Click(object sender, EventArgs e) { if ("".Equals(IP.Text) || "".Equals(UserName.Text) || "".Equals(Password.Text)) { return; } try { try { reader._conn.Close(); } catch (Exception e1) { _MessageBox.AppendText(e1.Message); } this.Text = IP.Text + " - LogAnalysis ";// + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion.ToString(); reader.ip = IP.Text; reader.Port = Port.Text; reader.userName = UserName.Text; reader.passwordWord = Password.Text; reader.form = this; reader.consoleVisible = true; reader.start(); analysis.AlertLevel1 = Convert.ToInt32(ErrorTimeLV1.Text); analysis.AlertLevel2 = Convert.ToInt32(ErrorTimeLV2.Text); analysis.AlertLevel3 = Convert.ToInt32(ErrorTimeLV3.Text); if (analysisThread == null || !analysisThread.IsAlive) { (analysisThread = new Thread(new ThreadStart(analysis.start))).Start(); } FolderBrowserDialog openFolderDialog1 = new FolderBrowserDialog(); openFolderDialog1.SelectedPath = Environment.CurrentDirectory; openFolderDialog1.Description = "請選擇錯誤檔案輸出資料夾"; openFolderDialog1.ShowDialog(); Constants.LOG_FILE_PATH = openFolderDialog1.SelectedPath; refreshTimer.Interval = Convert.ToInt32(tRefreshTime.Text); refreshTimer.Start(); CommandText.Focus(); } catch (Exception ec) { _MessageBox.AppendText(ec.Message); } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { CommandText.Focus(); }
private void Window_KeyDown(object sender, KeyEventArgs e) { //Parancs bevitele és szelektálása if (e.Key == Key.Enter) { //Ha nem üres a beviteli mező if (!string.IsNullOrEmpty(CommandText.Text)) { CommandPalette.Visibility = Visibility.Collapsed; CommandLoader.Visibility = Visibility.Visible; CommandText.Text = CommandText.Text.ToUpper(); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " <-- " + CommandText.Text); // WEBOLDAL BENYITÁSOK ************************************************** //GOOGLE TÉRKÉP MEGNYITÁSA if (CommandText.Text.Contains("MAP")) { if (CommandText.Text.Contains("CITY")) { try { string[] searchText = CommandText.Text.Split(); Process.Start("https://www.google.com/maps/place/" + searchText[2]); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> Map opened and the searched city:[- " + searchText[2] + " -]"); } catch (Exception error) { CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> ERROR - " + error.Message); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> ERROR - There is an error in the command!"); } } else {//Alap térkép Process.Start("https://www.google.com/maps/?hl=hu"); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> Map opened..."); } } //Youtube megnyitása else if (CommandText.Text.Contains("YOUTUBE")) { if (CommandText.Text.Contains("SEARCH")) { try { string[] searchText = CommandText.Text.Split(); Process.Start("https://www.youtube.com/results?search_query=" + searchText[2]); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> Youtube opened and the searched video:[- " + searchText[2] + " -]"); } catch (Exception error) { CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> ERROR - " + error.Message); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> ERROR - There is an error in the command!"); } } else { Process.Start("https://www.youtube.com"); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> Youtube opened..."); } } //NCORE MEGNYITÁSA else if (CommandText.Text.Contains("NCORE")) { //NCORE AKTIVITÁS MEGNYITÁSA if (CommandText.Text == "NCORE ACTIVITY") { Process.Start("https://ncore.cc/hitnrun.php"); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> Ncore Activity opened..."); } else { Process.Start("https://ncore.cc/index.php"); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> Ncore opened..."); } } // KONZOL TULAJDONSÁGOK ************************************************** //Konzol kiürítése else if (CommandText.Text.Contains("CLEAR")) { CommandPalette.Items.Clear(); CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> Console cleared..."); } //Alkalmazás bezárása else if (CommandText.Text.Contains("EXIT")) { this.Close(); } //Hibás parancs!! else { CommandPalette.Items.Add(DateTime.Now.ToString("hh:mm:ss") + " --> Unknonw command [- " + CommandText.Text + " -]"); } CommandText.Text = ""; CommandText.Focus(); CommandPalette.Visibility = Visibility.Visible; CommandLoader.Visibility = Visibility.Collapsed; } } }