Пример #1
0
 /// <summary>Starts the window of the application, and then runs the provided installer program.</summary>
 /// <param name="installer">The installer program to run..</param>
 private static void StartVisualApp(UpdateInstaller installer, bool showInstallationWindow, int timeoutAfterSuccessfullInstallation)
 {
     if (null == app)
     {
         app = new System.Windows.Application();
     }
     if (null == mainWindow)
     {
         mainWindow = new InstallerMainWindow(showInstallationWindow, timeoutAfterSuccessfullInstallation)
         {
             _installer = installer
         };
         app.Run(mainWindow);
     }
 }
Пример #2
0
        static void Main(string[] args)
        {
            string fileLaunch = null;

            if (args.Length > 0)
            {
                fileLaunch = args[0];
            }

            System.Windows.Application app = new System.Windows.Application();
            FaceSortUI.MainWindow      m   = new FaceSortUI.MainWindow(fileLaunch);

            #region Hookup
            Distance         distance         = new Distance();
            Layout           layOut           = new Layout(1000, 1000);
            BoostLBPDistance boostLBPDistance = new BoostLBPDistance();

            //m.MainCanvas.DistanceCalculationDelegate += new FaceSortUI.BackgroundCanvas.BackendDelegate(distance.RankOneDistance);
            m.MainCanvas.DistanceCalculationDelegate += new FaceSortUI.BackgroundCanvas.BackendDelegate(boostLBPDistance.LBPDistance);

            //m.MainCanvas.runMdsDelegate += new FaceSortUI.BackgroundCanvas.BackendDelegate(layOut.InitialLayout);
            m.MainCanvas.runMdsDelegate += new FaceSortUI.BackgroundCanvas.BackendDelegate(layOut.HierachicalLayout);
            m.MainCanvas.runMdsUpdate   += new FaceSortUI.BackgroundCanvas.BackendDelegate(layOut.DynamicLayout);
            #endregion Hookup

            app.Run(m);

            return;
        }
        private void Run()
        {
            var application = new System.Windows.Application();
            var window      = new System.Windows.Window();

            application.Run(window);
        }
Пример #4
0
        public void run_application()
        {
            var waitForApplicationStart = new ManualResetEvent(false);

            _thread = new Thread(() =>
                                     {
                                         _app = new System.Windows.Application();
                                         _app.Startup += (s, e) =>
                                                             {
                                                                 waitForApplicationStart.Set();
                                                                 _app.MainWindow = new Window();
                                                                 _app.MainWindow.ShowDialog();
                                                             };
                                         _app.Run();
                                     });
            _thread.IsBackground = true;
            _thread.SetApartmentState(ApartmentState.STA);
            _thread.Name = "Application under testing";
            _thread.Start();
            waitForApplicationStart.WaitOne();

            _dispatcher = Dispatcher.FromThread(_thread);
            _dispatcher.Invoke(new ThreadStart(() => _window = _app.MainWindow as TestApp.Window));

            _process = Process.GetCurrentProcess();
            _application = new Application(_process);
            _windowAutomation = _application.FindWindow("MainWindow");
              //  Thread.Sleep(TimeSpan.FromSeconds(20));
        }
Пример #5
0
        public static void AssemblyInitialize(TestContext context)
        {
            var waitForApplicationRun = new TaskCompletionSource <bool>();

            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(() =>
                                                                                                     //Task.Run(() =>
            {
                var application = new System.Windows.Application();

                application.Startup += (s, e) => {
                    application.Dispatcher.Invoke(() =>
                    {
                        application.MainWindow            = window = new System.Windows.Window();
                        application.MainWindow.Background = new SolidColorBrush(Colors.Black);
                        window.Content = new System.Windows.Controls.ContentControl();
                        window.Show();
                        waitForApplicationRun.SetResult(true);
                    });
                };
                application.Run();
                return;
            }));
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            UIThread = t;
            waitForApplicationRun.Task.Wait();
        }
