private void AddCommunicationView(CommunicationEntry ce) { FileNameLabel.Text = ""; if (ce.Tag != null) { if (ce.Tag is Task) { if (splitContainer1.Panel2.Controls.Contains(taskViewUC)) { taskViewUC.Release(); splitContainer1.Panel2.Controls.Remove(taskViewUC); } htmlEditorPanel.Visible = false; NoPreviewPanel.Visible = false; taskViewUC = new TaskViewUC(); taskViewUC.Task = (Task)ce.Tag; taskViewUC.Dock = DockStyle.Fill; splitContainer1.Panel2.Controls.Add(taskViewUC); } else if (ce.Tag is string) { //splitContainer1.Panel2.Controls.Clear(); //htmlEditorPanel.Visible = true; splitContainer1.Panel2.Controls.Add(htmlEditorPanel); string name = (string)ce.Tag; if (string.IsNullOrEmpty(name) == false) { switch (Path.GetExtension(name).ToLower()) { case ".html": case ".htm": htmlEditorPanel.Visible = true; FileNameLabel.Text = Path.GetFileName(name); string s = File.ReadAllText(name); winFormHtmlEditor1.DocumentHtml = s; winFormHtmlEditor1.Tag = name; break; case ".doc": case ".docx": NoPreviewPanel.Visible = true; htmlEditorPanel.Visible = false; //OpenWithWord(name); break; case ".pdf": NoPreviewPanel.Visible = true; htmlEditorPanel.Visible = false; //OpenPDF(name); break; default: break; } } } } }
private void AddTab(Task task) { TaskViewUC tabContent = new TaskViewUC(); tabContent.Task = task; tabContent.Enabled = false; TabPage tabPage = new TabPage(); tabPage.Text = task.ToString(); tabPage.Tag = task.taskID; tabPage.Controls.Add(tabContent); Control c = (Control)tabContent; c.Dock = DockStyle.Fill; this.tabControl.Controls.Add(tabPage); }
private void AddCommunicationView(CommunicationEntry ce) { FileNameLabel.Text = ""; if (ce.Tag != null) { if (ce.Tag is Task) { if (splitContainer1.Panel2.Controls.Contains(taskViewUC)) { taskViewUC.Release(); splitContainer1.Panel2.Controls.Remove(taskViewUC); } htmlEditorPanel.Visible = false; NoPreviewPanel.Visible = false; taskViewUC = new TaskViewUC(); taskViewUC.Task = (Task)ce.Tag; taskViewUC.Dock = DockStyle.Fill; splitContainer1.Panel2.Controls.Add(taskViewUC); } else if (ce.Tag is string) { //splitContainer1.Panel2.Controls.Clear(); //htmlEditorPanel.Visible = true; splitContainer1.Panel2.Controls.Add(htmlEditorPanel); string name = (string) ce.Tag; if (string.IsNullOrEmpty(name) == false) { switch (Path.GetExtension(name).ToLower()) { case ".html": case ".htm": htmlEditorPanel.Visible = true; FileNameLabel.Text = Path.GetFileName(name); string s = File.ReadAllText(name); winFormHtmlEditor1.DocumentHtml = s; winFormHtmlEditor1.Tag = name; break; case ".doc": case ".docx": NoPreviewPanel.Visible = true; htmlEditorPanel.Visible = false; //OpenWithWord(name); break; case ".pdf": NoPreviewPanel.Visible = true; htmlEditorPanel.Visible = false; //OpenPDF(name); break; default: break; } } } } }