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