Пример #6
0
        static void Main(string[] args)
        {
            try
            {
                PresentationTraceSources.Refresh();
                PresentationTraceSources.DataBindingSource.Listeners.Add(new DefaultTraceListener());

                PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Warning | SourceLevels.Error;

                ThemeManager.ApplicationThemeName = Theme.VS2010Name;
                // bool bdownload = DataUtils.ActivityUtils.DownLoadActivity(Loadprocess);
                DXSplashScreen.Show <SplashScreen_AMTS>();
                //DXSplashScreen.Progress(10);
                DXSplashScreen.SetState("Start Loding...");
                DataUtils.StaticInfo.ExecutePath         = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                DataUtils.StaticInfo.LoginUser           = "******";
                DataUtils.StaticInfo.LocalModel          = ConfigurationManager.AppSettings["LocalModel"] == null ? "" : ConfigurationManager.AppSettings["LocalModel"].ToUpper();
                DataUtils.StaticInfo.AutoConnect         = ConfigurationManager.AppSettings["AutoConnect"] == null ? "" : ConfigurationManager.AppSettings["AutoConnect"].ToUpper();
                DataUtils.StaticInfo.ProcessName         = ConfigurationManager.AppSettings["ProcessName"] == null ? "" : ConfigurationManager.AppSettings["ProcessName"].ToUpper();
                DataUtils.StaticInfo.AutoLoadStateBySN   = ConfigurationManager.AppSettings["AutoLoadStateBySN"] == null ? "" : ConfigurationManager.AppSettings["AutoLoadStateBySN"].ToUpper();
                DataUtils.StaticInfo.AutoLoadStateFile   = ConfigurationManager.AppSettings["AutoLoadStateFile"] == null ? "" : ConfigurationManager.AppSettings["AutoLoadStateFile"].ToUpper();
                DataUtils.StaticInfo.ATEKind             = ConfigurationManager.AppSettings["ATEKind"] == null ? "" : ConfigurationManager.AppSettings["ATEKind"].ToUpper();
                DataUtils.StaticInfo.ATEStatusFile       = ConfigurationManager.AppSettings["ATEStatusFile"] == null ? "" : ConfigurationManager.AppSettings["ATEStatusFile"].ToUpper();
                DataUtils.StaticInfo.MesMode             = ConfigurationManager.AppSettings["MesMode"] == null ? "" : ConfigurationManager.AppSettings["MesMode"].ToUpper();
                DataUtils.StaticInfo.ResultString        = ConfigurationManager.AppSettings["ResultListerner"] == null ? "" : ConfigurationManager.AppSettings["ResultListerner"].ToUpper().Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", "").Trim();
                AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(ApplicationUtils.CurrentDomain_AssemblyResolve);
                DXSplashScreen.SetState("Loading The ApplicationTheme");
                DXSplashScreen.SetState("Check File Revisions...");
                DXSplashScreen.Progress(Loadprocess = 5);
                DXSplashScreen.SetState("Loading Application Instance");

                //string url = System.Reflection.Assembly.GetExecutingAssembly().Location + ";component/App.xaml";
                //string uri = "";
                //string param = "";
                //if (GetAssemblyInstanse(url, ref uri, ref param) == null) { throw new Exception("GetAssemblyInstanse is NULL!"); };
                //(System.Windows.Application)System.Windows.Application.LoadComponent(new System.Uri(uri, System.UriKind.Relative));
                System.Windows.Application app = new System.Windows.Application();
                app.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(app_DispatcherUnhandledException);
                DXSplashScreen.SetState("Loading Main FrameWork");
                DXSplashScreen.Progress(Loadprocess = 70);
                System.Windows.Window MainWindow = new MainWindow();
                DXSplashScreen.SetState("Run MainWindow");
                DXSplashScreen.Progress(Loadprocess = 90);
                app.Run(MainWindow);
            }
            catch (Exception ex)
            {
                LOG.WriteLog(ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.Source);
                if (DXSplashScreen.IsActive)
                {
                    DXSplashScreen.Close();
                }
                ApplicationUtils.SaveException(ex);
                System.Windows.MessageBox.Show(ex.Message);
                if (DXSplashScreen.IsActive)
                {
                    DXSplashScreen.Close();
                }
            }
        }
