Exemple #1
0
        /// <summary>
        /// Returns an GetImage (icon) based on the <see cref="Thing"/> that is provided
        /// </summary>
        /// <param name="value">An instance of <see cref="Thing"/> for which an Icon needs to be returned</param>
        /// <param name="targetType">The parameter is not used.</param>
        /// <param name="parameter">The parameter is not used.</param>
        /// <param name="culture">The parameter is not used.</param>
        /// <returns>
        /// A <see cref="Uri"/> to an GetImage
        /// </returns>
        public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            var rowStatus   = value.OfType <RowStatusKind>().SingleOrDefault();
            var thing       = value.OfType <Thing>().SingleOrDefault();
            var thingStatus = value.OfType <ThingStatus>().SingleOrDefault();

            Uri uri;

            if (thing == null && thingStatus == null)
            {
                return(null);
            }

            var classKind = thing != null ? thing.ClassKind : thingStatus.Thing.ClassKind;

            switch (rowStatus)
            {
            case RowStatusKind.Active:
                uri = new Uri(IconUtilities.ImageUri(classKind).ToString());
                break;

            case RowStatusKind.Inactive:
                uri = new Uri(this.GrayScaleImageUri(classKind).ToString());
                break;

            default:
                uri = new Uri(IconUtilities.ImageUri(classKind).ToString());
                break;
            }

            if (thing != null)
            {
                if (thing.ValidationErrors.Any())
                {
                    return(this.QueryIIconCacheService().QueryErrorOverlayBitmapSource(uri));
                }
                else
                {
                    return(this.QueryIIconCacheService().QueryBitmapImage(uri));
                }
            }

            if (thingStatus.HasError)
            {
                return(this.QueryIIconCacheService().QueryErrorOverlayBitmapSource(uri));
            }

            if (thingStatus.HasRelationship)
            {
                return(this.QueryIIconCacheService().QueryOverlayBitmapSource(uri, IconUtilities.RelationshipOverlayUri, OverlayPositionKind.TopRight));
            }

            return(this.QueryIIconCacheService().QueryBitmapImage(uri));
        }
Exemple #2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return null;

            try
            {
                if (value is string)
                {
                    var path = (string)value;

                    var ext = Path.GetExtension(path);
                    if (string.IsNullOrWhiteSpace(ext)) return null;

                    BitmapSource icon;

                    if (!_icon.TryGetValue(ext, out icon))
                    {
                        icon = IconUtilities.FileAssociatedImage(ext, false, false);
                        if (icon.CanFreeze) icon.Freeze();

                        _icon[ext] = icon;
                    }

                    return icon;
                }
                else if (value is Seed)
                {
                    Seed seed = (Seed)value;
                    if (string.IsNullOrWhiteSpace(seed.Name)) return null;

                    var ext = Path.GetExtension(seed.Name);
                    if (string.IsNullOrWhiteSpace(ext)) return null;

                    BitmapSource icon;

                    if (!_icon.TryGetValue(ext, out icon))
                    {
                        icon = IconUtilities.FileAssociatedImage(ext, false, false);
                        if (icon.CanFreeze) icon.Freeze();

                        _icon[ext] = icon;
                    }

                    return icon;
                }
                else if (value is Box)
                {
                    return _boxIcon;
                }
            }
            catch (Exception)
            {

            }

            return null;
        }
Exemple #3
0
        static ObjectToImageConverter()
        {
            var ext = ".box";

            var icon = IconUtilities.FileAssociatedImage(ext, false, false);
            if (icon.CanFreeze) icon.Freeze();

            _boxIcon = icon;
        }
Exemple #4
0
        /// <summary>
        /// Queries the <see cref="BitmapSource"/> with an error icon overlayed from the cache if the cache contains it else the <see cref="BitmapSource"/>
        /// is created, added to the cache and then returned.
        /// </summary>
        /// <param name="uri">
        /// The uri of the <see cref="BitmapSource"/>
        /// </param>
        /// <returns>
        /// An instance of <see cref="BitmapSource"/>
        /// </returns>
        public BitmapSource QueryErrorOverlayBitmapSource(Uri uri)
        {
            BitmapSource bitmapSource;

            this.bitmapSources.TryGetValue(uri, out bitmapSource);
            if (bitmapSource == null)
            {
                bitmapSource = IconUtilities.WithErrorOverlay(uri);
                this.bitmapSources.Add(uri, bitmapSource);
            }

            return(bitmapSource);
        }
