Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceManagerControl"/> class.
        /// </summary>
        public ResourceManagerControl()
        {
            this.InitializeComponent();
            InitializeDropDown();

            currentProj = ResourceManagerUtil.getCurrentProject();
            if (currentProj == null)
            {
                return;
            }
            projPath = currentProj.FullName;
            string projFilePath = projPath.Substring(0, projPath.LastIndexOf("\\") + 1);

            //Check if this is a Tizen project.
            if (!ResourceManagerUtil.isTizenProject(projFilePath))
            {
                return;
            }

            var resFolderPath = projFilePath + "res\\";

            ContentsWatcher watcher = new ContentsWatcher(this, currentProj);

            watcher.watch(projFilePath);

            viewContextMenu = new ResourceManagerContextMenu(currentProj);
            ctxMenu         = viewContextMenu.createContextMenu();
            updateResourceView();
            viewComboLang.ItemsSource           = viewLangComboList;
            resolutionComboView.ItemsSource     = viewDpiComboList;
            viewComboLang.DropDownOpened       += fetchViewLangComboData;
            resolutionComboView.DropDownOpened += fetchViewDpiComboData;
            btnAdd.IsEnabled = false;
        }
        public void launch(Package package)
        {
            int     winID;
            Project proj = ResourceManagerUtil.getCurrentProject();

            if (proj == null)
            {
                return;
            }
            string projPath   = proj.FullName;
            string projFolder = projPath.Substring(0, projPath.LastIndexOf("\\") + 1);

            //Check if this is a Tizen project.
            if (!ResourceManagerUtil.isTizenProject(projFolder))
            {
                return;
            }

            if (projectIdMap.ContainsKey(projPath))
            {
                projectIdMap.TryGetValue(projPath, out winID);
            }
            else
            {
                winID = id++;
                projectIdMap[projPath] = winID;
            }
            // Create a new instance of Resource Manager when tool is invoked on project.
            ToolWindowPane window = package.FindToolWindow(typeof(ResourceManager), winID, true);

            if ((null == window))
            {
                return;
                //throw new NotSupportedException("Failed to open Resource Manager. Cannot create tool window");
            }

            IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
        }