Inheritance: System.Windows.Forms.Form
Ejemplo n.º 1
0
            public bool OnAccept(CloneObjectParameters parameters)
            {
                // Do the cloning
                string originalName         = mFileData.GetNameForCloning();
                string potentialNewNodeName = parameters.TransformParameter(originalName);

                if (potentialNewNodeName.Length <= 1)
                {
                    MessageBox.Show("You must enter a name longer than 1 character for the clone!");
                    return(false);
                }

                if (potentialNewNodeName.Equals(originalName))
                {
                    MessageBox.Show("You must enter a new unique name for the clone!");
                    return(false);
                }

                HashSet <string> dependencies       = ModuleDataManager.GetInstance().PreviewCloneDependencies(mFileData, parameters);
                HashSet <string> savedUnwantedItems = mPreviewCallback != null?mPreviewCallback.GetSavedUnwantedItems() : null;

                mPreviewCallback = new PreviewCloneFileCallback(mViewer, mFileData, parameters);
                mPreviewCallback.SetUnwantedItems(savedUnwantedItems);
                PreviewCloneDialog dialog = new PreviewCloneDialog("Creating " + potentialNewNodeName, dependencies, mPreviewCallback);
                DialogResult       result = dialog.ShowDialog();

                if (result != DialogResult.OK)
                {
                    return(false);
                }

                return(true);
            }
Ejemplo n.º 2
0
        private void makeFineVersionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode     = treeView.SelectedNode;
            FileData selectedFileData = ModuleDataManager.GetInstance().GetSelectedFileData(treeView.SelectedNode);

            if (!CanAddFineVersion(selectedFileData))
            {
                return;
            }

            JsonFileData          jsonFileData = selectedFileData as JsonFileData;
            ModuleFile            moduleFile   = jsonFileData.GetModuleFile();
            CloneObjectParameters parameters   = new CloneObjectParameters();

            parameters.AddStringReplacement(moduleFile.ShortName, moduleFile.ShortName + "_fine");
            parameters.AddAliasReplacement(moduleFile.ShortName + "_fine", moduleFile.ShortName + ":fine");
            HashSet <string>          dependencies = ModuleDataManager.GetInstance().PreviewCloneDependencies(selectedFileData, parameters);
            PreviewCloneAliasCallback callback     = new PreviewCloneAliasCallback(this, selectedFileData, parameters);
            PreviewCloneDialog        dialog       = new PreviewCloneDialog("Creating " + moduleFile.ShortName + ":fine", dependencies, callback);

            dialog.ShowDialog();
        }
            public bool OnAccept(CloneObjectParameters parameters)
            {
                // Do the cloning
                string originalName = mFileData.GetNameForCloning();
                string potentialNewNodeName = parameters.TransformParameter(originalName);
                if (potentialNewNodeName.Length <= 1)
                {
                    MessageBox.Show("You must enter a name longer than 1 character for the clone!");
                    return false;
                }

                if (potentialNewNodeName.Equals(originalName))
                {
                    MessageBox.Show("You must enter a new unique name for the clone!");
                    return false;
                }

                HashSet<string> dependencies = ModuleDataManager.GetInstance().PreviewCloneDependencies(mFileData, parameters);
                HashSet<string> savedUnwantedItems = mPreviewCallback != null ? mPreviewCallback.GetSavedUnwantedItems() : null;
                mPreviewCallback = new PreviewCloneFileCallback(mViewer, mFileData, parameters);
                mPreviewCallback.SetUnwantedItems(savedUnwantedItems);
                PreviewCloneDialog dialog = new PreviewCloneDialog("Creating " + potentialNewNodeName, dependencies, mPreviewCallback);
                DialogResult result = dialog.ShowDialog();
                if (result != DialogResult.OK)
                {
                    return false;
                }

                return true;
            }
Ejemplo n.º 4
0
        private void makeFineVersionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeView.SelectedNode;
            FileData selectedFileData = ModuleDataManager.GetInstance().GetSelectedFileData(treeView.SelectedNode);
            if (!CanAddFineVersion(selectedFileData))
            {
                return;
            }

            JsonFileData jsonFileData = selectedFileData as JsonFileData;
            ModuleFile moduleFile = jsonFileData.GetModuleFile();
            CloneObjectParameters parameters = new CloneObjectParameters();
            parameters.AddStringReplacement(moduleFile.ShortName, moduleFile.ShortName + "_fine");
            parameters.AddAliasReplacement(moduleFile.ShortName + "_fine", moduleFile.ShortName + ":fine");
            HashSet<string> dependencies = ModuleDataManager.GetInstance().PreviewCloneDependencies(selectedFileData, parameters);
            PreviewCloneAliasCallback callback = new PreviewCloneAliasCallback(this, selectedFileData, parameters);
            PreviewCloneDialog dialog = new PreviewCloneDialog("Creating " + moduleFile.ShortName + ":fine", dependencies, callback);
            dialog.ShowDialog();
        }