Example #1
0
        private void Logon_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                settings.Password = ((PasswordBox)((Button)sender).CommandParameter).Password;
                // PasswordBox doesn't allow 2 way binding, so we have to manually read it
                settings.Dirty = true;

                // keep sandbox state across updating the assembly info
                var isSandbox = IsSandbox;

                InitActions();

                IsSandbox = isSandbox;

                ShowBusy("Saving settings ...");
                Configuration.SaveConfigs(settingsArray);

                new Thread(() =>
                {
                    try
                    {
                        if (IsRegistered)
                        {
                            assemblyRegistration.UpdateAssembly(settings.Id, IsSandbox);
                        }
                        else
                        {
                            assemblyRegistration.CreateAssembly(IsSandbox);
                        }
                    }
                    catch (Exception ex)
                    {
                        var error = "[ERROR] " + ex.Message +
                                    (ex.InnerException != null ? "\n" + "[ERROR] " + ex.InnerException.Message : "");
                        UpdateStatus(error, false);
                        UpdateStatus(ex.StackTrace, false);
                        UpdateStatus("Unable to register assembly, see error above.", false);
                        PopException(ex);
                    }
                    finally
                    {
                        HideBusy();
                    }
                }).Start();
            }
            catch (Exception ex)
            {
                var error = "[ERROR] " + ex.Message +
                            (ex.InnerException != null ? "\n" + "[ERROR] " + ex.InnerException.Message : "");
                UpdateStatus(error, false);
                UpdateStatus(ex.StackTrace, false);
                UpdateStatus("Unable to register assembly, see error above.", false);
                PopException(ex);
            }
            finally
            {
                HideBusy();
            }
        }