public void setAlert(string msg, Alert.alertTypeEnum type) { this.Opacity = 0.0; this.StartPosition = FormStartPosition.Manual; string fname; for (int i = 1; i < 10; i++) { fname = "alert" + i.ToString(); Alert f = (Alert)Application.OpenForms[fname]; if (f == null) { this.Name = fname; this.x = Screen.PrimaryScreen.WorkingArea.Width - this.Width + 15; this.y = Screen.PrimaryScreen.WorkingArea.Height - this.Height * i - 5 * i; this.Location = new Point(this.x, this.y); break; } } this.x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5; switch (type) { case Alert.alertTypeEnum.Success: this.GunaPictureBox1.Image = Resources.Checkmark_28px; this.BackColor = Color.FromArgb(0, 192, 90); break; case Alert.alertTypeEnum.Warning: this.GunaPictureBox1.Image = Resources.Warning_28px; this.BackColor = Color.FromArgb(255, 121, 70); break; case Alert.alertTypeEnum.Error: this.GunaPictureBox1.Image = Resources.Error_28px; this.BackColor = Color.FromArgb(255, 30, 30); break; case Alert.alertTypeEnum.Info: this.GunaPictureBox1.Image = Resources.Info_28px; this.BackColor = Color.FromArgb(71, 169, 248); break; } this.GunaLabel1.Text = msg; //this.TopMost = false; //this.ShowIcon = false; //this.ShowInTaskbar = false; this.Show(); this.action = actionEnum.start; this.Timer1.Interval = 1; this.Timer1.Start(); }
public void setAlert(string pesan, Alert.alertTypeEnum type) { this.Opacity = 0.0; this.StartPosition = FormStartPosition.Manual; string fname; for (int i = 1; i < 10; i++) { fname = "alert" + i.ToString(); Alert f = (Alert)Application.OpenForms[fname]; if (f == null) { this.Name = fname; this.x = Screen.PrimaryScreen.WorkingArea.Width - this.Width + 15; this.y = Screen.PrimaryScreen.WorkingArea.Height - this.Height * i - 5 * i; this.Location = new Point(this.x, this.y); break; } } this.x = Screen.PrimaryScreen.WorkingArea.Width - base.Width - 5; switch (type) { case Alert.alertTypeEnum.Success: this.guna2PictureBox1.Image = Properties.Resources.icons8_delete_90px; this.BackColor = Color.FromArgb(26, 188, 156); this.guna2Panel1.BackColor = Color.FromArgb(50, 0, 0, 0); break; case Alert.alertTypeEnum.Warning: this.guna2PictureBox1.Image = Properties.Resources.icons8_delete_90px; this.BackColor = Color.FromArgb(241, 196, 15); this.guna2Panel1.BackColor = Color.FromArgb(50, 0, 0, 0); break; case Alert.alertTypeEnum.Error: this.guna2PictureBox1.Image = Properties.Resources.icons8_delete_90px; this.BackColor = Color.FromArgb(231, 76, 60); this.guna2Panel1.BackColor = Color.FromArgb(50, 0, 0, 0); break; } this.label1.Text = pesan; this.Show(); this.action = actionEnum.start; this.timer1.Interval = 1; this.timer1.Start(); }
public void Notif(string pesan, Alert.alertTypeEnum type) { Alert f = new Alert(); f.setAlert(pesan, type); }
// Alert function public void Alert(string msg, Alert.alertTypeEnum type) { Alert f = new Alert(); f.setAlert(msg, type); }