Пример #7
0
        public static System.Windows.Application CreateUIApplication(int width = 500, int height = 250)
        {
            var waitForApplicationRun = new TaskCompletionSource <System.Windows.Application>();

            System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(() =>
            {
                var application = new System.Windows.Application();

                application.Startup += (s, e) =>
                {
                    application.Dispatcher.Invoke(() =>
                    {
                        var window = application.MainWindow = new System.Windows.Window()
                        {
                            Width = width, Height = height
                        };
                        window.Content = new System.Windows.Controls.ContentControl();
                        window.Show();
                        if (window.IsLoaded)
                        {
                            waitForApplicationRun.TrySetResult(application);
                        }
                        else
                        {
                            window.Loaded += (s2, e2) => waitForApplicationRun.TrySetResult(application);
                        }
                    });
                };
                application.Run();
            }));
            t.SetApartmentState(System.Threading.ApartmentState.STA);
            t.Start();
            waitForApplicationRun.Task.Wait();
            return(waitForApplicationRun.Task.Result);
        }
Пример #8
0
        public void run_application()
        {
            var waitForApplicationStart = new ManualResetEvent(false);

            _thread = new Thread(() =>
            {
                _app          = new System.Windows.Application();
                _app.Startup += (s, e) =>
                {
                    waitForApplicationStart.Set();
                    _app.MainWindow = new Window();
                    _app.MainWindow.ShowDialog();
                };
                _app.Run();
            });
            _thread.IsBackground = true;
            _thread.SetApartmentState(ApartmentState.STA);
            _thread.Name = "Application under testing";
            _thread.Start();
            waitForApplicationStart.WaitOne();

            _dispatcher = Dispatcher.FromThread(_thread);
            _dispatcher.Invoke(new ThreadStart(() => _window = _app.MainWindow as TestApp.Window));

            _process          = Process.GetCurrentProcess();
            _application      = new Application(_process);
            _windowAutomation = _application.FindWindow("MainWindow");
            //  Thread.Sleep(TimeSpan.FromSeconds(20));
        }
        static void Main(string[] args)
        {
            System.Windows.Application _wpfApp = new System.Windows.Application();
            MainWindow _window = new MainWindow();

            _wpfApp.Run(_window);
        }
Пример #10
0
        private static void start_wpf_app()
        {
            MainWindow wnd = new MainWindow();

            System.Windows.Application wpfApp = new System.Windows.Application();
            wpfApp.Run(wnd);
        }
Пример #11
0
        static void Main()
        {
#if true
            // set TestGuiComponent.Program as "Startup object" in this project's Property window

#if false
            // WPF: dynamically loaded window.
            System.Windows.Application app = new System.Windows.Application();
            app.Run(new DynamicallyLoadedWindow());
#elif false
            // WPF
            System.Windows.Application app = new System.Windows.Application();
            app.Run(new MyWindow());
#elif false
            // WPF
            System.Windows.Application app = new System.Windows.Application();
            System.Windows.Navigation.NavigationWindow window = new System.Windows.Navigation.NavigationWindow();
            MyPage page = new MyPage();
            window.Navigate(page);
            app.Run(window);
#else
            // Windows Forms
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
#endif
#else
            // set TestGuiComponent.App as "Startup object" in this project's Property window

            // WPF
            //System.Windows.Application app = new TestGuiComponent.App();
            //app.InitializeComponent();
            //app.Run();
#endif
        }
Пример #12
0
        void run()
        {
            load_data();
            var results = train_network();
            var wpfApp  = new System.Windows.Application();

            wpfApp.Run(new PlotWindow(results));
        }
Пример #13
0
        public static void ShowModel(ModelOutput modelFields)
        {
            var app = new System.Windows.Application();

            var w = new ModelFieldsWindow(modelFields);

            app.Run(w);
        }
    public void openUI()
    {
        var application = new System.Windows.Application();
        var ui          = new Window();

        application.Run(ui);
        application.Shutdown();
    }
Пример #15
0
        public static void Main()
        {
            var app = new System.Windows.Application();

            app.Run(new MainWindow()
            {
                Title = "Cat tracker"
            });
        }
