-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New notification module with images included
- Loading branch information
Showing
16 changed files
with
1,136 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using TeamViewerPopupBlocker.Forms; | ||
using TeamViewerPopupBlocker.Properties; | ||
|
||
namespace TeamViewerPopupBlocker.Classes.Notifications | ||
{ | ||
public sealed class ProgramStatus | ||
{ | ||
private static ProgramStatus instance = null; | ||
|
||
private static readonly object syncRoot = new Object(); | ||
|
||
public static ProgramStatus Instance | ||
{ | ||
get | ||
{ | ||
lock (syncRoot) | ||
{ | ||
return instance ?? (instance = new ProgramStatus()); | ||
} | ||
} | ||
} | ||
|
||
private List<Status> statusList = new List<Status>(); | ||
|
||
private DateTime tTimeStatusReady = DateTime.Now; | ||
|
||
public void AddStatus(Status srcStatus) | ||
{ | ||
statusList.Add(srcStatus); | ||
} | ||
|
||
public void GetStatus(MainForm mainForm) | ||
{ | ||
if (statusList.Count <= 0) return; | ||
|
||
bool tContnue = DateTime.Now > tTimeStatusReady; | ||
|
||
if (!tContnue) return; | ||
|
||
Status status = statusList[0].Clone(); | ||
|
||
if (status == null) | ||
{ | ||
return; | ||
} | ||
|
||
if (status.TimeOutMinimum > 0) | ||
{ | ||
this.tTimeStatusReady = DateTime.Now.AddMilliseconds(status.TimeOutMinimum); | ||
} | ||
|
||
switch (status.StatusType) | ||
{ | ||
case StatusType.StartBlocking: | ||
{ | ||
mainForm.ShowNotificationMessage(status.StatusType, | ||
Resources.ProgramStatus_GetStatus_Blocking_started, status.TimeOut); | ||
break; | ||
} | ||
|
||
case StatusType.StopBlocking: | ||
{ | ||
mainForm.ShowNotificationMessage(status.StatusType, | ||
Resources.ProgramStatus_GetStatus_Blocking_stopped, status.TimeOut); | ||
break; | ||
} | ||
|
||
case StatusType.ErrorException: | ||
{ | ||
mainForm.ShowNotificationMessage(status.StatusType, | ||
Resources.ProgramStatus_GetStatus_Exception_was_thrown_, status.TimeOut); | ||
break; | ||
} | ||
|
||
case StatusType.InfoUpToDate: | ||
{ | ||
mainForm.ShowNotificationMessage( | ||
status.StatusType, | ||
Resources.Your_version_is_up_to_date, | ||
status.TimeOut); | ||
break; | ||
} | ||
|
||
case StatusType.InfoUpdate: | ||
{ | ||
mainForm.ShowNotificationMessage( | ||
status.StatusType, | ||
status.AdditionalInformation, | ||
status.TimeOut); | ||
|
||
break; | ||
} | ||
|
||
} | ||
|
||
this.statusList.RemoveAt(0); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
|
||
namespace TeamViewerPopupBlocker.Classes.Notifications | ||
{ | ||
public class Status : ICloneable | ||
{ | ||
public Status() | ||
{ | ||
this.StatusType = StatusType.Unknown; | ||
this.TimeOut = 0; | ||
this.TimeOutMinimum = 0; | ||
this.AdditionalInformation = ""; | ||
} | ||
|
||
public Status(StatusType status, int timeOut, int timeOutMinimum = 0, string additionalInformation = "") | ||
{ | ||
this.StatusType = status; | ||
this.TimeOut = timeOut; | ||
this.TimeOutMinimum = timeOutMinimum; | ||
this.AdditionalInformation = additionalInformation; | ||
} | ||
|
||
public StatusType StatusType { get; set; } | ||
|
||
public int TimeOut { get; set; } | ||
|
||
public int TimeOutMinimum { get; set; } | ||
|
||
public string AdditionalInformation { get; set; } | ||
|
||
object ICloneable.Clone() | ||
{ | ||
return this.Clone(); | ||
} | ||
|
||
public Status Clone() | ||
{ | ||
return (Status)this.MemberwiseClone(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace TeamViewerPopupBlocker.Classes.Notifications | ||
{ | ||
public enum StatusType | ||
{ | ||
Unknown = 0, | ||
|
||
StartBlocking, | ||
|
||
StopBlocking, | ||
|
||
ErrorException, | ||
|
||
InfoUpdate, | ||
|
||
InfoUpToDate | ||
} | ||
} |
Oops, something went wrong.