コード例 #1
0
 public BindClass(SaveData.LivelyInfo info)
 {
     if (info != null)
     {
         LivelyInfo = info;
         Img        = LoadImage(info.Thumbnail);
     }
 }
コード例 #2
0
 private string LibraryInfoTypeText(SaveData.LivelyInfo info)
 {
     if (info.Type == SetupDesktop.WallpaperType.video)
     {
         var dimension = MainWindow.GetVideoSize(info.FileName);
         //return info.Type.ToString().ToUpper() + ", " + dimension.Width + "x" + dimension.Height;
         return(Properties.Resources.txtLivelyWallpaperTypeVideo + ", " + dimension.Width + "x" + dimension.Height);
     }
     else if (info.Type == SetupDesktop.WallpaperType.app)
     {
         return(Properties.Resources.txtLivelyWallpaperTypeApp);
         //return info.Type.ToString().ToUpper();
     }
     else if (info.Type == SetupDesktop.WallpaperType.godot)
     {
         return(Properties.Resources.txtLivelyWallpaperTypeGodot);
     }
     else if (info.Type == SetupDesktop.WallpaperType.unity)
     {
         return(Properties.Resources.txtLivelyWallpaperTypeUnity);
     }
     else if (info.Type == SetupDesktop.WallpaperType.unity_audio)
     {
         return(Properties.Resources.txtLivelyWallpaperTypeUnityAudio);
     }
     else if (info.Type == SetupDesktop.WallpaperType.web)
     {
         return(Properties.Resources.txtLivelyWallpaperTypeWeb);
     }
     else if (info.Type == SetupDesktop.WallpaperType.web_audio)
     {
         return(Properties.Resources.txtLivelyWallpaperTypeWebAudio);
     }
     else if (info.Type == SetupDesktop.WallpaperType.video_stream)
     {
         return(Properties.Resources.txtLabelStream);
     }
     else if (info.Type == SetupDesktop.WallpaperType.url)
     {
         return(Properties.Resources.txtLivelyWallpaperTypeUrl);
     }
     else if (info.Type == SetupDesktop.WallpaperType.gif)
     {
         return(Properties.Resources.txtLivelyWallpaperTypeGIF);
     }
     else
     {
         return(info.Type.ToString());
     }
 }
コード例 #3
0
 public TileData(SaveData.LivelyInfo info)
 {
     TilePreview = null; //otherwise everything gets loaded at once!
     if (!SaveData.config.LiveTile)
     {
         //Img = LoadImage(info.Thumbnail);
         Img = LoadConvertImage(info.Thumbnail);
     }
     else
     {
         Img = null;
     }
     UriContact = GetUri(info.Contact, "https");
     Type       = LibraryInfoTypeText(info);
     LivelyInfo = info;
 }
コード例 #4
0
            public TileData(SaveData.LivelyInfo info, string livelyInfoDirectory)
            {
                LivelyInfoDirectoryLocation = livelyInfoDirectory;
                TilePreview = null; //otherwise everything gets loaded at once!
                if (!SaveData.config.LiveTile)
                {
                    //Img = LoadImage(info.Thumbnail);
                    Img = LoadConvertImage(info.Thumbnail);
                }
                else
                {
                    if (File.Exists(info.Preview))
                    {
                        Img = null;
                    }
                    else
                    {
                        //if no preview gif, then load stock img.
                        Img = LoadConvertImage(info.Thumbnail);
                    }
                }
                UriContact = GetUri(info.Contact, "https");
                Type       = LibraryInfoTypeText(info);
                LivelyInfo = info;

                if (SaveData.config.WaterMark1)
                {
                    if (info.Type == SetupDesktop.WallpaperType.url || info.Type == SetupDesktop.WallpaperType.video_stream)
                    {
                        WatermarkImg1 = ToBitmapImage(Properties.Icons.icons8_online_48);
                    }
                    else if (info.IsAbsolutePath)
                    {
                        WatermarkImg1 = ToBitmapImage(Properties.Icons.icons8_hdd_48);
                    }
                    else
                    {
                        WatermarkImg1 = null;
                    }
                }
                else
                {
                    WatermarkImg1 = null;
                }
            }