Exemple #5
0
        /// <summary>
        /// Returns an GetImage (icon) based on the <see cref="ClassKind"/> that is provided
        /// </summary>
        /// <param name="value">A <see cref="ClassKind"/> for which an Icon needs to be returned</param>
        /// <param name="targetType">The parameter is not used.</param>
        /// <param name="parameter">The <see cref="ClassKind"/> of the overlay to use</param>
        /// <param name="culture">The parameter is not used.</param>
        /// <returns>
        /// A <see cref="Uri"/> to an GetImage
        /// </returns>
        public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
        {
            var classKind = value.OfType <ClassKind?>().SingleOrDefault();

            if (classKind == null)
            {
                return(null);
            }

            var baseUri = new Uri(IconUtilities.ImageUri(classKind.Value).ToString());

            return(this.QueryIIconCacheService().QueryBitmapImage(baseUri));
        }
        /// <summary>
        /// Returns an GetImage (icon) based on the <see cref="Thing" /> that is provided
        /// </summary>
        /// <param name="value">An instance of <see cref="Thing" /> for which an Icon needs to be returned</param>
        /// <param name="targetType">The parameter is not used.</param>
        /// <param name="parameter">The <see cref="ClassKind" /> of the overlay to use</param>
        /// <param name="culture">The parameter is not used.</param>
        /// <returns>
        /// A <see cref="Uri" /> to an GetImage
        /// </returns>
        public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
        {
            var genericConverter = new ThingToIconUriConverter();
            var thingStatus      = value.SingleOrDefault() as ThingStatus;

            var parameterBase = thingStatus?.Thing as ParameterBase;

            ClassKind valuesetRowType;

            if (parameterBase == null || parameter == null || !Enum.TryParse(parameter.ToString(), out valuesetRowType))
            {
                return(genericConverter.Convert(value, targetType, parameter, culture));
            }

            var isCompound = parameterBase.ParameterType is CompoundParameterType;

            // Value set row
            // row representing an option
            if (valuesetRowType == ClassKind.Option)
            {
                var optionUri = new Uri(IconUtilities.ImageUri(valuesetRowType).ToString());

                if (parameterBase.StateDependence != null || isCompound)
                {
                    return(new BitmapImage(optionUri));
                }

                var uri = new Uri(IconUtilities.ImageUri(parameterBase.ClassKind).ToString());
                return(IconUtilities.WithOverlay(uri, optionUri));
            }

            // row representing a component
            if (valuesetRowType == ClassKind.ParameterTypeComponent)
            {
                var componentUri = new Uri(IconUtilities.ImageUri(valuesetRowType).ToString());
                return(new BitmapImage(componentUri));
            }

            // Row representing state
            var stateUri = new Uri(IconUtilities.ImageUri(ClassKind.ActualFiniteState).ToString());

            if (isCompound)
            {
                return(new BitmapImage(stateUri));
            }

            var baseUri = new Uri(IconUtilities.ImageUri(parameterBase.ClassKind).ToString());

            return(IconUtilities.WithOverlay(baseUri, stateUri));
        }