Пример #16
0
 public static void Main()
 {
     System.Windows.Application app = new System.Windows.Application();
     app.Run(new Window()
     {
         Title    = "Fixed Window Height",
         Width    = 525.0,
         _Height_ = new Driver <double>(() => 300.0)
     });
 }
Пример #17
0
        static void Main(string[] args)
        {
            var app = new System.Windows.Application();

            s_dispatcher = app.Dispatcher;

            new Thread(Run).Start();

            app.Run();
        }
Пример #18
0
        static void Main()
        {
            System.Windows.Application myApp = new System.Windows.Application();
            MainWindow myWindow = new MainWindow();
            MainWindowViewModel viewModel = new MainWindowViewModel();

            myWindow.DataContext = viewModel;
            myApp.ShutdownMode = System.Windows.ShutdownMode.OnMainWindowClose;
            myApp.Run(myWindow);
        }
Пример #19
0
 public static void Main()
 {
     System.Windows.Application app = new System.Windows.Application();
     app.Run(new Hyperplan.Selenium.Window()
     {
         Title  = "Hello World!",
         Height = 350.0,
         Width  = 525.0
     });
 }
Пример #20
0
        static void Main()
        {
            // System.Windows.Forms.Application.EnableVisualStyles();
            // System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
            // System.Windows.Forms.Application.Run(new Form1());

            System.Windows.Application app = new System.Windows.Application();
            //app.Run(new ChromeWebPannel());     // 컨트롤이 있는 브라우저
            app.Run(new SimpleMainWindow());        // 심플 브라우저
        }
Пример #21
0
        public static void RunWpf()
        {
            //Windows forms:
            //Application.Run(new ResultsForm());
            //System.Windows.Forms.Application.Run(new ResultsForm());

            //WPF
            var form = new System.Windows.Application();

            form.Run(new ResultsWpf());
        }
Пример #22
0
        static void Main()
        {
            //Create an instance of a new Application
            System.Windows.Application _wpfApplication = new System.Windows.Application();

            //Set the start up URI as your XAML page
            _wpfApplication.StartupUri = new Uri("MainWindow.xaml", UriKind.RelativeOrAbsolute);

            //Run this Application by callinf the Run() method
            _wpfApplication.Run();
        }
Пример #23
0
        private static void ShowGraphingForm()
        {
            Thread thread = new Thread(() =>
            {
                _GraphingWindow = new MyWindow();
                System.Windows.Application _wpfApplication = new System.Windows.Application();
                _wpfApplication.Run(_GraphingWindow);
            });

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start();
        }
Пример #24
0
        static void Main(string[] args)
        {
            //Application a = new Application();
            //a.StartupUri = new Uri("MainWindow.xaml", System.UriKind.Relative);
            //a.Run();
            app = new System.Windows.Application();

            MainWindowClass window = new MainWindowClass();

            app.Run(window);
            //window.Show();
        }
Пример #25
0
        public void openUI()
        {
            var application = new System.Windows.Application();
            var ui          = new BackgroundManagerUI.MainWindow();

            ui.Data        = Handle.data;
            ui.DataContext = ui.Data;
            ui.loadNonBindings();

            application.Run(ui);
            application.Shutdown();
        }
Пример #26
0
    static void Main()
    {
        Application app = new System.Windows.Application();
        // While the application is running WPF processes Windows messages and routes events to WPF UI object
        // as necessary.
        Window1 window = new Window1();

        window.Show();
        app.Run();
        // once an instance of Application object is created, it is available via the Current static
        // property of the Application class.
        // WPF makes sure that at most one Application object is created per Application Domain.
    }
Пример #27
0
        private void ThreadStartingPoint()
        {
            System.Windows.Application application = new System.Windows.Application();
            Main = new MainWindow();

            Main.Closed += (sender2, e2) =>
                           Main.Dispatcher.InvokeShutdown();

            application.Run(Main);


            //System.Windows.Threading.Dispatcher.Run();
        }