コード例 #5
0
            public TileData(SaveData.LivelyInfo info, string livelyInfoDirectory)
            {
                LivelyInfoDirectoryLocation = livelyInfoDirectory;
                TilePreview = null; //otherwise everything gets loaded at once!
                if (!SaveData.config.LiveTile)
                {
                    //Img = LoadImage(info.Thumbnail);
                    Img = LoadConvertImage(info.Thumbnail);
                }
                else
                {
                    if (File.Exists(info.Preview))
                    {
                        Img = null;
                    }
                    else
                    {
                        //if no preview gif, then load stock img.
                        Img = LoadConvertImage(info.Thumbnail);
                    }
                }
                UriContact = GetUri(info.Contact, "https");
                Type       = LibraryInfoTypeText(info);
                LivelyInfo = info;

                CustomiseBtnToggle = false;
                //SetWpBtnVisibility = Visibility.Visible;
                //CustomiseWpBtnVisibility = Visibility.Collapsed;
                //design decision: customisable if the properties file is with the wp file, need not be with livelyinfo location (wptmp in SaveData)
                if (File.Exists(Path.Combine(Path.GetDirectoryName(info.FileName), "LivelyProperties.json")))
                {
                    //todo: watermark gear or something.
                    IsCustomisable = true;
                }
                else
                {
                    IsCustomisable = false;
                }


                if (SaveData.config.WaterMark1)
                {
                    if (info.Type == SetupDesktop.WallpaperType.url || info.Type == SetupDesktop.WallpaperType.video_stream)
                    {
                        WatermarkImg1 = ToBitmapImage(Properties.Icons.icons8_online_48);
                    }
                    else if (info.IsAbsolutePath)
                    {
                        WatermarkImg1 = ToBitmapImage(Properties.Icons.icons8_hdd_48);
                    }
                    else if (IsCustomisable)
                    {
                        WatermarkImg1 = ToBitmapImage(Properties.Icons.icons8_gear_32);
                    }
                    else
                    {
                        WatermarkImg1 = null;
                    }
                }
                else
                {
                    WatermarkImg1 = null;
                }
            }
コード例 #6
0
        private async void Button_Create_Click(object sender, RoutedEventArgs e)
        {
            tmpInfo.Title   = textboxTitle.Text;
            tmpInfo.Author  = textboxAuthor.Text;
            tmpInfo.Desc    = textboxDesc.Text;
            tmpInfo.Contact = textboxWebsite.Text;
            tmpInfo.License = textboxLicense.Text;
            //tmpInfo.Type = (SetupDesktop.WallpaperType)comboBoxType.SelectedItem;
            tmpInfo.Type      = wallpaperTypes[comboBoxType.SelectedIndex].Type;
            tmpInfo.Arguments = textboxArgs.Text;

            if (folderContents.Count == 0 || String.IsNullOrWhiteSpace(tmpInfo.FileName))
            {
                MessageBox.Show(Properties.Resources.txtMsgSelectWallpaperFile);
                return;
            }

            if (String.IsNullOrEmpty(tmpInfo.Title) || String.IsNullOrEmpty(tmpInfo.Desc) || String.IsNullOrEmpty(tmpInfo.Author)
                )    //|| String.IsNullOrEmpty(tmpInfo.contact) )
            {
                MessageBox.Show(Properties.Resources.txtMsgFillAllFields);
                return;
            }

            /*
             * //Optional
             * if( !File.Exists(tmpInfo.Thumbnail) || !File.Exists(tmpInfo.Preview) )
             * {
             *  MessageBox.Show(Properties.Resources.txtSelectPreviewThumb);
             *  return;
             * }
             */

            SaveFileDialog saveFileDialog1 = new SaveFileDialog
            {
                Title           = "Select location to save the file",
                Filter          = "Lively/zip file|*.zip",
                OverwritePrompt = true
            };

            if (saveFileDialog1.ShowDialog() == true)
            {
                if (!String.IsNullOrEmpty(saveFileDialog1.FileName))
                {
                    //to write to Livelyinfo.json file only, tmp object.
                    SaveData.LivelyInfo tmp = new SaveData.LivelyInfo(tmpInfo);
                    tmp.FileName  = Path.GetFileName(tmp.FileName);
                    tmp.Preview   = Path.GetFileName(tmp.Preview);
                    tmp.Thumbnail = Path.GetFileName(tmp.Thumbnail);

                    SaveData.SaveWallpaperMetaData(tmp, Path.Combine(App.PathData, "tmpdata"));

                    /*
                     * //if previous livelyinfo.json file(s) exists in wallpaper directory, remove all of them.
                     * folderContents.RemoveAll(x => Path.GetFileName(x).Equals(Path.GetFileName(folderContents[folderContents.Count - 1]),
                     *                  StringComparison.InvariantCultureIgnoreCase));
                     */
                    folderContents.Add(Path.Combine(App.PathData, "tmpdata", "LivelyInfo.json"));

                    //btnCreateWallpaer.IsEnabled = false;
                    await CreateZipFile(saveFileDialog1.FileName, folderContents);

                    string folderPath = System.IO.Path.GetDirectoryName(saveFileDialog1.FileName);
                    if (Directory.Exists(folderPath))
                    {
                        ProcessStartInfo startInfo = new ProcessStartInfo
                        {
                            Arguments = folderPath,
                            FileName  = "explorer.exe"
                        };
                        Process.Start(startInfo);
                    }

                    //clearing temp files if any.
                    FileOperations.EmptyDirectory(Path.Combine(App.PathData, "SaveData", "wptmp"));
                    //this.NavigationService.GoBack(); //won't work, since prev is window, not page.
                    var wnd = Window.GetWindow(this);
                    wnd.Close();
                }
            }
            else
            {
                return;
            }
        }
コード例 #7
0
 public QuickPreview(SaveData.LivelyInfo info)
 {
     InitializeComponent();
 }