private void CheckFixtureTwoIPExecute(object parameter) { try { string FixtureTwoIP = "192.168.254.11"; DnsEndPoint dnsEndpoint = new DnsEndPoint(FixtureTwoIP, 23); TelnetSettings ts = new TelnetSettings(dnsEndpoint, "extron"); ExtronDevice ed = new ExtronDevice(ts); var connectState = ed.Connect(5000, ExtronDevice.ConnectionBehavior.Block); if (connectState == ExtronDevice.DeviceState.Connected) { Fixture2Connect_NotConnect = "Connected"; } else { Fixture2Connect_NotConnect = "Error - Check Fixture 2"; } } catch (Exception a) { string InnerErrorMessage = ""; string ErrorMessage = string.Concat(a.Message.ToString(), a.StackTrace.ToString()); if (a.InnerException != null) { InnerErrorMessage = string.Concat(a.InnerException.Message.ToString(), a.InnerException.StackTrace.ToString()); } ExpressFWLoaderError.ExpressFWLoaderErrorMessenger("CheckFixtureTwoIPExecute", ErrorMessage, InnerErrorMessage, Environment.UserName); } }
public MainWindow() { #region TVCM Update #if !DEBUG ///Run TVC to Update Express FW Loader software try { CheckFiles myCf = new CheckFiles(); myCf.installFromTVCHelper("FirmwareLoad", "ExpressGangLoader", @"C:\TestFiles\FirmwareLoad\ExpressGangLoader\ExpressGangLoader.exe", 2, 1); } catch (Exception e) { string InnerErrorMessage = ""; string ErrorMessage = string.Concat(e.Message.ToString(), e.StackTrace.ToString()); if (e.InnerException != null) { InnerErrorMessage = string.Concat(e.InnerException.Message.ToString(), e.InnerException.StackTrace.ToString()); } ExpressFWLoaderError.ExpressFWLoaderErrorMessenger("TVCM Update", ErrorMessage, InnerErrorMessage, ""); } #endif #endregion #region Admin Right #if !DEBUG // Verify if ExpressGangLoader is running as admin //if YES -> Do nothing //else -> Restart Tools mt = new Tools(); if (!mt.IsRunAsAdmin()) { ProcessStartInfo proc = new ProcessStartInfo(); proc.UseShellExecute = true; proc.WorkingDirectory = Environment.CurrentDirectory; proc.FileName = Assembly.GetEntryAssembly().CodeBase; proc.Verb = "runas"; try { Process.Start(proc); Application.Current.Shutdown(); } catch (Exception ex) { Console.WriteLine("This program must be run as an administrator! \n\n" + ex.ToString()); } } #endif #endregion InitializeComponent(); ///Everything running Express FW loader ///Begin with checking all PCS, RS232, LAN commuinication ///Display # of available port and self-test software and hardware //SystemVerifyView verify = new SystemVerifyView(); ///MainViewModel with command MainVM mvm = new MainVM(); DataContext = mvm; }