Пример #28
0
    private static void Foo()
    {
        var markerService = new MarkerService();
        var viewModel     = new MainViewModel();

        markerService.Register(viewModel);
        var mainView = new MainWindow {
            DataContext = viewModel
        };

        System.Windows.Application app = new System.Windows.Application();
        app.Run(mainView);
    }
        void run()
        {
            Console.Title = "Ch_05_Visualizing_Intermediate_Activations";
            computeDevice = Util.get_compute_device();

            var features          = CNTK.Variable.InputVariable(new int[] { 150, 150, 3 }, CNTK.DataType.Float, "features");
            var adjusted_features = CNTK.CNTKLib.Plus(CNTK.Constant.Scalar <float>((float)(-110), computeDevice), features, "adjusted features");

            var scalar_factor   = CNTK.Constant.Scalar <float>((float)(1.0 / 255.0), computeDevice);
            var scaled_features = CNTK.CNTKLib.ElementTimes(scalar_factor, adjusted_features, "scaled features");
            var base_model      = VGG16.get_model(scaled_features, computeDevice);

            Util.summary(base_model);

            var app = new System.Windows.Application();

            var layer_names = new string[] { "pool1", "pool2", "pool3" };
            var num_entries = new int[] { 64, 64, 256 };

            for (int i = 0; i < layer_names.Length; i++)
            {
                var intermediate_node = base_model.FindByName(layer_names[i]);
                var model             = CNTK.CNTKLib.Combine(new CNTK.VariableVector()
                {
                    intermediate_node.Output
                });

                var image        = load_image_in_channels_first_format(cat_filename, 150, 150);
                var image_tensor = CNTK.Value.CreateBatch(features.Shape, image, computeDevice);

                var input_d = new Dictionary <CNTK.Variable, CNTK.Value>()
                {
                    { features, image_tensor }
                };
                var output_d = new Dictionary <CNTK.Variable, CNTK.Value>()
                {
                    { model.Output, null }
                };
                model.Evaluate(input_d, output_d, computeDevice);

                var outputValues   = output_d[intermediate_node.Output].GetDenseData <float>(intermediate_node.Output);
                var feature_height = intermediate_node.Output.Shape[0];
                var feature_width  = intermediate_node.Output.Shape[1];
                var activations    = outputValues[0].Take(num_entries[i] * feature_width * feature_height).ToArray();

                var window = new PlotWindowBitMap(layer_names[i], activations, feature_height, feature_width, 1);
                window.Show();
            }
            app.Run();
        }
Пример #30
0
 public static void Main()
 {
     System.Windows.Application app = new System.Windows.Application();
     app.Run(new Window()
     {
         Title   = "Fixed TextBox",
         Content = new TextBox()
         {
             HorizontalAlignment = System.Windows.HorizontalAlignment.Center,
             VerticalAlignment   = System.Windows.VerticalAlignment.Center,
             Width  = 100.0,
             _Text_ = new Driver <string>(() => "Test")
         }
     });
 }
Пример #31
0
 public static void Main()
 {
     try
     {
         //Application.EnableVisualStyles();
         //Application.SetCompatibleTextRenderingDefault(false);
         AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
         Application app = new Application();
         LoadUsingGameConnectorsFromDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConnectorsDir));
         app.Run();
     }
     catch (Exception ex)
     {
         LogManager.GetCurrentClassLogger().Error(ex, "Application experienced an error");
     }
 }
