示例#1
0
        void ReleaseDesignerOutlets()
        {
            if (IpConfirm != null)
            {
                IpConfirm.Dispose();
                IpConfirm = null;
            }

            if (IPEntry != null)
            {
                IPEntry.Dispose();
                IPEntry = null;
            }

            if (StatusProgress != null)
            {
                StatusProgress.Dispose();
                StatusProgress = null;
            }

            if (StatusText != null)
            {
                StatusText.Dispose();
                StatusText = null;
            }
        }
        public ResourcesControl(IResourceMerge resourceMerge, Solution dte, ILogger outputWindowLogger, Action <string, string, DialogIcon> showDialogAction)
        {
            InitializeComponent();

            _excelGenerator   = new ExcelGenerator();
            _resourceMerge    = resourceMerge;
            _showDialogAction = showDialogAction;
            _logMessages      = new List <string>();
            ILogger combinedLogger = new CombinedLogger(outputWindowLogger, new DialogLogger(_logMessages));

            resourceMerge.SetLogger(combinedLogger);
            _statusProgress = new StatusProgress(
                p =>
            {
                Dispatcher.Invoke(() =>
                {
                    StatusProgress.Value    = p;
                    StatusProgressText.Text = (int)Math.Round(p) + "%";
                });
            },
                (s, p) =>
            {
                Dispatcher.Invoke(() =>
                {
                    StatusProgress.Value    = p;
                    StatusProgressText.Text = (int)Math.Round(p) + "%";
                    StatusText.Text         = s;
                });
            }
                );
            _cancellationTokenSource = new CancellationTokenSource();

            InitializeData(dte);
        }
示例#3
0
        public void ErrorsEncountered_ErrorOriginatesWithOneHandler_MultiProgressHasErrorsEncountered()
        {
            var multiProgress  = new MultiProgress();
            var statusProgress = new StatusProgress();

            multiProgress.Add(statusProgress);
            var consoleProgress = new ConsoleProgress();

            multiProgress.AddMessageProgress(consoleProgress);
            statusProgress.WriteError("some error happened!");
            Assert.That(multiProgress.ErrorEncountered, Is.True);
        }
示例#4
0
        internal static void Notify(StatusProgress onStatusProgress, int threadNumber, int threadID, int itemsProcessed)
        {
            //Add notification request
            InstanceNotifyUtilities.threadsRequestNotify.Enqueue(new NotifyDTO()
            {
                ThreadID         = threadID,
                ItemsProcessed   = itemsProcessed,
                ThreadNumber     = threadNumber,
                OnStatusProgress = onStatusProgress
            });

            InstanceNotifyUtilities.StartToNotify();
        }
示例#5
0
        public void ErrorsEncountered_ErrorOriginatesWithMultiProgress_BothHandlersHaveErrorsEncountered()
        {
            var multiProgress  = new MultiProgress();
            var statusProgress = new StatusProgress();

            multiProgress.Add(statusProgress);
            var consoleProgress = new ConsoleProgress();

            multiProgress.AddMessageProgress(consoleProgress);
            multiProgress.WriteError("error!");
            Assert.That(consoleProgress.ErrorEncountered, Is.True);
            Assert.That(statusProgress.ErrorEncountered, Is.True);
        }
示例#6
0
        public TroubleshootingView(HgRepository repository)
        {
            _state      = State.WaitingForUserToStart;
            _repository = repository;
            InitializeComponent();
            _progress         = new TextBoxProgress(_outputBox);
            _statusProgress   = new StatusProgress();
            _progress         = new MultiProgress(new IProgress[] { new TextBoxProgress(_outputBox), _statusProgress, new LabelStatus(_statusLabel) });
            _statusLabel.Text = string.Empty;

            _backgroundWorker = new BackgroundWorker();
            _backgroundWorker.WorkerSupportsCancellation = true;
            _backgroundWorker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(_backgroundWorker_RunWorkerCompleted);
            _backgroundWorker.DoWork += new DoWorkEventHandler(_backgroundWorker_DoWork);
        }
示例#7
0
        public InstallApkWindow(
            [NotNull] IInstallApkViewModel viewModel
            )
        {
            _viewModel = viewModel;

            InitializeComponent();
            DataContext = viewModel;

            ITaskBarManager taskBarManager = new TaskBarManager(TaskbarItemInfo = new TaskbarItemInfo());
            IVisualProgress visualProgress = StatusProgress.GetVisualProgress();

            viewModel.TaskBarManager.Value = taskBarManager;
            viewModel.VisualProgress.Value = visualProgress;

            visualProgress.SetLabelText(MainResources.AllDone);

            // property changes notification
            viewModel.LogText.PropertyChanged += (sender, args) => LogBox.Dispatcher.Invoke(() => LogBox.ScrollToEnd());
        }
        public MainWindow(
            [NotNull] IAppSettings appSettings,
            [NotNull] ApplicationUtils applicationUtils,
            [NotNull] IMainWindowViewModel viewModel,
            [NotNull] Provider <MainWindow> mainWindowProvider,
            [NotNull] Provider <InstallApkWindow> installApkWindowProvider,
            [NotNull] Provider <AboutWindow> aboutWindowProvider,
            [NotNull] Provider <AdbInstallWindow> adbInstallWindowProvider,
            [NotNull] NotificationManager notificationManager,
            [NotNull] TempUtils tempUtils,
            [NotNull] GlobalVariables globalVariables,
            [NotNull] Utils utils,
            [NotNull] Provider <IApktool> apktoolProvider
            )
        {
            _settings                 = appSettings;
            _applicationUtils         = applicationUtils;
            _mainWindowProvider       = mainWindowProvider;
            _installApkWindowProvider = installApkWindowProvider;
            _aboutWindowProvider      = aboutWindowProvider;
            _adbInstallWindowProvider = adbInstallWindowProvider;
            _notificationManager      = notificationManager;
            _tempUtils                = tempUtils;
            _globalVariables          = globalVariables;
            _utils           = utils;
            _apktoolProvider = apktoolProvider;

            ViewModel   = viewModel;
            DataContext = ViewModel;

            InitializeComponent();

            _taskBarManager = new TaskBarManager(TaskbarItemInfo = new TaskbarItemInfo());

            _visualProgress = StatusProgress.GetVisualProgress();

            _visualProgress.SetLabelText(MainResources.AllDone);
        }
