Exemple #1
0
        public void AddIcon(FileInfo icon)
        {
            _qnxSchema.icon.AddIconImage(icon.Name);
            DesignerDirty = true;
            IList source = (IList)_iconImageList.SourceCollection;
              ImageItemClass image = new ImageItemClass(icon.Name, icon.ToString(), _activeProjectDirectory);
            source.Add(image);
            _iconImageList = new CollectionView(source);

            if (ViewModelChanged != null)
            {
                // Update the Designer View
                ViewModelChanged(this, new EventArgs());
            }
        }
Exemple #2
0
        public void AddSplashScreen(FileInfo splashScreen)
        {
            qnxSplashScreens qnxSS;

            if (_qnxSchema.splashScreens == null)
            {
                qnxSS = new qnxSplashScreens();
                _qnxSchema.splashScreens = qnxSS;
            }
            else
            {
                qnxSS = _qnxSchema.splashScreens;
            }

            qnxSS.AddSplashScreenImage(splashScreen.Name);
            DesignerDirty = true;
            IList source = (IList)_splashScreenImageList.SourceCollection;
            ImageItemClass image = new ImageItemClass(splashScreen.Name, splashScreen.ToString(), _activeProjectDirectory);
            source.Add(image);
            _splashScreenImageList = new CollectionView(source);

            if (ViewModelChanged != null)
            {
                // Update the Designer View
                ViewModelChanged(this, new EventArgs());
            }
        }
Exemple #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="xmlStore"></param>
        /// <param name="xmlModel"></param>
        /// <param name="provider"></param>
        /// <param name="buffer"></param>
        public ViewModel(Package pkg, XmlStore xmlStore, XmlModel xmlModel, IServiceProvider provider, IVsTextLines buffer)
        {
            _pkg = pkg;
            /// Initialize Asset Type List
            IList<AssetTypeItemClass> AssetTypeListItem = new List<AssetTypeItemClass>();
            AssetTypeItemClass assetType = new AssetTypeItemClass("Other");
            AssetTypeListItem.Add(assetType);
            assetType = new AssetTypeItemClass("Entry-point");
            AssetTypeListItem.Add(assetType);
            assetType = new AssetTypeItemClass("Library");
            AssetTypeListItem.Add(assetType);
            assetType = new AssetTypeItemClass("Executable");
            AssetTypeListItem.Add(assetType);
            _assetTypeList = new CollectionView(AssetTypeListItem);

            if (xmlModel == null)
                throw new ArgumentNullException("xmlModel");
            if (xmlStore == null)
                throw new ArgumentNullException("xmlStore");
            if (provider == null)
                throw new ArgumentNullException("provider");
            if (buffer == null)
                throw new ArgumentNullException("buffer");

            this.BufferDirty = false;
            this.DesignerDirty = false;

            this._serviceProvider = provider;
            this._buffer = buffer;

            _dte = (DTE)_serviceProvider.GetService(typeof(DTE));
            Array activeProjects = (Array)_dte.ActiveSolutionProjects;
            Project activeProject = (Project)activeProjects.GetValue(0);
            FileInfo activeProjectFileInfo = new FileInfo(activeProject.FullName);
            _activeProjectDirectory = activeProjectFileInfo.DirectoryName;

            this._xmlStore = xmlStore;
            // OnUnderlyingEditCompleted
            _editingScopeCompletedHandler = new EventHandler<XmlEditingScopeEventArgs>(OnUnderlyingEditCompleted);
            this._xmlStore.EditingScopeCompleted += _editingScopeCompletedHandler;
            // OnUndoRedoCompleted
            _undoRedoCompletedHandler = new EventHandler<XmlEditingScopeEventArgs>(OnUndoRedoCompleted);
            this._xmlStore.UndoRedoCompleted += _undoRedoCompletedHandler;

            this._xmlModel = xmlModel;
            // BufferReloaded
            _bufferReloadedHandler += new EventHandler(BufferReloaded);
            this._xmlModel.BufferReloaded += _bufferReloadedHandler;

            _localRIMFolder = System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Research In Motion\";

            LoadModelFromXmlModel();

            IList<ImageItemClass> IconImageList = new List<ImageItemClass>();
            if ((_qnxSchema.icon != null) && (_qnxSchema.icon.image != null))
            {
                string iconPNG_Path = "";  //added to avoid duplication. That's because I didn't find the template to remove teh ICON.PNG.
                foreach (string iconImage in _qnxSchema.icon.image)
                {
                    ImageItemClass imageItem = new ImageItemClass(iconImage, getImagePath(iconImage), _activeProjectDirectory);
                    if (imageItem.ImageName != null) //added because I didn't find the template to remove teh ICON.PNG.
                        if (imageItem.ImageName == "icon.png")
                        {
                            if (iconPNG_Path != imageItem.ImagePath) //added because I didn't find the template to remove teh ICON.PNG.
                            {
                                IconImageList.Add(imageItem);
                                iconPNG_Path = imageItem.ImagePath;
                            }
                        }
                        else
                            IconImageList.Add(imageItem);

                }
            }
            _iconImageList = new CollectionView(IconImageList);

            LoadPermissions();

            IList<ImageItemClass> SplashScreenImageList = new List<ImageItemClass>();
            if ((_qnxSchema.splashScreens != null) && (_qnxSchema.splashScreens.image != null))
            {
                foreach (string splashScreenImage in _qnxSchema.splashScreens.image)
                {
                    ImageItemClass imageItem = new ImageItemClass(splashScreenImage, getImagePath(splashScreenImage), _activeProjectDirectory);
                    SplashScreenImageList.Add(imageItem);
                }
            }
            _splashScreenImageList = new CollectionView(SplashScreenImageList);

            IList<ConfigurationItemClass> ConfigurationList = new List<ConfigurationItemClass>();
            ConfigurationItemClass configItem = new ConfigurationItemClass("All Configurations");
            ConfigurationList.Add(configItem);
            foreach (qnxConfiguration config in _qnxSchema.configuration)
            {
                configItem = new ConfigurationItemClass(config.name);
                ConfigurationList.Add(configItem);
            }
            _configurationList = new CollectionView(ConfigurationList);

            IList<OrientationItemClass> OrientationList = new List<OrientationItemClass>();
            OrientationItemClass OrientationItem = new OrientationItemClass("Default");
            OrientationList.Add(OrientationItem);
            if (_qnxSchema.initialWindow.autoOrients == "")
            {
                _orientationItem = OrientationItem;
            }

            OrientationItem = new OrientationItemClass("Auto-orient");
            OrientationList.Add(OrientationItem);
            if (_qnxSchema.initialWindow.autoOrients == "true")
            {
                _orientationItem = OrientationItem;
            }

            OrientationItem = new OrientationItemClass("Landscape");
            OrientationList.Add(OrientationItem);
            if (_qnxSchema.initialWindow.aspectRatio == "landscape")
            {
                _orientationItem = OrientationItem;
            }

            OrientationItem = new OrientationItemClass("Portrait");
            OrientationList.Add(OrientationItem);
            if (_qnxSchema.initialWindow.aspectRatio == "portrait")
            {
                _orientationItem = OrientationItem;
            }

            _orientationList = new CollectionView(OrientationList);
        }