Exemplo n.º 1
0
        private void buttonRecordOk_Click(object sender, EventArgs e)
        {
            Cursor origCursor = this.Cursor;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                this.MainWindow.HideErrorOrStatusMessage();

                TemplateDisplaySurface templateDisplaySurface = new TemplateDisplaySurface();

                Template template = this.tree.SelectedNode.Tag as Template;
                templateDisplaySurface.DisplayTemplateUI(false, null, this.Settings, template, OnExecute, OnCancel);

                splitContainer.Panel1Collapsed = false;
                splitContainer.Panel2Collapsed = true;
                isDirty = true;
            }
            catch (Exception ex)
            {
                this.MainWindow.ShowError(ex);
            }
            finally
            {
                EnableToolbarButtons(true);

                this.Cursor = origCursor;
            }
        }
Exemplo n.º 2
0
        private bool OnExecute(TemplateDisplaySurface surface)
        {
            try
            {
                if (surface.GatherUserInput())
                {
                    Hashtable ht = surface.CacheUserInput();

                    if (this.projectTree.SelectedNode != null && this.projectTree.SelectedNode.Tag != null)
                    {
                        ProjectNodeData tag = this.projectTree.SelectedNode.Tag as ProjectNodeData;
                        tag.Input = ht;
                    }
                    else
                    {
                        AddRecordedTemplate(surface, true);
                        isDirty = true;
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw;
                this.MainWindow.ShowError(ex);
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
        private void EditTemplatesMenuItem_Click(object sender, EventArgs e)
        {
            Cursor origCursor = this.Cursor;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                this.MainWindow.HideErrorOrStatusMessage();

                TemplateDisplaySurface templateDisplaySurface = new TemplateDisplaySurface();

                TreeNode node = this.projectTree.SelectedNode;

                ProjectNodeData data = node.Tag as ProjectNodeData;

                templateDisplaySurface.DisplayTemplateUI(true, data.Input, data.Settings as esSettings, data.Template, OnExecute, OnCancel);

                splitContainer.Panel1Collapsed = false;
                splitContainer.Panel2Collapsed = true;

                isDirty = true;
            }
            catch (Exception ex)
            {
                this.MainWindow.ShowError(ex);
            }
            finally
            {
                EnableToolbarButtons(true);

                this.Cursor = origCursor;
            }
        }
        private bool OnExecute(TemplateDisplaySurface surface)
        {
            try
            {
                if (surface.GatherUserInput())
                {
                    Template temp = new Template();
                    temp.Execute(surface.esMeta, surface.Template.Header.FullFileName);

                    surface.CacheUserInput();

                    this.MainWindow.ShowStatusMessage("Template '" + surface.Template.Header.Title + "' generated successfully.");
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                this.MainWindow.ShowError(ex);
                return(false);
            }

            return(true);
        }
        public override void OnSettingsChanged()
        {
            try
            {
                TemplateDisplaySurface.ClearCachedSettings();

                Template.SetTemplateCachePath(esSettings.TemplateCachePath);
                Template.SetCompilerAssemblyPath(Settings.CompilerAssemblyPath);

                tree.LoadTemplates(templateMenu, subTemplateMenu, Settings);
            }
            catch { }
        }
Exemplo n.º 6
0
        public void AddRecordedTemplate(TemplateDisplaySurface surface, bool beginEdit)
        {
            try
            {
                TreeNode node = this.projectTree.SelectedNode;

                if (node == null)
                {
                    node = this.projectTree.Nodes[0];
                }

                if (node != null)
                {
                    TreeNode recordedTemplate = new TreeNode(surface.Template.Header.Title);
                    recordedTemplate.ImageIndex         = 2;
                    recordedTemplate.SelectedImageIndex = 2;
                    recordedTemplate.ContextMenuStrip   = menuTemplate;
                    node.Nodes.Add(recordedTemplate);

                    ProjectNodeData tag = new ProjectNodeData();
                    tag.Template         = surface.Template;
                    tag.Input            = surface.CacheUserInput();
                    tag.Settings         = Settings.Clone();
                    recordedTemplate.Tag = tag;

                    node.Expand();
                    isDirty = true;

                    this.projectTree.SelectedNode = recordedTemplate;

                    if (beginEdit)
                    {
                        recordedTemplate.BeginEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                this.MainWindow.ShowError(ex);
            }
        }
Exemplo n.º 7
0
 private void OnCancel(TemplateDisplaySurface surface)
 {
 }
        private void buttonExecuteTemplateCancel_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.OnTemplateExecuteCallback == null) return;

                this.OnTemplateCancelCallback(this.CurrentTemplateDisplaySurface);

                this.HideErrorOrStatusMessage();

                this.tabControlTemplateUI.TabPages.Clear();

                this.splitContainerTabControl.Panel1Collapsed = false;
                this.splitContainerTabControl.Panel2Collapsed = true;
            }
            catch (Exception ex)
            {
                this.ShowError(ex);
            }
            finally
            {
                OnTemplateExecuteCallback = null;
                OnTemplateCancelCallback = null;
                CurrentTemplateDisplaySurface = null;
            }
        }
        private void OnCancel(TemplateDisplaySurface surface)
        {

        }
        private bool OnExecute(TemplateDisplaySurface surface)
        {
            try
            {
                if (surface.GatherUserInput())
                {
                    Template temp = new Template();
                    temp.Execute(surface.esMeta, surface.Template.Header.FullFileName);

                    surface.CacheUserInput();

                    this.MainWindow.ShowStatusMessage("Template '" + surface.Template.Header.Title + "' generated successfully.");
                }
                else return false;
            }
            catch (Exception ex)
            {
                this.MainWindow.ShowError(ex);
                return false;
            }

            return true;
        }
        public void AddRecordedTemplate(TemplateDisplaySurface surface, bool beginEdit)
        {
            try
            {
                TreeNode node = this.projectTree.SelectedNode;

                if (node == null)
                {
                    node = this.projectTree.Nodes[0];
                }

                if (node != null)
                {
                    TreeNode recordedTemplate = new TreeNode(surface.Template.Header.Title);
                    recordedTemplate.ImageIndex = 2;
                    recordedTemplate.SelectedImageIndex = 2;
                    recordedTemplate.ContextMenuStrip = menuTemplate;
                    node.Nodes.Add(recordedTemplate);

                    ProjectNodeData tag = new ProjectNodeData();
                    tag.Template = surface.Template;
                    tag.Input = surface.CacheUserInput();
                    tag.Settings = Settings.Clone();
                    recordedTemplate.Tag = tag;
        
                    node.Expand();
                    isDirty = true;

                    this.projectTree.SelectedNode = recordedTemplate;

                    if (beginEdit)
                    {
                        recordedTemplate.BeginEdit();
                    }
                }
            }
            catch (Exception ex)
            {
                this.MainWindow.ShowError(ex);
            }
        }
        private bool OnExecute(TemplateDisplaySurface surface)
        {
            try
            {
                if (surface.GatherUserInput())
                {
                    Hashtable ht = surface.CacheUserInput();

                    if (this.projectTree.SelectedNode != null && this.projectTree.SelectedNode.Tag != null)
                    {
                        ProjectNodeData tag = this.projectTree.SelectedNode.Tag as ProjectNodeData;
                        tag.Input = ht;
                    }
                    else
                    {
                        AddRecordedTemplate(surface, true);
                        isDirty = true;
                    }
                }
                else return false;
            }
            catch (Exception ex)
            {
                throw;
                this.MainWindow.ShowError(ex);
                return false;
            }

            return true;
        }
        private void EditTemplatesMenuItem_Click(object sender, EventArgs e)
        {
            Cursor origCursor = this.Cursor;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                this.MainWindow.HideErrorOrStatusMessage();

                TemplateDisplaySurface templateDisplaySurface = new TemplateDisplaySurface();

                TreeNode node = this.projectTree.SelectedNode;

                ProjectNodeData data = node.Tag as ProjectNodeData;

                templateDisplaySurface.DisplayTemplateUI(true, data.Input, data.Settings as esSettings, data.Template, OnExecute, OnCancel);

                splitContainer.Panel1Collapsed = false;
                splitContainer.Panel2Collapsed = true;

                isDirty = true;
            }
            catch (Exception ex)
            {
                this.MainWindow.ShowError(ex);
            }
            finally
            {
                EnableToolbarButtons(true);

                this.Cursor = origCursor;
            }
        }
        private void buttonRecordOk_Click(object sender, EventArgs e)
        {
            Cursor origCursor = this.Cursor;

            try
            {
                this.Cursor = Cursors.WaitCursor;

                this.MainWindow.HideErrorOrStatusMessage();

                TemplateDisplaySurface templateDisplaySurface = new TemplateDisplaySurface();

                Template template = this.tree.SelectedNode.Tag as Template;
                templateDisplaySurface.DisplayTemplateUI(false, null, this.Settings, template, OnExecute, OnCancel);

                splitContainer.Panel1Collapsed = false;
                splitContainer.Panel2Collapsed = true;
                isDirty = true;
            }
            catch (Exception ex)
            {
                this.MainWindow.ShowError(ex);
            }
            finally
            {
                EnableToolbarButtons(true);

                this.Cursor = origCursor;
            }
        }