예제 #1
0
        private void ToolStrip_Click(object sender, EventArgs e)
        {
            var targetEnv = (sender as ToolStripMenuItem).Name;
            var result    = environment.SetEnvironment(targetEnv);

            foreach (var toolStripItem in contextMenuStrip.Items)
            {
                if (toolStripItem is ToolStripMenuItem)
                {
                    (toolStripItem as ToolStripMenuItem).Font = new Font((toolStripItem as ToolStripMenuItem).Font, FontStyle.Regular);
                }
            }

            // set selected to black
            if (result)
            {
                (sender as ToolStripMenuItem).Font = new Font((sender as ToolStripMenuItem).Font, FontStyle.Bold);
                notifyIcon.BalloonTipTitle         = $"Active Environment: {environment.CurrentEnvironment.Hostname}";
                notifyIcon.BalloonTipText          = $"{environment.CurrentEnvironment.IpAddress}";
                notifyIcon.BalloonTipIcon          = ToolTipIcon.Info;
                notifyIcon.ShowBalloonTip(3000);
            }
            else
            {
                notifyIcon.BalloonTipTitle = $"Error";
                notifyIcon.BalloonTipText  = $"Could not set environment configuration for: {targetEnv}";
                notifyIcon.BalloonTipIcon  = ToolTipIcon.Error;
                notifyIcon.ShowBalloonTip(3000);
            }
        }
예제 #2
0
 static void Main(string[] args)
 {
     if (args.Length != 0)
     {
         var targetEnv = args[0];
         System.Console.WriteLine($"Updating hostconfig with '{targetEnv}' environment info");
         var environment = new EnvironmentConfig();
         var result      = environment.SetEnvironment(targetEnv);
         System.Console.WriteLine($"Result {result}");
     }
     else
     {
         System.Console.WriteLine("No environment has been specified!");
     }
 }