StatLight.Console.Tools.ConsoleIconSwapper.ShowConsoleIcon C# (CSharp) 메소드

ShowConsoleIcon() 공개 메소드

public ShowConsoleIcon ( Icon icon ) : void
icon System.Drawing.Icon
리턴 void
        public void ShowConsoleIcon(Icon icon)
        {
            NativeMethods.SendMessage(_consoleWindowHwnd, NativeMethods.WmSeticon, NativeMethods.IconSmall, icon.Handle);
        }

Usage Example

예제 #1
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
                                                              {
                                                                  Console.WriteLine(e.ExceptionObject);
                                                              };
            PrintNameVersionAndCopyright();

            ArgOptions options;

            using (var consoleIconSwapper = new ConsoleIconSwapper())
            {
                consoleIconSwapper.ShowConsoleIcon(CoreResources.FavIcon);

                try
                {
                    options = new ArgOptions(args);

                    if (options.ShowHelp)
                    {
                        ArgOptions.ShowHelpMessage(Console.Out, options);
                        return;
                    }

                    if (!options.XapPaths.Any() && !options.Dlls.Any())
                    {
                        throw new StatLightException("No xap or silverlight dll's specified.");
                    }

                    ILogger logger = GetLogger(options.IsRequestingDebug);

                    var commandLineExecutionEngine = new CommandLineExecutionEngine(logger, options);
                    TestReportCollection testReports = commandLineExecutionEngine.Run();

                    if (testReports.FinalResult == RunCompletedState.Failure)
                        Environment.ExitCode = ExitFailed;
                    else
                        Environment.ExitCode = ExitSucceeded;

                }
                catch (AddressAccessDeniedException addressAccessDeniedException)
                {
                    Environment.ExitCode = ExitFailed;
                    var helpMessage = @"
            Cannot run StatLight. The current account does not have the correct privilages.

            Exception:
            {0}

            Try: (the following two steps that should allow StatLight to start a web server on the requested port)
             1. Run cmd.exe as Administrator.
             2. Enter the following command in the command prompt.
              netsh http add urlacl url=http://+:8887/ user=DOMAIN\user
            ".FormatWith(addressAccessDeniedException.Message);

                    WriteErrorToConsole(helpMessage, "Error");
                }
                catch (FileNotFoundException fileNotFoundException)
                {
                    HandleKnownError(fileNotFoundException);
                }
                catch (StatLightException statLightException)
                {
                    HandleKnownError(statLightException);
                }

                catch (Exception exception)
                {
                    HandleUnknownError(exception);
                }
            }
        }
All Usage Examples Of StatLight.Console.Tools.ConsoleIconSwapper::ShowConsoleIcon