Exemple #7
0
        protected override void OnCreate()
        {
            FSLog.Info("PreviewClientSimulationSystemGroup OnCreate");
            Application.targetFrameRate     = 60;
            UnityEngine.Time.fixedDeltaTime = gameTime.TickInterval;
            ConfigVar.Init();
            ItemCreateUtilities.Init();
            ClientCharacterUtilities.Init();
            IconUtilities.Init();
            GameWorld.Active = new GameWorld();
            EntityManager.CreateEntity(typeof(Server));
            SetSingleton(new Server());

            inputSystem = World.GetOrCreateSystem <InputSystem>();
            m_systemsToUpdate.Add(inputSystem);

            initSystemGroup = World.GetOrCreateSystem <InitSystemGroup>();
            m_systemsToUpdate.Add(initSystemGroup);

            spawnCharacterSystem = World.GetOrCreateSystem <SpawnCharactersSystem>();
            m_systemsToUpdate.Add(spawnCharacterSystem);

            spawnSystemGroup = World.GetOrCreateSystem <SpawnSystemGroup>();
            m_systemsToUpdate.Add(spawnSystemGroup);

            updateReplicatedOwnerFlag = World.GetOrCreateSystem <UpdateReplicatedOwnerFlag>();
            m_systemsToUpdate.Add(updateReplicatedOwnerFlag);

            predictUpdateSystem = World.GetOrCreateSystem <PredictUpdateSystemGroup>();
            m_systemsToUpdate.Add(predictUpdateSystem);

            serverSystemGroup = World.GetOrCreateSystem <ServerSystemGroup>();
            m_systemsToUpdate.Add(serverSystemGroup);

            predictPresentationSystemGroup = World.GetOrCreateSystem <PredictPresentationSystemGroup>();
            m_systemsToUpdate.Add(predictPresentationSystemGroup);

            despawnSystemGroup = World.GetOrCreateSystem <DespawnSystemGroup>();
            m_systemsToUpdate.Add(despawnSystemGroup);

            addItemComponentSystem = World.GetOrCreateSystem <AddItemComponentSystem>();
            m_systemsToUpdate.Add(addItemComponentSystem);

            addDespawnServerSystem = World.GetOrCreateSystem <AddDespawnServerSystem>();
            m_systemsToUpdate.Add(addDespawnServerSystem);


            updateReplicatedOwnerFlag.SetLocalPlayerId(0);
        }
Exemple #8
0
 private void RenderFilesInView(List <FileInfo> files, bool isSearchResults)
 {
     try
     {
         IsCheckIOBusy       = true;
         IsRightPanelVisible = false;
         foreach (var mFile in files)
         {
             //Get Icons
             string shortCutPath = mFile.FullName;
             string icon         = IconUtilities.GetIconString(shortCutPath);
             //ImageSource image = null;
             //string extension = IconUtilities.GetExtension(shortCutPath);
             //try
             //{
             //    if (extension == ".lnk")
             //    {
             //        image = IconUtilities.GetIconForShortCut(shortCutPath);
             //    }
             //    else
             //    {
             //        image = IconUtilities.GetIcon(shortCutPath);
             //    }
             //    if (image == null)
             //    {
             //        image = folderIcon;
             //    }
             //}
             //catch (Exception)
             //{
             //    image = folderIcon;
             //}
             var    isFavorite = _referenceService.IsFileInFavorite(mFile.FullName);
             TCFile file       = new TCFile(mFile.Name, mFile.FullName, previousFolder, TCFile.TCType.FILE, icon);
             file.IsFavorited          = isFavorite;
             file.DoubleClickEvent    += File_DoubleClickEvent;
             file.FileClickedEvent    += File_FileClickedEvent;
             file.InfoPanelClickEvent += File_InfoPanelClickEvent;
             file.FavouriteClickEvent += File_FavouriteClickEvent;
             FileCollection.Add(file);
         }
         IsCheckIOBusy = false;
     }
     catch (Exception e)
     {
         Console.WriteLine("Render Files In View Failed: {0}", e.ToString());
     }
 }
        protected override void OnCreate()
        {
            FSLog.Info("KitchenClientSimulationSystemGroup OnCreate");

            ConfigVar.Init();
            GameWorld.Active = new GameWorld();
            ItemCreateUtilities.Init();
            ClientCharacterUtilities.Init();
            MenuUtilities.Init();
            IconUtilities.Init();
            Application.targetFrameRate     = 60;
            UnityEngine.Time.fixedDeltaTime = GameTick.DefaultGameTick.TickInterval;

            worldSceneEntitiesSystem = World.GetOrCreateSystem <WorldSceneEntitiesSystem>();
            m_systemsToUpdate.Add(worldSceneEntitiesSystem);

            networkSystem = World.GetOrCreateSystem <NetworkClientSystem>();
            m_systemsToUpdate.Add(networkSystem);

            handleTimeSystem = World.GetOrCreateSystem <HandleTimeSystem>();
            m_systemsToUpdate.Add(handleTimeSystem);

            setRenderTimeSystem = World.GetOrCreateSystem <SetRenderTimeSystem>();
            m_systemsToUpdate.Add(setRenderTimeSystem);

            replicateEntitySystemGroup = World.GetOrCreateSystem <ReplicateEntitySystemGroup>();
            m_systemsToUpdate.Add(replicateEntitySystemGroup);


            setPredictTimeSystem = World.GetOrCreateSystem <SetPredictTimeSystem>();
            m_systemsToUpdate.Add(setPredictTimeSystem);

            predictSystem = World.GetOrCreateSystem <PredictSystem>();
            m_systemsToUpdate.Add(predictSystem);

            itemClientSystemGroup = World.GetOrCreateSystem <ItemClientSystemGroup>();
            m_systemsToUpdate.Add(itemClientSystemGroup);


            predictPresentationSystemGroup = World.GetOrCreateSystem <PredictPresentationSystemGroup>();
            m_systemsToUpdate.Add(predictPresentationSystemGroup);

            despawnSystemGroup = World.GetOrCreateSystem <DespawnSystemGroup>();
            m_systemsToUpdate.Add(despawnSystemGroup);
        }
		public DisassemblyDocument( Studio studio )
			: this()
		{
			Debug.Assert( studio != null );
			if( studio == null )
				throw new ArgumentNullException( "studio" );
			_studio = studio;

			this.Icon = IconUtilities.ConvertToIcon( Properties.Resources.DisassemblyIcon );

			_statementIcon = codeEditorControl.GutterIcons.Images.Add( Properties.Resources.StatementIcon, Color.Transparent );
			_statementCallIcon = codeEditorControl.GutterIcons.Images.Add( Properties.Resources.StatementCallIcon, Color.Transparent );
			_statementDeadIcon = codeEditorControl.GutterIcons.Images.Add( Properties.Resources.StatementDeadIcon, Color.Transparent );

			_statements = new Dictionary<int, Statement>();

			this.PopulateMethods();

			//CodeEditorSyntaxLoader.SetSyntax( _editor, SyntaxLanguage.Text );
		}
