Esempio n. 1
0
        private void LoadTheme_PostExecute(LoadThemeResults result)
        {
            if (result.Loaded)
            {
                ViewModel = new ThemeViewModel(result.Theme, result.Info);

                var path = result.Path;
                UpdateRecentsList(path);

                if (result.Info == null)
                {
                    IconExtension icex  = new IconExtension(@"/ThemeEditor.WPF;component/Resources/Icons/app_icn.ico", 48);
                    var           large = ((BitmapSource)icex.ProvideValue(null)).CreateResizedImage(48, 48);
                    icex.Size = 24;
                    var small = ((BitmapSource)icex.ProvideValue(null)).CreateResizedImage(24, 24);

                    ViewModel.Info.LargeIcon.Bitmap = large;
                    ViewModel.Info.SmallIcon.Bitmap = small;
                }

                ThemePath = result.Path;

                if (ReloadBGMCommand.CanExecute(null))
                {
                    ReloadBGMCommand.Execute(null);
                }
            }
            IsBusy = false;
        }
Esempio n. 2
0
        private void RemoveImage_Execute(TargetImage args)
        {
            switch (args)
            {
            case TargetImage.Top:
                ViewModel.Textures.Top.ClearTexture();
                break;

            case TargetImage.Bottom:
                ViewModel.Textures.Bottom.ClearTexture();
                break;

            case TargetImage.FileLarge:
                ViewModel.Textures.FileLarge.ClearTexture();
                break;

            case TargetImage.FileSmall:
                ViewModel.Textures.FileSmall.ClearTexture();
                break;

            case TargetImage.FolderOpen:
                ViewModel.Textures.FolderOpen.ClearTexture();
                break;

            case TargetImage.FolderClosed:
                ViewModel.Textures.FolderClosed.ClearTexture();
                break;

            case TargetImage.TopAlt:
                ViewModel.Textures.TopAlt.ClearTexture();
                break;

            case TargetImage.SmallIcon:
            {
                var icex  = new IconExtension(@"/ThemeEditor.WPF;component/Resources/Icons/app_icn.ico", 24);
                var large = ((BitmapSource)icex.ProvideValue(null)).CreateResizedImage(24, 24);
                ViewModel.Info.SmallIcon.EncodeTexture(large, RawTexture.DataFormat.Bgr565);
                break;
            }

            case TargetImage.LargeIcon:
            {
                var icex  = new IconExtension(@"/ThemeEditor.WPF;component/Resources/Icons/app_icn.ico", 48);
                var large = ((BitmapSource)icex.ProvideValue(null)).CreateResizedImage(48, 48);
                ViewModel.Info.LargeIcon.EncodeTexture(large, RawTexture.DataFormat.Bgr565);
                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }
        }