Ejemplo n.º 1
0
        private void OnNewFile()
        {
            NewFile newFile = new NewFile();

            newFile.ShowDialog(this);
            if (newFile.Valid)
            {
                App.Controller.UserConfig.NewFilePath = newFile.GetFilename();
            }
        }
Ejemplo n.º 2
0
        private void addNewResourceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string fileLocation = App.Controller.UserConfig.ResourcePath;

            NewFile newFile = new NewFile();

            newFile.SetFileLocation(fileLocation);
            newFile.ShowDialog(this);
            if (newFile.Valid)
            {
                if (File.Exists(newFile.GetFilename()))
                {
                    App.Controller.View.ShowErrorMessage("Error", "'" + newFile.GetDisplayName() + "' already exists locally, choose another name.");
                    return;
                }

                App.Controller.UserConfig.NewFilePath = newFile.GetFilename();

                string relativePath = Helper.StringHelper.MakeRelativePath(App.Controller.UserConfig.NewFilePath);

                PhactoryHost.Database.Resource resource = new PhactoryHost.Database.Resource();
                resource.Id           = App.Controller.Entities.CreateNewResourceId();
                resource.DisplayName  = newFile.GetDisplayName();
                resource.RelativePath = relativePath;
                App.Controller.Entities.AddResource(resource);

                App.Controller.CreateNewResource(resource);

                Node childTreeNode = new Node();
                childTreeNode.IsFolder   = false;
                childTreeNode.ResourceId = resource.Id;

                Node treeNode = TreeViewSelectedNode.Tag as Node;
                treeNode.ChildNodes.Add(childTreeNode);

                App.Controller.SaveProject();

                TreeViewSelectedNode.Nodes.Clear();
                CreateTreeView(TreeViewSelectedNode, treeNode);

                treeView.BeginUpdate();
                treeView.Sort();
                treeView.EndUpdate();

                TreeNode createdNode = GetDocTreeNode(TreeViewSelectedNode, childTreeNode);
                treeView.SelectedNode = createdNode;
                TreeViewSelectedNode  = createdNode;
            }
        }
Ejemplo n.º 3
0
 private void OnNewFile()
 {
     NewFile newFile = new NewFile();
     newFile.ShowDialog(this);
     if (newFile.Valid)
     {
         App.Controller.UserConfig.NewFilePath = newFile.GetFilename();
     }
 }
Ejemplo n.º 4
0
        private void addNewResourceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string fileLocation = App.Controller.UserConfig.ResourcePath;

            NewFile newFile = new NewFile();
            newFile.SetFileLocation(fileLocation);
            newFile.ShowDialog(this);
            if (newFile.Valid)
            {
                if (File.Exists(newFile.GetFilename()))
                {
                    App.Controller.View.ShowErrorMessage("Error", "'" + newFile.GetDisplayName() + "' already exists locally, choose another name.");
                    return;
                }

                App.Controller.UserConfig.NewFilePath = newFile.GetFilename();

                string relativePath = Helper.StringHelper.MakeRelativePath(App.Controller.UserConfig.NewFilePath);

                PhactoryHost.Database.Resource resource = new PhactoryHost.Database.Resource();
                resource.Id = App.Controller.Entities.CreateNewResourceId();
                resource.DisplayName = newFile.GetDisplayName();
                resource.RelativePath = relativePath;
                App.Controller.Entities.AddResource(resource);

                App.Controller.CreateNewResource(resource);

                Node childTreeNode = new Node();
                childTreeNode.IsFolder = false;
                childTreeNode.ResourceId = resource.Id;

                Node treeNode = TreeViewSelectedNode.Tag as Node;
                treeNode.ChildNodes.Add(childTreeNode);

                App.Controller.SaveProject();

                TreeViewSelectedNode.Nodes.Clear();
                CreateTreeView(TreeViewSelectedNode, treeNode);

                treeView.BeginUpdate();
                treeView.Sort();
                treeView.EndUpdate();

                TreeNode createdNode = GetDocTreeNode(TreeViewSelectedNode, childTreeNode);
                treeView.SelectedNode = createdNode;
                TreeViewSelectedNode = createdNode;
            }
        }