Exemple #11
0
        private string GetMenuIconBitmapPath()
        {
            var cachePath = Path.Combine(Path.GetTempPath(), FolderId.ToString("N") + ".png");

            if (!IOUtilities.FileExists(cachePath))
            {
                using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType().Namespace + ".UI.CloudFolder.ico"))
                {
                    if (stream == null)
                    {
                        throw new InvalidOperationException();
                    }

                    // note the 16 size is a 256 colors, not a full RGB color as the Shell's context menu doesn't like that
                    var bmps = IconUtilities.LoadIconsFromStream(stream);
                    var bmp  = bmps.FirstOrDefault(i => i.Height == 16);
                    bmp.Save(cachePath);
                }
            }
            return(cachePath);
        }
Exemple #12
0
        public LocalShellFolderServer(DirectoryInfo info)
        {
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }

            if (!info.Exists)
            {
                throw new ArgumentException(null, nameof(info));
            }

            Info         = info;
            IconsDllPath = Path.GetFullPath("icons.dll");
            if (!File.Exists(IconsDllPath))
            {
                // use ShellBoost utility to extract .NET embedded resources and insert them into a Win32 resource-only .DLL file
                IconUtilities.SaveAsDll(Assembly.GetExecutingAssembly(), typeof(Program).Namespace + ".Resources.Attribute.ico", IconsDllPath, AttributeIconIndex, 1033, false);
                IconUtilities.SaveAsDll(Assembly.GetExecutingAssembly(), typeof(Program).Namespace + ".Resources.ErrorOverlay.ico", IconsDllPath, ErrorOverlayIconIndex, 1033, false);
                IconUtilities.SaveAsDll(Assembly.GetExecutingAssembly(), typeof(Program).Namespace + ".Resources.WarningOverlay.ico", IconsDllPath, WarningOverlayIconIndex, 1033, false);
            }
        }
