Hello there HF, I am having issues with my project, I am currently stuck using a framework 3.5 due to obfuscation methods. The problem I got is I need a new way of using a await Task.Delay from my tray pop ups. for it to fade in and fade out.
Could any help with this please :)
Code
private PopupDesign popupDesign1;
private Timer timer1;
private System.ComponentModel.IContainer components;
private Timer timer2;
private Timer timer3;
public static int CurrentNots = 0;
public static void addNote() { CurrentNots++; }
public static void remNote() { if (CurrentNots != 0) CurrentNots--; }
private void FadeIn(Form o, int interval = 80) {
while (o.Opacity < 1.0) {
await Task.Delay(interval);
o.Opacity += 0.05;
}
o.Opacity = 1;
await Task.Delay(2000);
FadeOut(o, interval);
}
private async void FadeOut(Form o, int interval = 80) {
while (o.Opacity > 0.0) {
await Task.Delay(interval);
o.Opacity -= 0.05;
}
o.Opacity = 0;
remNote();
}
public static Rectangle getScreen(Form o) {
return Screen.FromControl(o).Bounds;
}
public static int calculateLocation(Form o) {
return (getScreen(o).Height - 40) - ((62 + 15) * CurrentNots);
}
public Tray(
string title, string message,
PopupDesign.Kind kind = PopupDesign.Kind.Comp, Image image = null) {
InitializeComponent();
popupDesign1.Text = title;
popupDesign1.Description = message;
popupDesign1.Type = kind;
popupDesign1.Image = image;
addNote();
this.Location = new Point(getScreen(this).Width - Width - 20, calculateLocation(this));
this.Opacity = 0;
this.Show();
FadeIn(this, 20);
}Could any help with this please :)



