Exemple #1
0
        private string MakeIconResourceName(bool isOpen, IntvColor color)
        {
            var iconString = string.Empty;

            switch (LtoFlashViewModel.SyncMode)
            {
            case MenuLayoutSynchronizationMode.ToLtoFlash:
            case MenuLayoutSynchronizationMode.FromLtoFlash:
                switch (GetState())
                {
                case ProgramSupportFileState.PresentButModified:
                    iconString += "modified_";
                    break;

                case ProgramSupportFileState.Missing:
                    iconString += "missing_";
                    break;

                case ProgramSupportFileState.New:
                    iconString += "added_";
                    break;

                case ProgramSupportFileState.Deleted:
                    iconString += "deleted_";
                    break;
                }
                break;
            }
            iconString += isOpen ? "Open_" : "Closed_";
            if ((color != IntvColor.NotAColor) && MenuLayoutViewModel.Colors.Contains(color))
            {
                iconString += color.ToString() + "_";
            }
            return(this.CreatePackedResourceString("Resources/Images/folder_" + iconString + "16xLG.png"));
        }
Exemple #2
0
        /// <inheritdoc />
        protected override void OnColorChanged(INTV.Core.Model.Stic.Color newColor)
        {
            var iconForColor = GetIconForColor(newColor);

            if (Icon != iconForColor)
            {
                Icon = iconForColor;
            }
        }
        /// <inheritdoc />
        protected override void OnColorChanged(INTV.Core.Model.Stic.Color color)
        {
            OSImage icon = GetIconForColor(color);

            Icon = icon;
            if (Icon == null)
            {
                ErrorReporting.ReportError <InvalidOperationException>(ReportMechanism.Default, "OnColorChanged", "ProgramViewModel");
            }
        }
        /// <summary>
        /// Gets a ViewModel for the give Intellivision color.
        /// </summary>
        /// <param name="color">The Intellivision color for which to get a ViewModel.</param>
        /// <returns>The corresponding ViewModel for the Intellivision color.</returns>
        public static FileNodeColorViewModel GetColor(IntvColor color)
        {
            FileNodeColorViewModel colorViewModel = null;

            if (!_brushes.TryGetValue(color, out colorViewModel))
            {
                colorViewModel  = new FileNodeColorViewModel(color);
                _brushes[color] = colorViewModel;
            }
            return(colorViewModel);
        }
Exemple #5
0
        /// <inheritdoc />
        internal override sealed OSImage GetIconForColor(INTV.Core.Model.Stic.Color color)
        {
            OSImage icon  = null;
            var     key   = new Tuple <IntvColor, ProgramSupportFileState>(color, GetState());
            var     icons = IsOpen ? _openFolderIcons : _closedFolderIcons;

            if (!icons.TryGetValue(key, out icon))
            {
                icon       = ResourceHelpers.LoadImageResource(this.GetType(), MakeIconResourceName(IsOpen, color));
                icons[key] = icon;
            }
            return(icon);
        }
        /// <summary>
        /// Initializes a new instanced of a FileNodeColorViewModel based on an Intellivision color.
        /// </summary>
        /// <param name="color">The color of the element.</param>
        private FileNodeColorViewModel(IntvColor color)
        {
            _color = color;

            // TODO Even though redundant on Mac, could we make the code the same for both platforms?
#if WIN
            _fill = new OSBrush(color.ToColor());
#elif MAC
            _fill = color.ToColor();
#elif GTK
            _fill = color.ToColor();
#endif // WIN
        }
        private string MakeIconResourceName(IntvColor color)
        {
            var state      = GetSupportFileState(ProgramFileKind.Rom);
            var iconString = string.Empty;

            switch (state)
            {
            case ProgramSupportFileState.Missing:
                iconString += "missing_";
                break;

            case ProgramSupportFileState.PresentButModified:
                iconString += "modified_";
                break;

            case ProgramSupportFileState.New:
                iconString += "added_";
                break;

            case ProgramSupportFileState.Deleted:
                iconString += "deleted_";
                break;

            case ProgramSupportFileState.RequiredPeripheralIncompatible:
                iconString += "incompatible_";
                break;

            case ProgramSupportFileState.RequiredPeripheralUnknown:
                iconString += "unknown_";
                break;

            case ProgramSupportFileState.RequiredPeripheralAvailable:
            case ProgramSupportFileState.RequiredPeripheralNotAttached:
                // Don't decorate device-specific ROMs that don't need it.
                ////iconString += "devicespecific_";
                break;

            case ProgramSupportFileState.None:
            case ProgramSupportFileState.PresentAndUnchanged:
            default:
                break;
            }
            if ((color != IntvColor.NotAColor) && MenuLayoutViewModel.Colors.Contains(color))
            {
                iconString += color.ToString() + "_";
            }
            return("Resources/Images/document_" + iconString + "16xLG.png");
        }
        /// <inheritdoc />
        internal override OSImage GetIconForColor(INTV.Core.Model.Stic.Color color)
        {
            OSImage icon  = null;
            var     state = GetSupportFileState(ProgramFileKind.Rom);
            var     key   = new Tuple <IntvColor, ProgramSupportFileState>(color, state);

            if (!_icons.TryGetValue(key, out icon))
            {
                icon        = this.LoadImageResource(MakeIconResourceName(color));
                _icons[key] = icon;
            }
            if (icon == null)
            {
                ErrorReporting.ReportError <InvalidOperationException>(ReportMechanism.Default, "GetIconForColor", "ProgramViewModel");
            }
            if (icon == null)
            {
                ErrorReporting.ReportError <InvalidOperationException>(ReportMechanism.Default, "GetIconForColor", "ProgramViewModel");
            }
            return(icon);
        }
Exemple #9
0
 /// <summary>
 /// Converts an Intellivision color to an OS-specific color.
 /// </summary>
 /// <param name="color">The Intellivision color to convert.</param>
 /// <returns>The corresponding OS-specific color.</returns>
 public static OSColor ToColor(this IntvColor color)
 {
     return(IntvToOSColorDictionary[color]);
 }
Exemple #10
0
 /// <summary>
 /// Converts an Intellivision color to a user-readable string.
 /// </summary>
 /// <param name="color">The color whose display name is desired.</param>
 /// <returns>The name of the color.</returns>
 public static string ToDisplayString(this IntvColor color)
 {
     return(ColorNames[color]);
 }
 /// <summary>
 /// This method is called when the color of the item is being changed.
 /// </summary>
 /// <param name="newColor">The new color for the file system entry.</param>
 protected abstract void OnColorChanged(INTV.Core.Model.Stic.Color newColor);
 /// <summary>
 /// Gets the icon for the item in its current state, for the given color.
 /// </summary>
 /// <param name="color">The color of the desired icon.</param>
 /// <returns>The icon.</returns>
 internal abstract OSImage GetIconForColor(INTV.Core.Model.Stic.Color color);