Esempio n. 1
0
        private void CreateErrorPanel(int ReplaceTabIdx, UserSelectedProjectSettings Project, string Message)
        {
            Log.WriteLine(Message);

            ErrorPanel ErrorPanel = new ErrorPanel(Project);

            ErrorPanel.Parent      = TabPanel;
            ErrorPanel.BorderStyle = BorderStyle.FixedSingle;
            ErrorPanel.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(250)))), ((int)(((byte)(250)))), ((int)(((byte)(250)))));
            ErrorPanel.Location    = new Point(0, 0);
            ErrorPanel.Size        = new Size(TabPanel.Width, TabPanel.Height);
            ErrorPanel.Anchor      = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;
            ErrorPanel.Hide();

            string SummaryText = String.Format("Unable to open '{0}'.", Project.ToString());

            int NewContentWidth = Math.Max(Math.Max(TextRenderer.MeasureText(SummaryText, ErrorPanel.Font).Width, TextRenderer.MeasureText(Message, ErrorPanel.Font).Width), 400);

            ErrorPanel.SetContentWidth(NewContentWidth);

            List <StatusLine> Lines = new List <StatusLine>();

            StatusLine SummaryLine = new StatusLine();

            SummaryLine.AddText(SummaryText);
            Lines.Add(SummaryLine);

            Lines.Add(new StatusLine()
            {
                LineHeight = 0.5f
            });

            StatusLine ErrorLine = new StatusLine();

            ErrorLine.AddText(Message);
            Lines.Add(ErrorLine);

            Lines.Add(new StatusLine()
            {
                LineHeight = 0.5f
            });

            StatusLine ActionLine = new StatusLine();

            ActionLine.AddLink("Open...", FontStyle.Bold | FontStyle.Underline, () => { BeginInvoke(new MethodInvoker(() => { EditSelectedProject(ErrorPanel); })); });
            ActionLine.AddText(" | ");
            ActionLine.AddLink("Retry", FontStyle.Bold | FontStyle.Underline, () => { BeginInvoke(new MethodInvoker(() => { TryOpenProject(Project, TabControl.FindTabIndex(ErrorPanel)); })); });
            ActionLine.AddText(" | ");
            ActionLine.AddLink("Close", FontStyle.Bold | FontStyle.Underline, () => { BeginInvoke(new MethodInvoker(() => { TabControl.RemoveTab(TabControl.FindTabIndex(ErrorPanel)); })); });
            Lines.Add(ActionLine);

            ErrorPanel.Set(Lines, null, null, null);

            string NewProjectName = "Unknown";

            if (Project.Type == UserSelectedProjectType.Client && Project.ClientPath != null)
            {
                NewProjectName = Project.ClientPath.Substring(Project.ClientPath.LastIndexOf('/') + 1);
            }
            if (Project.Type == UserSelectedProjectType.Local && Project.LocalPath != null)
            {
                NewProjectName = Project.LocalPath.Substring(Project.LocalPath.LastIndexOfAny(new char[] { '/', '\\' }) + 1);
            }

            string NewTabName = String.Format("Error: {0}", NewProjectName);

            if (ReplaceTabIdx == -1)
            {
                int TabIdx = TabControl.InsertTab(-1, NewTabName, ErrorPanel);
                TabControl.SelectTab(TabIdx);
            }
            else
            {
                TabControl.InsertTab(ReplaceTabIdx + 1, NewTabName, ErrorPanel);
                TabControl.RemoveTab(ReplaceTabIdx);
                TabControl.SelectTab(ReplaceTabIdx);
            }

            UpdateProgress();
        }
Esempio n. 2
0
 void PostAutomationRequest(AutomationRequest Request)
 {
     try
     {
         if (!CanFocus)
         {
             Request.SetOutput(new AutomationRequestOutput(AutomationRequestResult.Busy));
         }
         else if (Request.Input.Type == AutomationRequestType.SyncProject)
         {
             AutomationRequestOutput Output = StartAutomatedSync(Request, true);
             if (Output != null)
             {
                 Request.SetOutput(Output);
             }
         }
         else if (Request.Input.Type == AutomationRequestType.FindProject)
         {
             AutomationRequestOutput Output = FindProject(Request);
             Request.SetOutput(Output);
         }
         else if (Request.Input.Type == AutomationRequestType.OpenProject)
         {
             AutomationRequestOutput Output = StartAutomatedSync(Request, false);
             if (Output != null)
             {
                 Request.SetOutput(Output);
             }
         }
         else
         {
             Request.SetOutput(new AutomationRequestOutput(AutomationRequestResult.Invalid));
         }
     }
     catch (Exception Ex)
     {
         Log.WriteLine("Exception running automation request: {0}", Ex);
         Request.SetOutput(new AutomationRequestOutput(AutomationRequestResult.Invalid));
     }
 }
Esempio n. 3
0
 protected override void FlushLine(string Line)
 {
     Inner.WriteLine("[{0}] {1}", DateTime.Now, Line);
 }