public MainWindow() { InitializeComponent(); win1 = new Window1(this); win2 = new Window2(this); win3 = new Window3(this); }
private void BtnAddToBugs_Click(object sender, RoutedEventArgs e) { Window3 bWin = new Window3(); bWin.Owner = this; bWin.Show(); }
private void Button_Click_3(object sender, RoutedEventArgs e) { Hide(); Window3 Готово = new Window3(); Готово.Show(); Close(); }
// user login button private void first_Click(object sender, RoutedEventArgs e) { //validate data from user-input if (username.Text.Length == 0) { errormessage.Text = "Enter an username."; username.Focus(); } else if (pd.Password.Length == 0) { errormessage1.Text = "Enter an password."; pd.Focus(); } // MessageBox.Show(password.ToString()); dc = new DataClasses1DataContext(); Table tb = new Table(); //fetching value from database var q1 = from a in dc.logins where a.type == firstname.Text && a.username == username.Text && a.password == pd.Password.ToString() select a; foreach (var b in q1) { if (b.type == "Admin" && b.username == username.Text && b.password == pd.Password.ToString()) { MessageBox.Show("Welcome " + username.Text); string value = username.Text; Window3 w2 = new Window3(); w2.fetch(value.ToString()); w2.Show(); this.Close(); } else if (b.type == "Manager" && b.username == username.Text && b.password == pd.Password.ToString()) { //MessageBox.Show("Welcome Manager"); MessageBox.Show("Welcome " + username.Text); string value = username.Text; MainWindow w2 = new MainWindow(); w2.fetch(value.ToString()); w2.Show(); this.Close(); } else if (b.type == "Employee" && b.username == username.Text && b.password == pd.Password.ToString()) { MessageBox.Show("Welcome " + username.Text); string value = username.Text; Window2 w2 = new Window2(); w2.fetch(value.ToString()); w2.Show(); this.Close(); } } }
private void Buttonlogin_Click(object sender, RoutedEventArgs e) { Window2 windo2 = new Window2(); Window3 window3 = new Window3(); if (pass.Text == "step") { windows2.Close(); window3.ShowDialog(); } else { MessageBox.Show("Пароль не пiдходить, спробуйте звернутися до викладача."); } }
private void acceptButton_Click1(object sender, RoutedEventArgs e) { int a = ComboBox1.SelectedIndex; if (a == 0) { Hide(); Window3 Готово = new Window3(); Готово.ShowDialog(); Close(); } else { Close(); Hide(); } }
private void buttonListView_Click(object sender, RoutedEventArgs e) { Window3 window = new Window3(); window.ShowDialog(); }
public void work(int i) { if (checkForInternetConnection()) { if (tasktype == "find") { WebClient site = new WebClient(); Uri uriResult; bool result = Uri.TryCreate(this.url, UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps); if (result) { string linkToImage = FindImage(site); if (linkToImage == "") { errorStr = "image"; return; } if (responsetype == "saveas") { Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = this.text; dlg.DefaultExt = ".png"; dlg.Filter = "Image (.png)|*.png"; Nullable <bool> resultBool = dlg.ShowDialog(); if (resultBool == true) { this.filename = dlg.FileName; } if (filename != "") { using (WebClient client = new WebClient()) { client.DownloadFile(linkToImage, this.filename); } errorStr = "complete"; } } this.filename = "meme" + i.ToString() + ".png"; if (responsetype == "mail") { using (WebClient client = new WebClient()) { client.DownloadFile(linkToImage, this.filename); } if (!SendMail(linkToImage)) { errorStr = "address"; } } this.filename = "meme" + i.ToString() + ".png"; if (responsetype == "display") { Window2 win2 = new Window2(); var image = new Image(); var fullFilePath = linkToImage; BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(fullFilePath, UriKind.Absolute); bitmap.EndInit(); image.Source = bitmap; win2.canvas.Children.Add(image); using (WebClient client = new WebClient()) { client.DownloadFile(linkToImage, this.filename); } win2.ShowDialog(); errorStr = "complete"; } } } else if (tasktype == "weather") { try { using (WebClient client = new WebClient()) { string fullcityname = city[0].ToString().ToUpper() + city.Substring(1).ToLower(); city = fullcityname; string weatherJson = client.DownloadString(findweather(city)); var wth = JsonConvert.DeserializeObject <jsonClass.RootObject>(weatherJson); this.name = wth.name; this.temp = wth.main.temp; this.press = wth.main.pressure; this.humid = wth.main.humidity; this.desc = wth.weather[0].description; int tmpInd = weatherJson.IndexOf("\"icon\":\""); this.wetid = weatherJson.Substring(tmpInd + "\"icon\":\"".Length, 3); } if (tempCase < this.temp) { if (responsetype == "mail") { if (!SendWeather()) { errorStr = "address"; } } else if (responsetype == "saveas") { string content = "Oto dzisiejsza pogoda w mieście: " + name + "\n" + " Temperatura powietrza wynosi " + temp + " stopni.\n" + "Ciśnienie wynosi " + press + " hektopaskali.\n" + "Wilgotność powietrza na poziomie " + humid + ".\n" + "Ogólnie pogodę można opisać słowami: " + desc + "."; Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = "pogoda"; dlg.DefaultExt = ".txt"; dlg.Filter = "txt files (*.txt)|*.txt"; Nullable <bool> resultBool = dlg.ShowDialog(); if (resultBool == true) { StreamWriter writer = new StreamWriter(dlg.OpenFile()); writer.Write(content); writer.Dispose(); writer.Close(); this.filename = dlg.FileName; } errorStr = "complete"; } else if (responsetype == "display") { string content = "Oto dzisiejsza pogoda w mieście: " + name + "\n" + "Temperatura powietrza wynosi " + temp + " stopni.\n" + "Ciśnienie wynosi " + press + " hektopaskali.\n" + "Wilgotność powietrza na poziomie " + humid + ".\n" + "Ogólnie pogodę można opisać słowami: " + desc + "."; Window3 win3 = new Window3(); win3.label.Content = content; var image = new Image(); var fullFilePath = @"http://openweathermap.org/img/w/" + this.wetid + ".png"; Console.WriteLine(this.wetid); BitmapImage bitmap = new BitmapImage(); bitmap.BeginInit(); bitmap.UriSource = new Uri(fullFilePath, UriKind.Absolute); bitmap.EndInit(); image.Source = bitmap; win3.weatherIcon.Children.Add(image); win3.ShowDialog(); errorStr = "complete"; } } else { errorStr = "temp"; } } catch (Exception ex) { errorStr = "weather"; } } } else { errorStr = "internet"; return; } }
public void UpdateExistingDonation(object sender, RoutedEventArgs e) { if (my_user_id == 0) { MessageBox.Show("Please connect to Twitch using the 'Launch' button first to add a manual donation."); } else { using (SqliteConnection db = new SqliteConnection("Filename=donations.db")) { List <string> bidwarOptions = new List <string>(); foreach (object child in TextBoxes.Children) { var textbox = (TextBox)child; if (textbox.Text != "") { bidwarOptions.Add(textbox.Text); } } db.Open(); string q = "SELECT * FROM allDonations7 WHERE User = @User ORDER BY Created_At DESC"; SqliteCommand insertSQL2 = new SqliteCommand(q, db); insertSQL2.Parameters.AddWithValue("@User", my_user_id); SqliteDataReader query2; try { query2 = insertSQL2.ExecuteReader(); } catch (SqliteException error) { throw new Exception(error.Message); System.Diagnostics.Debug.WriteLine(error.Message); } List <Bid> donationHistory = new List <Bid>(); while (query2.Read()) { string message = query2.GetString(7); Boolean found = false; //only attribute this donation to the first found search term in the donation message foreach (var msg in bidwarOptions) { if (message.ToLower().Trim().Contains(msg.ToLower().Trim()) && !found) { found = true; } } if (!found) { try { Bid thisBid = new Bid(query2.GetString(0), query2.GetInt32(2), query2.GetDouble(3), query2.GetString(4), query2.GetString(5), query2.GetString(6), query2.GetString(7)); donationHistory.Add(thisBid); } catch (Exception eee) { Bid thisBid = new Bid(query2.GetString(0), query2.GetInt32(2), query2.GetDouble(3), query2.GetString(4), query2.GetString(5), null, query2.GetString(7)); donationHistory.Add(thisBid); } } } db.Close(); Window3 window3 = new Window3(bidwarOptions, donationHistory, my_user_id); window3.Show(); } } }
private void Button_Click_1(object sender, RoutedEventArgs e) { Window3 window3 = new Window3(); window3.Show(); }