示例#9
0
        /// <summary>
        /// Using YouTrackSharp here. We can't submit
        /// the report as if it were from this person, even if they have an account (well, not without
        /// asking them for credentials, which is just not gonna happen). So we submit with an
        /// account we created just for this purpose, "auto_report_creator".
        /// </summary>
        private bool SubmitToYouTrack()
        {
            try
            {
                ChangeState(State.Submitting);

                _youTrackConnection.Authenticate("auto_report_creator", "thisIsInOpenSourceCode");
                _issueManagement = new IssueManagement(_youTrackConnection);
                _youTrackIssue   = new Issue();
                _youTrackIssue.ProjectShortName = _youTrackProjectKey;
                _youTrackIssue.Type             = "Awaiting Classification";
                _youTrackIssue.Summary          = string.Format(Summary, _name.Text);
                _youTrackIssue.Description      = GetFullDescriptionContents(false);
                _youTrackIssueId = _issueManagement.CreateIssue(_youTrackIssue);

                // this could all be done in one go, but I'm doing it in stages so as to increase the
                // chance of success in bad internet situations
                if (_includeScreenshot.Checked)
                {
                    using (var file = TempFile.WithFilenameInTempFolder("screenshot.png"))
                    {
                        RobustImageIO.SaveImage(_screenshot, file.Path, ImageFormat.Png);
                        AddAttachment(file.Path);
                    }
                }

                if (Logger.Singleton != null)
                {
                    try
                    {
                        using (var logFile = GetLogFile())
                        {
                            AddAttachment(logFile.Path);
                        }
                    }
                    catch (Exception e)
                    {
                        _youTrackIssue.Description += System.Environment.NewLine + "***Got exception trying to attach log file: " + e.Message;
                        _issueManagement.UpdateIssue(_youTrackIssueId, _youTrackIssue.Summary, _youTrackIssue.Description);
                    }
                }


                if (_includeBook.Visible && _includeBook.Checked)                 // only Visible if Book is not null
                {
                    ChangeState(State.UploadingBook);
                    using (var bookZip = TempFile.WithFilenameInTempFolder(_youTrackIssueId + ".zip"))
                    {
                        var progress = new StatusProgress();
                        try
                        {
                            var zip = new BloomZipFile(bookZip.Path);
                            zip.AddDirectory(Book.FolderPath);
                            if (WantReaderInfo())
                            {
                                AddReaderInfo(zip);
                            }
                            AddCollectionSettings(zip);
                            zip.Save();
                        }
                        catch (Exception error)
                        {
                            _youTrackIssue.Description += System.Environment.NewLine + "***Error as ProblemReporterDialog attempted to zip up the book: " + error.Message;
                            _issueManagement.UpdateIssue(_youTrackIssueId, _youTrackIssue.Summary, _youTrackIssue.Description);
                            Logger.WriteEvent("*** Error as ProblemReporterDialog attempted to zip up the book. " + error.Message);
                            // if an error happens in the zipper, the zip file stays locked, so we just leak it
                            bookZip.Detach();
                            _shortErrorHtml += " Error Zipping Book ";
                            throw;
                        }

                        try
                        {
                            string url = ProblemBookUploader.UploadBook(BloomS3Client.ProblemBookUploadsBucketName, bookZip.Path,
                                                                        progress);
                            _youTrackIssue.Description += System.Environment.NewLine + url;
                            _issueManagement.UpdateIssue(_youTrackIssueId, _youTrackIssue.Summary, _youTrackIssue.Description);
                        }
                        catch (Exception error)
                        {
                            Logger.WriteError(progress.LastError, error);
                            _youTrackIssue.Description += System.Environment.NewLine + "***Got exception trying upload book: " + error.Message;
                            _issueManagement.UpdateIssue(_youTrackIssueId, _youTrackIssue.Summary, _youTrackIssue.Description);
                            _shortErrorHtml += " Uploading Book Failed ";
                        }
                    }
                }

                ChangeState(State.Success);
                return(true);
            }
            catch (Exception error)
            {
                Debug.Fail(error.Message);
                return(false);
            }
        }