Пример #32
0
        void for_debugging()
        {
#if false
            var shape       = data[features_stream_info].data.Shape;
            var numElements = shape.TotalSize;
            var buffer      = new float[numElements];
            var buffer_cpu  = new CNTK.NDArrayView(shape, buffer, CNTK.DeviceDescriptor.CPUDevice);
            buffer_cpu.CopyFrom(data[features_stream_info].data.Data);
            var firstImage = new float[3 * 150 * 150];
            System.Array.Copy(buffer, firstImage.Length, firstImage, 0, firstImage.Length);
            var wpfApp = new System.Windows.Application();
            wpfApp.Run(new PlotWindow(firstImage));
            var mel    = new float[40];
            var nd_cpu = new CNTK.NDArrayView(CNTK.NDShape.CreateNDShape(new int[] { 2, 1, (int)data[labels_stream_info].numberOfSamples }), mel, CNTK.DeviceDescriptor.CPUDevice);
            nd_cpu.CopyFrom(data[labels_stream_info].data.Data);
#endif
        }
        static void Main()
        {
            #if true
            // set TestGuiComponent.Program as "Startup object" in this project's Property window

            #if false
            // WPF: dynamically loaded window.
            System.Windows.Application app = new System.Windows.Application();
            app.Run(new DynamicallyLoadedWindow());
            #elif false
            // WPF
            System.Windows.Application app = new System.Windows.Application();
            app.Run(new MyWindow());
            #elif false
            // WPF
            System.Windows.Application app = new System.Windows.Application();
            System.Windows.Navigation.NavigationWindow window = new System.Windows.Navigation.NavigationWindow();
            MyPage page = new MyPage();
            window.Navigate(page);
            app.Run(window);
            #else
            // Windows Forms
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
            #endif

            #else
            // set TestGuiComponent.App as "Startup object" in this project's Property window

            // WPF
            //System.Windows.Application app = new TestGuiComponent.App();
            //app.InitializeComponent();
            //app.Run();
            #endif
        }
Пример #34
0
        static void Main(string[] args)
        {
            bool createdNew;
            using (new Mutex(true, "SevenUpdate.Admin", out createdNew))
            {
                if (createdNew)
                {
                    StartWcfHost();
                    SystemEvents.SessionEnding += PreventClose;
                    Search.SearchCompleted += SearchCompleted;
                    Search.ErrorOccurred += ErrorOccurred;
                    Download.DownloadCompleted += DownloadCompleted;
                    Download.DownloadProgressChanged += DownloadProgressChanged;
                    Utilities.ErrorOccurred += ErrorOccurred;
                    Install.InstallCompleted += InstallCompleted;
                    Install.InstallProgressChanged += InstallProgressChanged;
                    Install.UpdateInstalled += AddHistory;
                    if (!Directory.Exists(AllUserStore))
                    {
                        Directory.CreateDirectory(AllUserStore);
                    }
                }
            }

            var app = new Application();

            using (notifyIcon = new NotifyIcon())
            {
                notifyIcon.Icon = Resources.TrayIcon;
                notifyIcon.Text = Resources.CheckingForUpdates;
                notifyIcon.Visible = false;

                ProcessArgs(args);

                using (var timer = new Timer(3000))
                {
                    timer.Elapsed += CheckIfRunning;
                    timer.Start();
                    app.Run();
                }

                if (client != null)
                {
                    client.ElevatedProcessStopped();
                    client.Close();
                }

                try
                {
                    File.Delete(Path.Combine(Environment.ExpandEnvironmentVariables("%WINDIR%"), "Temp", "abort.lock"));
                }
                catch (IOException e)
                {
                    ErrorOccurred(
                        null, new ErrorOccurredEventArgs(Utilities.GetExceptionAsString(e), ErrorType.FatalError));
                }

                notifyIcon.Icon = null;
            }

            SystemEvents.SessionEnding -= PreventClose;
        }
