Esempio n. 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;
        }
Esempio n. 2
0
        private void updateResourceView()
        {
            if (currentProj == null)
            {
                return;
            }

            var projFilePath = projPath;

            projFilePath = projFilePath.Substring(0, projFilePath.LastIndexOf("\\") + 1);

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

            var resFolderPath = projFilePath + "res\\";

            if (!Directory.Exists(resFolderPath))
            {
                return;
            }
            var contentsFolderPath = resFolderPath + "contents";

            if (!Directory.Exists(contentsFolderPath))
            {
                return;
            }

            createDefaultPanel();
            // Add all folders to config and view
            DirectoryInfo di = new DirectoryInfo(contentsFolderPath);

            foreach (DirectoryInfo fi in di.GetDirectories())
            {
                populateConfigurationTab(fi.FullName.Substring(fi.FullName.IndexOf("res\\") + 4));
                populateViewTab(fi.FullName);
            }
            // Add all files to view
            FileInfo[] Files = di.GetFiles();
            foreach (FileInfo file in Files)
            {
                TreeViewItem item = createTreeItem(contentsFolderPath, file.Name, false);
                defaultExpanderTreeHeader.Items.Add(item);
            }
        }
        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());
        }