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