Пример #35
0
 static void Main(string[] args)
 {
     var app = new System.Windows.Application();
     app.Run(new HandWritingCanvas());
 }
        private static void Askpass(string[] args)
        {
            if (args == null || args.Length == 0)
                throw new ArgumentException("Arguments cannot be empty.");

            Match match;
            if ((match = AskPasswordRegex.Match(args[0])).Success
                || (match = AskPassphraseRegex.Match(args[0])).Success)
            {
                Git.Trace.WriteLine("querying for passphrase key.");

                if (match.Groups.Count < 2)
                    throw new ArgumentException("Unable to understand command.");

                string request = match.Groups[0].Value;
                string resource = match.Groups[1].Value;

                Git.Trace.WriteLine($"open dialog for '{resource}'.");

                System.Windows.Application application = new System.Windows.Application();
                Gui.PassphraseWindow prompt = new Gui.PassphraseWindow(resource);
                application.Run(prompt);

                if (!prompt.Cancelled && !string.IsNullOrEmpty(prompt.Passphrase))
                {
                    string passphase = prompt.Passphrase;

                    Git.Trace.WriteLine("passphase acquired.");

                    Console.Out.Write(passphase + "\n");
                    return;
                }

                Git.Trace.WriteLine("failed to interactively acquire credentials.");
            }

            if ((match = AskCredentialRegex.Match(args[0])).Success)
            {
                Git.Trace.WriteLine("querying for HTTPS credentials.");

                if (match.Groups.Count < 3)
                    throw new ArgumentException("Unable to understand command.");

                string seeking = match.Groups[1].Value;
                string targetUrl = match.Groups[2].Value;

                Uri targetUri;

                if (Uri.TryCreate(targetUrl, UriKind.Absolute, out targetUri))
                {
                    Git.Trace.WriteLine($"success parsing URL, targetUri = '{targetUri}'.");

                    // config stored credentials come in the format of <username>[:<password>]@<url> with password being optional
                    // scheme terminator is actually "://" so we need adjust to get the correct index
                    int schemeTerminator = targetUrl.IndexOf(':') + 2;
                    int credentialTerminator = targetUrl.IndexOf('@', schemeTerminator + 1);

                    if (credentialTerminator > 0)
                    {
                        Git.Trace.WriteLine("'@' symbol found in URL, assuming credential prefix.");

                        string username = null;
                        string password = null;

                        int passwordTerminator = targetUrl.IndexOf(':', schemeTerminator + 1);

                        if (passwordTerminator > 0)
                        {
                            Git.Trace.WriteLine("':' symbol found in URL, assuming credential prefix contains password.");

                            username = targetUrl.Substring(schemeTerminator + 1, passwordTerminator - schemeTerminator - 1);
                            password = targetUrl.Substring(passwordTerminator + 1, credentialTerminator - passwordTerminator + 1);

                            // print the password if it sought
                            if (seeking.Equals("Password", StringComparison.OrdinalIgnoreCase))
                            {
                                Console.Out.Write(password + '\n');
                                return;
                            }
                        }
                        else
                        {
                            username = targetUrl.Substring(schemeTerminator + 1, credentialTerminator - schemeTerminator - 1);
                        }

                        // print the username if it sought
                        if (seeking.Equals("Username", StringComparison.OrdinalIgnoreCase))
                        {
                            Console.Out.Write(username + '\n');
                            return;
                        }
                    }

                    // create a target Url with the credential portion stripped, because Git doesn't report hosts with credentials
                    targetUrl = String.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}://{1}", targetUri.Scheme, targetUri.Host);

                    // retain the port if specified
                    if (!targetUri.IsDefaultPort)
                    {
                        targetUrl += $":{targetUri.Port}";
                    }

                    // retain the path if specified
                    if (!String.IsNullOrWhiteSpace(targetUri.LocalPath))
                    {
                        targetUrl += targetUri.LocalPath;
                    }

                    if (Uri.TryCreate(targetUrl, UriKind.Absolute, out targetUri))
                    {
                        Git.Trace.WriteLine($"success parsing URL, targetUri = '{targetUri}'.");

                        OperationArguments operationArguments = new OperationArguments(targetUri);

                        // load up the operation arguments, enable tracing, and query for credentials
                        LoadOperationArguments(operationArguments);
                        EnableTraceLogging(operationArguments);

                        if (QueryCredentials(operationArguments))
                        {
                            if (seeking.Equals("Username", StringComparison.OrdinalIgnoreCase))
                            {
                                Git.Trace.WriteLine($"username for '{targetUrl}' asked for and found.");

                                Console.Out.Write(operationArguments.CredUsername + '\n');
                                return;
                            }

                            if (seeking.Equals("Password", StringComparison.OrdinalIgnoreCase))
                            {
                                Git.Trace.WriteLine($"password for '{targetUrl}' asked for and found.");

                                Console.Out.Write(operationArguments.CredPassword + '\n');
                                return;
                            }
                        }
                    }
                    else
                    {
                        Git.Trace.WriteLine("error: unable to parse target URL.");
                    }
                }
                else
                {
                    Git.Trace.WriteLine("error: unable to parse supplied URL.");
                }

                Git.Trace.WriteLine($"failed to detect {seeking} in target URL.");
            }

            Git.Trace.WriteLine("failed to acquire credentials.");
        }