コード例 #1
0
        private void InitUiModels()
        {
            StylesVariationList           = new ObservableCollection <ImageItem>();
            StylesVariationListSelectedId = new ObservableInt {
                Number = -1
            };
            StylesVariationListSelectedItem = new ObservableImageItem();
            CurrentVariantCategory          = new ObservableString();
            CurrentVariantCategoryId        = new ObservableInt {
                Number = -1
            };
            VariantsCategory   = new ObservableCollection <string>();
            SelectedFontId     = new ObservableInt();
            SelectedFontFamily = new ObservableFont();

            StylesPreviewList           = new ObservableCollection <ImageItem>();
            StylesPreviewListSelectedId = new ObservableInt {
                Number = -1
            };
            StylesPreviewListSelectedItem = new ObservableImageItem();

            ImageSelectionList = new ObservableCollection <ImageItem>();
            ImageSelectionList.Add(CreateChoosePicturesItem());

            Settings = StoragePath.LoadSettings();

            if (StoragePath.IsFirstTimeUsage())
            {
                Logger.Log("First time use PSL");
                ImageSelectionList.Add(CreateSamplePic1Item());
                ImageSelectionList.Add(CreateSamplePic2Item());
            }
            else
            {
                var loadedImageSelectionList = StoragePath.LoadPictures();
                foreach (var item in loadedImageSelectionList)
                {
                    if (item.FullSizeImageFile == null && item.BackupFullSizeImageFile != null)
                    {
                        item.FullSizeImageFile = item.BackupFullSizeImageFile;
                    }
                    else if (item.FullSizeImageFile == null && item.BackupFullSizeImageFile == null)
                    {
                        Logger.Log("Corrupted picture found. To be removed");
                        continue;
                    }
                    ImageSelectionList.Add(item);
                }
            }

            ImageSelectionListSelectedId = new ObservableInt {
                Number = -1
            };
            ImageSelectionListSelectedItem = new ObservableImageItem();
            IsActiveDownloadProgressRing   = new ObservableBoolean {
                Flag = false
            };
        }