Пример #1
0
        private void CreateDiagramFunction(object o)
        {
            string[] arguments        = o as string[];
            string   vhdFile          = arguments[0];
            string   EntityName       = arguments[1];
            string   ArchitectureName = arguments[2];
            string   vcdFile          = arguments[3];

            PrepareCompilator();
            compiler.Messages.Clear();
            bool res = compiler.CreateDiagram(vhdFile, EntityName, ArchitectureName, vcdFile);

            project.UpdateSimulationFolderContent();
            bool isContainsFile = false;

            foreach (Schematix.ProjectExplorer.Waveform_File w in project.GetProjectElements <Schematix.ProjectExplorer.Waveform_File>())
            {
                if (w.Path == vcdFile)
                {
                    isContainsFile = true;
                    break;
                }
            }
            if (isContainsFile == false)
            {
                Schematix.ProjectExplorer.ProjectElementBase vhdl   = core.SearchItemInSolution(vhdFile);
                Schematix.ProjectExplorer.ProjectFolder      folder = vhdl.Parent as Schematix.ProjectExplorer.ProjectFolder;
                Schematix.ProjectExplorer.ProjectElement     vcd    = Schematix.ProjectExplorer.ProjectElement.CreateProjectElementByPath(vcdFile, folder);
                folder.AddElement(vcd);
            }
            if (System.IO.File.Exists(vcdFile) == true)
            {
                core.SaveSolution();
                core.UpdateExplorerPanel();
                Schematix.Windows.Waveform.Waveform waveformWindow = core.OpenNewWindow(vcdFile, true) as Schematix.Windows.Waveform.Waveform;
                waveformWindow.SetParameters(vhdFile, EntityName, ArchitectureName);
                waveformWindow.Save();
            }
        }
Пример #2
0
        /// <summary>
        /// Функция для создания контекстного меню
        /// </summary>
        /// <param name="sol"></param>
        /// <returns></returns>
        protected static ContextMenu CreateContextMenu(ProjectFolder elem, ProjectExplorerControl control)
        {
            ContextMenu res = new ContextMenu();

            MenuItem itemNew = new MenuItem();

            itemNew.Header = "New";
            res.Items.Add(itemNew);

            MenuItem itemNewItem = new MenuItem();

            itemNewItem.Header = "New Item";
            itemNewItem.Click += new System.Windows.RoutedEventHandler(elem.itemNewItem_Click);
            itemNew.Items.Add(itemNewItem);

            MenuItem itemNewFolder = new MenuItem();

            itemNewFolder.Header = "New Folder";
            itemNewFolder.Click += new System.Windows.RoutedEventHandler(elem.itemNewFolder_Click);
            itemNew.Items.Add(itemNewFolder);

            MenuItem itemAddExistingFile = new MenuItem();

            itemAddExistingFile.Header = "Add Existing Files";
            itemAddExistingFile.Click += new System.Windows.RoutedEventHandler(elem.itemAddExistingFile_Click);
            res.Items.Add(itemAddExistingFile);

            MenuItem itemAddExistingFolder = new MenuItem();

            itemAddExistingFolder.Header = "Add Existing Folder";
            itemAddExistingFolder.Click += new System.Windows.RoutedEventHandler(elem.itemAddExistingFolder_Click);
            res.Items.Add(itemAddExistingFolder);

            MenuItem itemRename = new MenuItem();

            itemRename.Header = "Rename";
            itemRename.Click += new System.Windows.RoutedEventHandler(elem.itemRename_Click);
            res.Items.Add(itemRename);

            MenuItem itemRemove = new MenuItem();

            itemRemove.Header  = "Remove";
            itemRemove.Command = control.CommandRemove;
            itemRemove.CommandBindings.Add(control.BindingRemoveCommand);
            res.Items.Add(itemRemove);



            MenuItem itemPaste = new MenuItem();

            itemPaste.Header  = "Paste";
            itemPaste.Icon    = CreateImageByPath("/HDL_Light;component/Images/Paste.png");
            itemPaste.Command = control.CommandPaste;
            itemPaste.CommandBindings.Add(control.BindingPasteCommand);
            res.Items.Add(itemPaste);


            MenuItem itemСut = new MenuItem();

            itemСut.Header  = "Cut";
            itemСut.Icon    = CreateImageByPath("/HDL_Light;component/Images/Cut.png");
            itemСut.Command = control.CommandCut;
            itemСut.CommandBindings.Add(control.BindingCutCommand);
            res.Items.Add(itemСut);


            MenuItem itemCopy = new MenuItem();

            itemCopy.Header  = "Copy";
            itemCopy.Icon    = CreateImageByPath("/HDL_Light;component/Images/Copy.png");;
            itemCopy.Command = control.CommandCopy;
            itemCopy.CommandBindings.Add(control.BindingCopyCommand);
            res.Items.Add(itemCopy);

            MenuItem itemOpenFolderInExplorer = new MenuItem();

            itemOpenFolderInExplorer.Header = "Open Folder In Explorer";
            itemOpenFolderInExplorer.Click += new System.Windows.RoutedEventHandler(elem.itemOpenFolderInExplorer_Click);
            res.Items.Add(itemOpenFolderInExplorer);

            return(res);
        }