public static Bitmap ConvertWhiteAndBlack(Resim resim) { var _color = resim.background_color; var target = resim.orginal_bitmap; for (int x = 0; x < target.Width; x++) { for (int y = 0; y < target.Height; y++) { var color = target.GetPixel(x, y); var boya = new Boya(); boya.x = x; boya.y = y; if (color.R > _color.R * 85 / 100 && color.G > _color.G * 85 / 100 && color.B > _color.B * 85 / 100) { target.SetPixel(x, y, Color.White); boya.isWhite = true; } else { target.SetPixel(x, y, Color.Black); boya.isWhite = false; } resim.boyalar.Add(boya); } Form1.current_yuzde = Convert.ToInt32(((float)x / target.Width) * 100); } return(target); }
private void button1_Click(object sender, EventArgs e) { var username = textBox1.Text; var password = textBox2.Text; var user = UserRepository.Login(username, password); if (user == null || user.UserId == Guid.Empty) { MessageBox.Show("Yanlış Bilgi", "Hata", MessageBoxButtons.OK); } else { var permissions = UserRepository.GetUserPages(); if (permissions != null) { var page = permissions.FirstOrDefault(); switch (page.Title.Trim()) { case "Depo": var depo = new Depo(); depo.Show(); break; case "Dikimhane": var dikimhane = new Dikimhane(); dikimhane.Show(); break; case "Kesimhane": var kesimhane = new Kesimhane(); kesimhane.Show(); break; case "Baskı": var baski = new Baski(); baski.Show(); break; case "Boya": var boya = new Boya(); boya.Show(); break; case "Lojistik": var lojistik = new Lojistik(); lojistik.Show(); break; case "Admin": var adminform = new AdminForm(); adminform.Show(); break; case "Teknik Personel": var technicForm = new TechnicForm(); technicForm.Show(); break; case "Usta Başı": var makine1 = new Makine1(); makine1.Show(); break; default: break; } } if (permissions == null) { MessageBox.Show("Hata Saptandı", "Hata", MessageBoxButtons.OK); } else { UserRepository.GetUserPages(); } } }
public MainForm() { var permissions = UserRepository.GetUserPages(); var user = CurrentUser.LoginUser; if (permissions != null) { var page = permissions.FirstOrDefault(); switch (page.Title.Trim()) { case "Depo": var depo = new Depo(); depo.Show(); break; case "Dikimhane": var dikimhane = new Dikimhane(); dikimhane.Show(); break; case "Kesimhane": var kesimhane = new Kesimhane(); kesimhane.Show(); break; case "Baskı": var baski = new Baski(); baski.Show(); break; case "Boya": var boya = new Boya(); boya.Show(); break; case "Lojistik": var lojistik = new Lojistik(); lojistik.Show(); break; case "Admin": var adminform = new AdminForm(); adminform.Show(); break; case "Teknik Personel": TechnicForm technicForm = new TechnicForm(); technicForm.Show(); break; case "Usta Başı": UstaBasiForm ustaBasiForm = new UstaBasiForm(); ustaBasiForm.Show(); break; default: break; } } if (permissions == null) { MessageBox.Show("Hata Saptandı", "Hata", MessageBoxButtons.OK); } else { UserRepository.GetUserPages(); } }