Exemple #1
0
        public void Compile(CompileMethod method)
        {
            try
            {
                ThreadHelper.ThrowIfNotOnUIThread();

                _method = method;

                if (_compileThread == null || !_compileThread.IsAlive)
                {
                    if (_pane == null)
                    {
                        _pane = Shell.CreateOutputPane(_paneGuid, Constants.CompileOutputPaneTitle);
                    }
                    _pane.Clear();
                    _pane.Show();

                    StartCompile();
                }
                else
                {
                    if (_pane != null)
                    {
                        _pane.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLine(string.Concat("Exception when starting compile:\r\n", ex));
                Log.WriteEx(ex);
            }
        }
        private void ShowErrors(string path)
        {
            var errorMessages = errorLog.ToString();

            if (string.IsNullOrEmpty(errorMessages))
            {
                return;
            }
            Paragraph p = new Paragraph();

            p.Inlines.Add(errorMessages.Trim());
            if (!string.IsNullOrEmpty(path))
            {
                p.Inlines.Add("See ");
                var link = new Hyperlink()
                {
                    NavigateUri = new Uri("file://" + path)
                };
                link.Cursor = Cursors.Arrow;
                link.PreviewMouseLeftButtonDown += OnShowLogFile;
                link.Inlines.Add("Log File");
                p.Inlines.Add(link);
                p.Inlines.Add(" for details");
            }
            OutputPane output = (OutputPane)provider.GetService(typeof(OutputPane));

            output.AppendParagraph(p);
            output.Show();
            errorLog = new StringBuilder();
        }
Exemple #3
0
        private void ProcessResults()
        {
            try
            {
                processingResults = true;  // lock out Enqueue.

                // Now batch update the securities instead of dribbling them in one by one.
                this.myMoney.Securities.BeginUpdate(true);
                foreach (XElement e in newQuotes.Root.Elements())
                {
                    ProcessResult(e);
                }
                this.myMoney.Securities.EndUpdate();

                busy = false;

                if (status != null)
                {
                    status.ShowProgress("", 0, 0, 0);
                }
                quotesThread = null;
                if (newQuotes != null)
                {
                    string dir = ProcessHelper.StartupPath + "\\OfxLogs";
                    if (!Directory.Exists(dir))
                    {
                        Directory.CreateDirectory(dir);
                    }

                    string path = dir + "\\Stocks.xml";
                    newQuotes.Save(dir + "\\Stocks.xml");

                    if (hasError && !stop)
                    {
                        Paragraph p = new Paragraph();
                        p.Inlines.Add(errorLog.ToString());
                        p.Inlines.Add(new LineBreak());
                        p.Inlines.Add(new LineBreak());
                        p.Inlines.Add("See ");
                        var link = new Hyperlink()
                        {
                            NavigateUri = new Uri("file://" + path)
                        };
                        link.Cursor = Cursors.Arrow;
                        link.PreviewMouseLeftButtonDown += OnShowLogFile;
                        link.Inlines.Add("Log File");
                        p.Inlines.Add(link);
                        p.Inlines.Add(" for details");

                        OutputPane output = (OutputPane)provider.GetService(typeof(OutputPane));
                        output.AppendHeading(Walkabout.Properties.Resources.StockQuoteErrorCaption);
                        output.AppendParagraph(p);
                        output.Show();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBoxEx.Show(e.ToString(), Walkabout.Properties.Resources.StockQuotesException, MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                processingResults = false;
            }
        }