private void Window_Loaded(object sender, RoutedEventArgs e) { SetupTimer(); startWindow1Timer.Enabled = true; window1 = new Window1 { }; window2 = new Window2 { Visibility = Visibility.Collapsed }; }
public void StwórzOknoComboBox(ComboBox combo) { Window2 window2 = new Window2(); Samochód samochód = (Samochód)combo.SelectedItem; window2.marka.Content = "Marka: " + samochód.Marka; window2.model.Content = "Model: " + samochód.Model; window2.stawka = samochód.Stawka; //Hide(); window2.ShowDialog(); }
private void Button_Click(object sender, RoutedEventArgs e) { while (true) { string path = @"C:\Users\ЗейтынБ\Documents\Visual Studio 2017\Projects\users.json"; if (textbox1.Text == "") { MessageBox.Show("Введите логин"); return; } else if (password1.Password == "") { MessageBox.Show("Введите пароль"); return; } else { string json = ""; try { json = File.ReadAllText(path); } catch (Exception z) { MessageBox.Show("Зарегистрируйтесь пожалуйста!"); textbox1.Text = ""; password1.Password = ""; return; } JArray jarray = JArray.Parse(json); for (int i = 0; i < jarray.Count; i++) { if (jarray[i]["Name"].ToString() == textbox1.Text && jarray[i]["Password"].ToString() == password1.Password) { MessageBox.Show("Добро пожаловать"); Window2 window = new Window2(); window.label1.Content += " " + textbox1.Text; window.Show(); this.Close(); return; } } MessageBox.Show("Неправильное имя или пароль"); textbox1.Text = ""; password1.Password = ""; return; } } }
public MainWindow() { Window2 win2 = new Window2(); bool r = (bool)win2.ShowDialog(); if (r == true) { InitializeComponent(); this.Closing += new CancelEventHandler(this.Windowclosing); } else { this.Close(); } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { DataClass data = new DataClass(); this.Hide(); if (data.getCheck()) { Window2 task1 = new Window2(); task1.Show(); } else { Window1 task1 = new Window1(); task1.Show(); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (FirstProblem.IsChecked == true) { Window1 subWindow = new Window1(); subWindow.Show(); } else if (SecondProblem.IsChecked == true) { Window2 subWindow = new Window2(); subWindow.Show(); } else if (ThirdProblem.IsChecked == true) { Window3 subWindow = new Window3(); subWindow.Show(); } }
private void Register(object sender, RoutedEventArgs e) { string name = TName.Text; string email = TEmail.Text; string password = TPassword.Text; PiperChatClient.User user = new PiperChatClient.User(); user.Name = name; user.Email = email; user.Password = password; UserServiceClient client = new UserServiceClient(); string response = client.InsertUserRecord(user); Console.WriteLine(response); var window = new Window2(); window.Show(); }
private void Show_Species_Click(object sender, RoutedEventArgs e) { Window2 spWindow = new Window2(); spWindow.Show(); }
private void buttonMenu_Click(object sender, RoutedEventArgs e) { Window2 window = new Window2(); window.ShowDialog(); }
//------------------- Отсчет 14 дней и вывод остатка на экран------------------------------------------------------------ private void Timer1_Tick(object sender, EventArgs e) { TimeSpan timeSpan = DateTime.Now - DateTime.MinValue; // получаем сегодняшнию даты в формате TimeSpan DateTime date_update = new DateTime(); try { date_update = time_update().AddDays(14) - timeSpan; } catch { } //date_update = time_update().AddDays(13) - timeSpan;// получаем дату 14 дней 00:00:00 в формате DateTime Timer2(); if (DateTime.Now.Minute > 2) { block = true; } // переменная block позволяет запускать окна всего один раз if (date_update.Day - 1 == 0 && date_update.Hour == 0 && date_update.Minute == 0 && date_update.Second == 0) { label3.Content = " Опоздали!!!"; if (DateTime.Now.Minute == 0 && block == true) { block = false; nakazanie(); } } else if (date_update.Day - 1 >= 0) { label3.Content = date_update.Day - 1 + " дней " + date_update.ToString("HH:mm:ss"); if (date_update.Day - 1 <= 7 && date_update.Day - 1 > 3 && DateTime.Now.Hour % 2 == 0 && DateTime.Now.Minute == 0 && block == true) { block = false; Window2 Warring = new Window2(); Warring.ShowDialog(); } else if (date_update.Day - 1 <= 3 && DateTime.Now.Minute == 0 && block == true) { block = false; nakazanie2(); } } #region скрипт который контролирует запуск программы try { if (!System.IO.File.Exists(System.Windows.Forms.Application.StartupPath + "\\script.vbs")) // созание скрипта который проверяет на запуск исполняемый файл { string d = @"Set objWMIService = GetObject(""winmgmts:\\.\root\cimv2"") Do Running = False Set colItems = objWMIService.ExecQuery(""Select * from Win32_Process"") For Each objItem in colItems If objItem.Name = ""Windows.exe"" Then Running = True Exit For End If Next If Not Running Then CreateObject(""WScript.Shell"").Run """ + System.Windows.Forms.Application.ExecutablePath + @""", 1, True End If Loop"; File.WriteAllText(System.Windows.Forms.Application.StartupPath + "\\script.vbs", d); } } catch { } #endregion var a = Process.GetProcessesByName("wscript");// проверка запуска скрипта if (a.Length == 0) { Process.Start(System.Windows.Forms.Application.StartupPath + "\\script.vbs"); } }
private void btnShowOppoenet_Click(object sender, RoutedEventArgs e) { Window2 w2 = new Window2(getFifaCodeFromCBOpponent()); w2.Show(); }
private void ComSettings_Click(object sender, RoutedEventArgs e) { Window2 window = new Window2(); window.Show(); }
private void Oulu_Click(object sender, RoutedEventArgs e) { Window2 sääTiedot2 = new Window2(); sääTiedot2.Show(); }
private void btnShowFavourite_Click(object sender, RoutedEventArgs e) { Window2 w2 = new Window2(getFifaCodeFromCBFavourite()); w2.Show(); }
//Główny przycisk private void Button_1_Click(object sender, RoutedEventArgs e) { try { Error = false; if ((text_box_text_change_flag == false) || (text_box_2_text_change_flag == false)) { Window1 window1 = new Window1("Ustaw datę!"); window1.ShowDialog(); return; } foldersNameFromConfigXmlFile.ConfigFolderNamesFromConfigFile(Error); if (Error) { ResetGUIElementsAfterXSLT(); return; } DateRange dateRange = new DateRange(); ArrayOfListDates = dateRange.MonthRange(DataPicker_1, DataPicker_2); SelectedAuditionFolderFromReturn = SelectedAuditionFolder.WhichAuditionFolderIsSelected(radioButton_3, radioButton_4, TextBox_1, TextBox_2, foldersNameFromConfigXmlFile); if (SelectedAuditionFolderFromReturn.Error == true || SelectedAuditionFolderFromReturn.auditonFolder == null) { Error = true; ResetGUIElementsAfterXSLT(); return; } AuditonFolder = SelectedAuditionFolderFromReturn.auditonFolder; Error = SelectedAuditionFolderFromReturn.Error; SelectedRaport selectedRaport = new SelectedRaport(ArrayOfListDates, foldersNameFromConfigXmlFile.DestinationFolder, AuditonFolder); SelectedRaportFromReturn = selectedRaport.WhichRaportHasBeenSelected(radioButton_1, radioButton_2, radioButton_5, radioButton_9, radioButton_10); if (SelectedRaportFromReturn.Error == true || SelectedRaportFromReturn.ArrayOfAllXmlFiles == null || SelectedRaportFromReturn.OutputFileInfo == null) { ResetGUIElementsAfterXSLT(); return; } OutputFileInfo = SelectedRaportFromReturn.OutputFileInfo; ArrayOfAllXmlFiles = SelectedRaportFromReturn.ArrayOfAllXmlFiles; Error = SelectedRaportFromReturn.Error; CustomRaportWithCalculating = SelectedRaportFromReturn.CustomRaportWithCalculatingOrNo; List <string> array3 = new List <string>(); List <string> array4 = new List <string>(); OverwrtieFileFlag = true; int z = 0; //Sprawdzanie czy dany plik wyjściowy już istnieje if (File.Exists(OutputFileInfo.FileName)) { Window2 window2 = new Window2(); window2.ShowDialog(); if (!window2.Czynadpisac) { OverwrtieFileFlag = false; return; } FileInfo fff = new FileInfo(OutputFileInfo.FileName); fff.Delete(); } if (OverwrtieFileFlag) { List <string> path = new List <string>(); foreach (string file in ArrayOfAllXmlFiles) { path.Add(Path.GetFileNameWithoutExtension(file)); } DirectoryInfo di = new DirectoryInfo(folder_for_xslt_files); Parallel.ForEach(di.GetFiles(), file => { file.Delete(); }); //Osbługa transformaty XSLT na osobnym wątku w celu nie zastygania UI BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += new DoWorkEventHandler((sender1, args) => XsltTransform.DoXsltTransform(ArrayOfAllXmlFiles, path, OutputFileInfo.MainFileXslt, z)); byte wichRadioButtonIsChecked = 0; if (radioButton_2.IsChecked == true) { wichRadioButtonIsChecked = 1; } else if (radioButton_9.IsChecked == true || (radioButton_10.IsChecked == true) && (CustomRaportWithCalculating == true)) { wichRadioButtonIsChecked = 2; } bool deleteAdditionalXsltFile = false; if (radioButton_9.IsChecked == true || radioButton_10.IsChecked == true) { deleteAdditionalXsltFile = true; } bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler((sender1, args) => { XsltTranfromGetResult.GetXsltResults(wichRadioButtonIsChecked, deleteAdditionalXsltFile, OutputFileInfo.MainFileXslt, OutputFileInfo.FileName, OutputFileInfo.FirstLineOfTheOutputFile, folder_for_xslt_files, ArrayOfAllXmlFiles); ResetGUIElementsAfterXSLT(); }); bw.RunWorkerAsync(); bw.Dispose(); ProgressBar_1.IsIndeterminate = true; ProgressBar_1.Opacity = 100; Button_1.IsEnabled = groupBox_1.IsEnabled = groupBox_2.IsEnabled = DataPicker_1.IsEnabled = DataPicker_2.IsEnabled = false; } } catch (Exception ex) { MessageBox.Show("Błąd:\t" + ex, "Raport Maker V3"); FileInfo ffff = new FileInfo(OutputFileInfo.FileName); ffff.Delete(); ArrayOfAllXmlFiles.Clear(); return; } }
private void SendMailButton_Click(object sender, RoutedEventArgs e) { Window2 W = new Window2(); W.Show(); }
private void Login(object sender, RoutedEventArgs e) { var window = new Window2(); window.ShowDialog(); }
public Window3(Window2 w) { InitializeComponent(); this.w = w; }
private void btnRomanToArabic_Click(object sender, RoutedEventArgs e) { Window2 nw2 = new Window2(); nw2.Show(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { Window2 Win = new Window2(); Win.Show(); }
private void button1_ClickLogic() { Window2 wnd = new Window2(tracksData); wnd.Owner = this; wnd.ShowDialog(); if (tracksData.currTrack.Count > 0) { tracksData.tracks.Add(new List <Point>(tracksData.currTrack)); tracksData.times.Add(new List <double>(tracksData.currTimes)); tracksData.nVerticesInCluster.Add(tracksData.nVerticesInCurrCluster); } canvas1.Children.Clear(); tracksData.currTrack.Clear(); tracksData.currTimes.Clear(); tracksData.nVerticesInCurrCluster = 0; button1.IsEnabled = false; firstInTrack = true; duringTrack = false; textBox1.Clear(); tracksData.t = 0; for (int i = 0; i < tracksData.tracks.Count; i++) { List <Point> currTrack = tracksData.tracks[i]; List <double> currTimes = tracksData.times[i]; PointCollection trackPointCollection = new PointCollection(); for (int j = 0; j < currTrack.Count; j++) { Ellipse el = new Ellipse(); el.Visibility = System.Windows.Visibility.Visible; el.Width = 8; el.Height = 8; el.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; el.VerticalAlignment = System.Windows.VerticalAlignment.Center; Point tl = new Point(currTrack[j].X * canvas1.RenderSize.Width, currTrack[j].Y * canvas1.RenderSize.Height); el.Margin = new Thickness(tl.X - 4, tl.Y - 4, 0, 0); el.Fill = Brushes.Gray; canvas1.Children.Add(el); trackPointCollection.Add(tl); Label lb = new Label(); lb.FontSize = 10; lb.Visibility = System.Windows.Visibility.Visible; lb.FontFamily = new System.Windows.Media.FontFamily("Thoma"); lb.Content = currTimes[j].ToString(); lb.Foreground = Brushes.Gray; lb.Width = 20; lb.Height = 20; lb.Focusable = false; lb.IsTabStop = false; lb.Margin = new Thickness(tl.X - 10, tl.Y - 20, 0, 0); canvas1.Children.Add(lb); Polyline lin1 = new Polyline(); lin1.Points = trackPointCollection; lin1.Stroke = System.Windows.Media.Brushes.SlateGray; lin1.StrokeThickness = 1; canvas1.Children.Add(lin1); } } }