author | StephaneLenclud |
Thu, 28 Jul 2016 19:32:40 +0200 | |
changeset 225 | 6ccaa430aa23 |
permissions | -rw-r--r-- |
StephaneLenclud@225 | 1 |
// |
StephaneLenclud@225 | 2 |
// Copyright (C) 2014-2016 Stéphane Lenclud. |
StephaneLenclud@225 | 3 |
// |
StephaneLenclud@225 | 4 |
// This file is part of SharpDisplayManager. |
StephaneLenclud@225 | 5 |
// |
StephaneLenclud@225 | 6 |
// SharpDisplayManager is free software: you can redistribute it and/or modify |
StephaneLenclud@225 | 7 |
// it under the terms of the GNU General Public License as published by |
StephaneLenclud@225 | 8 |
// the Free Software Foundation, either version 3 of the License, or |
StephaneLenclud@225 | 9 |
// (at your option) any later version. |
StephaneLenclud@225 | 10 |
// |
StephaneLenclud@225 | 11 |
// SharpDisplayManager is distributed in the hope that it will be useful, |
StephaneLenclud@225 | 12 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
StephaneLenclud@225 | 13 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
StephaneLenclud@225 | 14 |
// GNU General Public License for more details. |
StephaneLenclud@225 | 15 |
// |
StephaneLenclud@225 | 16 |
// You should have received a copy of the GNU General Public License |
StephaneLenclud@225 | 17 |
// along with SharpDisplayManager. If not, see <http://www.gnu.org/licenses/>. |
StephaneLenclud@225 | 18 |
// |
StephaneLenclud@225 | 19 |
|
StephaneLenclud@225 | 20 |
using System; |
StephaneLenclud@225 | 21 |
using System.Collections.Generic; |
StephaneLenclud@225 | 22 |
using System.Linq; |
StephaneLenclud@225 | 23 |
using System.Threading.Tasks; |
StephaneLenclud@225 | 24 |
using System.Windows.Forms; |
StephaneLenclud@225 | 25 |
using System.Drawing; |
StephaneLenclud@225 | 26 |
|
StephaneLenclud@225 | 27 |
namespace SharpDisplayClientMessage |
StephaneLenclud@225 | 28 |
{ |
StephaneLenclud@225 | 29 |
static public class Program |
StephaneLenclud@225 | 30 |
{ |
StephaneLenclud@225 | 31 |
/// <summary> |
StephaneLenclud@225 | 32 |
/// The main entry point for the application. |
StephaneLenclud@225 | 33 |
/// </summary> |
StephaneLenclud@225 | 34 |
[STAThread] |
StephaneLenclud@225 | 35 |
public static void Main() |
StephaneLenclud@225 | 36 |
{ |
StephaneLenclud@225 | 37 |
//Set high priority to our process to avoid lags when rendering to our screen |
StephaneLenclud@225 | 38 |
//System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.AboveNormal; |
StephaneLenclud@225 | 39 |
|
StephaneLenclud@225 | 40 |
Application.EnableVisualStyles(); |
StephaneLenclud@225 | 41 |
Application.SetCompatibleTextRenderingDefault(false); |
StephaneLenclud@225 | 42 |
Application.Run(new FormClientMessage()); |
StephaneLenclud@225 | 43 |
} |
StephaneLenclud@225 | 44 |
|
StephaneLenclud@225 | 45 |
[STAThread] |
StephaneLenclud@225 | 46 |
public static void MainWithParams(object aParams) |
StephaneLenclud@225 | 47 |
{ |
StephaneLenclud@225 | 48 |
//Set high priority to our process to avoid lags when rendering to our screen |
StephaneLenclud@225 | 49 |
//System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.AboveNormal; |
StephaneLenclud@225 | 50 |
|
StephaneLenclud@225 | 51 |
Application.EnableVisualStyles(); |
StephaneLenclud@225 | 52 |
Application.SetCompatibleTextRenderingDefault(false); |
StephaneLenclud@225 | 53 |
FormClientMessage form = new FormClientMessage(); |
StephaneLenclud@225 | 54 |
form.Params = (StartParams)aParams; |
StephaneLenclud@225 | 55 |
form.WindowState = FormWindowState.Minimized; |
StephaneLenclud@225 | 56 |
form.ShowInTaskbar = false; |
StephaneLenclud@225 | 57 |
Application.Run(form); |
StephaneLenclud@225 | 58 |
} |
StephaneLenclud@225 | 59 |
|
StephaneLenclud@225 | 60 |
} |
StephaneLenclud@225 | 61 |
|
StephaneLenclud@225 | 62 |
public class StartParams |
StephaneLenclud@225 | 63 |
{ |
StephaneLenclud@225 | 64 |
public StartParams(string aPrimaryText, string aSecondaryText ="", int aDurationInMs = 5000, uint aClientPriority = SharpLib.Display.Priorities.Foreground) |
StephaneLenclud@225 | 65 |
{ |
StephaneLenclud@225 | 66 |
PrimaryText = aPrimaryText; |
StephaneLenclud@225 | 67 |
SecondaryText = aSecondaryText; |
StephaneLenclud@225 | 68 |
Priority = aClientPriority; |
StephaneLenclud@225 | 69 |
DurationInMs = aDurationInMs; |
StephaneLenclud@225 | 70 |
} |
StephaneLenclud@225 | 71 |
|
StephaneLenclud@225 | 72 |
public string PrimaryText { get; set; } |
StephaneLenclud@225 | 73 |
public string SecondaryText { get; set; } |
StephaneLenclud@225 | 74 |
public uint Priority { get; set; } |
StephaneLenclud@225 | 75 |
public int DurationInMs { get; set; } |
StephaneLenclud@225 | 76 |
} |
StephaneLenclud@225 | 77 |
} |