Exemple #13
0
        private void RenderFavorites(ObservableCollection <cc310_reference_centre_file> favorites)
        {
            IsCheckIOBusy = true;
            FileCollection.Clear();

            foreach (var mFile in favorites)
            {
                //Get Icons

                string shortCutPath = mFile.file_full_nm;
                string icon         = IconUtilities.GetIconString(shortCutPath);

                FileInfo fileInfo = new FileInfo(mFile.file_path_txt);
                TCFile   file     = new TCFile(fileInfo.Name, fileInfo.FullName, previousFolder, TCFile.TCType.FAVORITE, icon); //new TCFile(fileInfo, image, true);
                file.DoubleClickEvent    += File_DoubleClickEvent;
                file.FileClickedEvent    += File_FileClickedEvent;
                file.InfoPanelClickEvent += File_InfoPanelClickEvent;
                file.FavouriteClickEvent += File_FavouriteClickEvent;
                FileCollection.Add(file);
            }
            IsCheckIOBusy = false;
        }
Exemple #14
0
        /// <summary>
        /// Returns an GetImage (icon) based on the <see cref="Thing"/> that is provided
        /// </summary>
        /// <param name="value">An instance of <see cref="Thing"/> for which an Icon needs to be returned</param>
        /// <param name="targetType">The parameter is not used.</param>
        /// <param name="parameter">The <see cref="ClassKind"/> of the overlay to use</param>
        /// <param name="culture">The parameter is not used.</param>
        /// <returns>
        /// A <see cref="Uri"/> to an GetImage
        /// </returns>
        public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            if (value.Length == 0)
            {
                return(null);
            }

            var file = value[0] as File;

            if (file != null)
            {
                var fileIconUri = new Uri(IconUtilities.ImageUri(file.ClassKind).ToString());
                return(new BitmapImage(fileIconUri));
            }

            var thing = value[0] as Thing;

            if (thing != null)
            {
                var fileIconUri = new Uri(IconUtilities.ImageUri(thing.ClassKind).ToString());
                return(new BitmapImage(fileIconUri));
            }

            var isLocked = value[0] as bool?;

            if (isLocked != null && isLocked.Value)
            {
                var lockedUri = new Uri("pack://application:,,,/CDP4Composition;component/Resources/Images/Thing/lock.png", UriKind.RelativeOrAbsolute);
                return(new BitmapImage(lockedUri));
            }

            return(null);
        }
Exemple #15
0
        public CpuPane(Studio studio)
            : this()
        {
            Debug.Assert(studio != null);
            if (studio == null)
            {
                throw new ArgumentNullException("studio");
            }
            _studio = studio;

            this.Icon = IconUtilities.ConvertToIcon(Properties.Resources.RegistersIcon);

            _cpu   = _studio.Debugger.Host.CurrentInstance.Cpu;
            _core0 = _cpu.Cores[0];

            _studio.GlobalRefreshRequested += new EventHandler(StudioGlobalRefreshRequested);

            this.generalRegistersLabel_SizeChanged(this, EventArgs.Empty);

            _useFriendlyLabels            = true;
            this.friendlyCheckbox.Checked = _useFriendlyLabels;

            this.UpdateValues();
        }
Exemple #16
0
 /// <summary>
 /// Queries the <see cref="BitmapSource"/> with an icon overlayed from the cache if the cache contains it else the <see cref="BitmapSource"/>
 /// is created, added to the cache and then returned.
 /// </summary>
 /// <param name="uri">
 /// The uri of the <see cref="BitmapSource"/>
 /// </param>
 /// <param name="overlayUri">
 /// The uri of the overlay <see cref="BitmapSource"/>
 /// </param>
 /// <returns>
 /// An instance of <see cref="BitmapSource"/>
 /// </returns>
 public BitmapSource QueryOverlayBitmapSource(Uri uri, Uri overlayUri, OverlayPositionKind overlayPosition = OverlayPositionKind.TopLeft)
 {
     return(IconUtilities.WithOverlay(uri, overlayUri, overlayPosition));
 }