/// <summary> /// Registers this decoder to the Decoder provider. /// </summary> public static void RegisterDecoder() { Decoders.AddDecoder <OriginalMap>( "osu file format v", (header) => new OsuBeatmapDecoder(ParseUtils.ParseInt(header.Split('v').Last(), LatestVersion)) ); }
/// <summary> /// Handles final process after initialization. /// </summary> protected virtual void PostInitialize() { Dependencies.CacheAs <IInputManager>(inputManager = InputManager.Create( rootMain.Resolution, Application.isMobilePlatform ? 0 : 2, Application.isMobilePlatform ? 5 : 0 )); // Some default system settings. Screen.sleepTimeout = SleepTimeout.NeverSleep; Application.targetFrameRate = 60; // Load environment envConfiguration.Load("Configurations/Env"); // Apply accelerator to input manager // inputManager.Accelerator = (Application.isMobilePlatform ? (IAccelerator)new DeviceAccelerator() : (IAccelerator)new CursorAccelerator()); inputManager.Accelerator = new CursorAccelerator(); // Register decoders. Decoders.AddDecoder <OriginalMap>( "osu file format v", (header) => new OsuBeatmapDecoder(ParseUtils.ParseInt(header.Split('v').Last(), OsuBeatmapDecoder.LatestVersion)) ); // Set default font fontManager.DefaultFont.Value = new ResourceFont("Fonts/Montserrat"); }
private void Initialize() { SiteManager = new SiteManager(); Favorites = new Favorites(); Decoders.AddDecoder <GifDecoder>(); }
public void Initialize() { if (_codecList == null) { Decoders.AddDecoder <JpegDecoder>(); Decoders.AddDecoder <PngDecoder>(); Decoders.AddDecoder <BmpDecoder>(); Decoders.AddDecoder <GifDecoder>(); _codecList = new RegisteredCodec(); _codecList.Add(new ImageToolsCodec("jpg")); _codecList.Add(new ImageToolsCodec("png")); _codecList.Add(new ImageToolsCodec("bmp")); _codecList.Add(new ImageToolsCodec("gif")); _codecList.Add(new UnsupportedImageToolsCodec("tga")); _codecList.Add(new UnsupportedImageToolsCodec("RT")); foreach (var i in _codecList) { if (!CodecManager.Instance.IsCodecRegistered(i.Type)) { CodecManager.Instance.RegisterCodec(i); } } } }
public PostView() { InitializeComponent(); Decoders.AddDecoder <GifDecoder>(); Loaded += new RoutedEventHandler(PostView_Loaded); }
public RadarPageViewModel() { if (IsInDesignMode == false) { Decoders.AddDecoder <GifDecoder>(); this.ImageSource = new Uri(AppSettings.RadarAnimation, UriKind.Absolute); } }
public RandomPage() { InitializeComponent(); Decoders.AddDecoder <GifDecoder>(); var WebClient = new WebClient(); WebClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(WebClient_DownloadStringCompleted); WebClient.DownloadStringAsync(new Uri(Constants.RandomAdress, UriKind.Absolute)); }
/// <summary> /// Initializes a new instance of the <see cref="App"/> class. /// </summary> /// <remarks>Registers all available image decoders that can be /// used in the whole application.</remarks> public App() { Startup += Application_Startup; UnhandledException += this.Application_UnhandledException; Decoders.AddDecoder <PngDecoder>(); Decoders.AddDecoder <JpegDecoder>(); Decoders.AddDecoder <BmpDecoder>(); Decoders.AddDecoder <GifDecoder>(); InitializeComponent(); }
// Code to execute when the application is launching (eg, from Start) // This code will not execute when the application is reactivated private void Application_Launching(object sender, LaunchingEventArgs e) { setCorrectLanguage(); //NonLinearNavigationService.Instance.Initialize(RootFrame); Settings.RunsCount++; ThreadPool.QueueUserWorkItem(delegate { Decoders.AddDecoder <BmpDecoder>(); Decoders.AddDecoder <PngDecoder>(); Decoders.AddDecoder <GifDecoder>(); Decoders.AddDecoder <JpegDecoder>(); }); PagesState.Current = new PagesState(); PicturesCache.Load(); }
// Code to execute when the application is activated (brought to foreground) // This code will not execute when the application is first launched private void Application_Activated(object sender, ActivatedEventArgs e) { if (!e.IsApplicationInstancePreserved) { setCorrectLanguage(); ThreadPool.QueueUserWorkItem(delegate { Decoders.AddDecoder <BmpDecoder>(); Decoders.AddDecoder <PngDecoder>(); Decoders.AddDecoder <GifDecoder>(); Decoders.AddDecoder <JpegDecoder>(); }); ApplicationState.Current = ApplicationState.LoadState(); PagesState.Current = PagesState.LoadState(); PicturesCache.Load(); } }
public MainViewModel() { Decoders.AddDecoder <GifDecoder>(); Uri uri = new Uri("Gif/explosion.gif", UriKind.Relative); ExtendedImage image = new ExtendedImage(); // either of these two method work. // Just remove the first / to switch //* image.LoadingCompleted += (o, e) => Dispatcher.BeginInvoke(() => AnimationImage = image); image.UriSource = uri; /*/ * Stream stream = Application.GetResourceStream(uri).Stream; * GifDecoder decoder = new GifDecoder(); * decoder.Decode(image, stream); * AnimationImage = image; * /**/ }
public UVIndexPageViewModel() { Decoders.AddDecoder <GifDecoder>(); if (IsInDesignMode == false) { this.ImageSource = new Uri("http://www.dmi.dk/dmi/1daymap.gif", UriKind.Absolute); UVIndexProvider.GetUVIndex((result) => { SmartDispatcher.BeginInvoke(() => { NorthJytland = result[0]; MiddleAndWestJytland = result[1]; EastJytland = result[2]; SouthJytland = result[3]; Fyn = result[4]; SouthAndWestZealand = result[5]; Copenhagen = result[6]; Bornholm = result[7]; }); }); } }
//Aktion void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { //Bild vom Internet in den Isolated Storage speichern try { //Dateiname anhand der DownloadID erstellen if (DownloadID == 0) { //Dateiname erstellen FileName = "txt.txt"; //Alte Datei löschen if (file.FileExists("TempStyles/txt.txt")) { file.DeleteFile("TempStyles/txt.txt"); } } else { //Dateiname erstellen FileName = "1.png"; //Alte Datei löschen if (file.FileExists("TempStyles/1.png")) { file.DeleteFile("TempStyles/1.png"); } } //Prüfen ob Downloadordner existiert if (file.DirectoryExists("TempStyles")) { } else { file.CreateDirectory("TempStyles"); } //Prüfen ob Datei bereits vorhanden if (file.FileExists("TempStyles/" + FileName)) { file.DeleteFile("TempStyles/" + FileName); } //Datei in Isolated Storage laden using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream("TempStyles/" + FileName, System.IO.FileMode.Create, file)) { byte[] buffer = new byte[1024]; while (e.Result.Read(buffer, 0, buffer.Length) > 0) { stream.Write(buffer, 0, buffer.Length); } } //Nach dem Das Bild heruntergeladen wurde, Bild laden und in Storage schreiben if (DownloadID == 1) { //Writeable Bitmap erstellen var tempImage = new WriteableBitmap(1, 1); byte[] data1; { using (IsolatedStorageFileStream isfs = file.OpenFile("TempStyles/1.png", FileMode.Open, FileAccess.Read)) { data1 = new byte[isfs.Length]; isfs.Read(data1, 0, data1.Length); isfs.Close(); } } MemoryStream ms = new MemoryStream(data1); //Bild in WriteableBitmap tempImage.SetSource(ms); ImagesOnline1.Source = tempImage; //Bild Spiegeln tempImage = tempImage.Flip(WriteableBitmapExtensions.FlipMode.Vertical); //Altes Bild löschen if (file.FileExists("TempStyles/2.png")) { file.DeleteFile("TempStyles/2.png"); } //Bild speichern Decoders.AddDecoder <PngDecoder>(); var img = tempImage.ToImage(); var encoder = new PngEncoder(); using (var stream = new IsolatedStorageFileStream("TempStyles/2.png", FileMode.Create, file)) { encoder.Encode(img, stream); stream.Close(); } //Bild ausgeben ImagesOnline2.Source = tempImage; //Bild Spiegeln tempImage = tempImage.Flip(WriteableBitmapExtensions.FlipMode.Horizontal); //Altes Bild löschen if (file.FileExists("TempStyles/3.png")) { file.DeleteFile("TempStyles/3.png"); } //Bild speichern Decoders.AddDecoder <PngDecoder>(); img = tempImage.ToImage(); encoder = new PngEncoder(); using (var stream = new IsolatedStorageFileStream("TempStyles/3.png", FileMode.Create, file)) { encoder.Encode(img, stream); stream.Close(); } //Bild ausgeben ImagesOnline3.Source = tempImage; //Bild Spiegeln tempImage = tempImage.Flip(WriteableBitmapExtensions.FlipMode.Vertical); //Altes Bild löschen if (file.FileExists("TempStyles/4.png")) { file.DeleteFile("TempStyles/4.png"); } //Bild speichern Decoders.AddDecoder <PngDecoder>(); img = tempImage.ToImage(); encoder = new PngEncoder(); using (var stream = new IsolatedStorageFileStream("TempStyles/4.png", FileMode.Create, file)) { encoder.Encode(img, stream); stream.Close(); } //Bild ausgeben ImagesOnline4.Source = tempImage; } } catch { } //DownloadID erhöhen um nächstes Bild aus aus dem Netz herunterzuladen DownloadID++; }
static ThemedImage() { Decoders.AddDecoder <BmpDecoder>(); Decoders.AddDecoder <PngDecoder>(); Decoders.AddDecoder <GifDecoder>(); }
public GifViewer() { Decoders.AddDecoder <GifDecoder>(); InitializeComponent(); }
static ImageUtils() { // Adds support for GIF. Decoders.AddDecoder <GifDecoder>(); }
/// <summary> /// Initializes a new instance of the <see cref="MainPageViewModel"/> class. /// </summary> public MainPageViewModel() { Decoders.AddDecoder <PngDecoder>(); }
/// <summary> /// This is a very simple page. We simply bind to the CurrentPicture property on the AlbumsViewModel /// </summary> public ScalingPictureView() { Decoders.AddDecoder <GifDecoder>(); InitializeComponent(); }
void MainPage_Loaded(object sender, RoutedEventArgs e) { content.Text = tishi_str1; Decoders.AddDecoder <GifDecoder>(); dmdgif.UriSource = new Uri(dmd_gif1, UriKind.Relative); for (int i = 0; i < 5; i++) { ////////// photo[i] = new Image(); string img = string.Format(@"<Image xmlns='http://schemas.microsoft.com/client/2007' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' Height='95' Width='95' Stretch='Fill' Grid.Column='{0}' Grid.Row='{1}'> <Image.Clip> <RectangleGeometry Rect='0, 0, 95, 95' RadiusX='20' RadiusY='20'/> </Image.Clip> </Image>", col, i * 2 + 1); Image bmp = XamlReader.Load(img) as Image; photo[i] = bmp; ////////////// animated_gif[i] = new AnimatedImage(); string gif1 = string.Format(@"<it:AnimatedImage Name='igif' xmlns='http://schemas.microsoft.com/client/2007' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' xmlns:it='clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls' Height='95' Width='95' Stretch='Fill' Grid.Column= '1' Grid.Row='{0}'/> ", i * 2 + 1); AnimatedImage animated_GIF = XamlReader.Load(gif1) as AnimatedImage; ExtendedImage image = new ExtendedImage(); image.UriSource = new Uri(gif_arr[i], UriKind.Relative); animated_GIF.Source = image; animated_gif[i] = animated_GIF; //////////// } if (app.RRF_head_picture != null && app.RRF_navigate_name != null) { ++app.t_num; app.row += 2; BitmapImage rec = new BitmapImage(); rec.UriSource = new Uri(app.RRF_head_picture, UriKind.Absolute); app.all_name[app.t_num - 1] = app.RRF_navigate_name; app.RRF_head_picture = null; app.RRF_navigate_name = null; app.SavingImage[app.row / 2] = rec; for (int q = 0; q < app.t_num; q++) { photo[q].Source = app.SavingImage[q]; photolist.Children.Add(photo[q]); switch (q) { case 0: textBlock1.Text = app.all_name[0]; break; case 1: textBlock2.Text = app.all_name[1]; break; case 2: textBlock3.Text = app.all_name[2]; break; case 3: textBlock4.Text = app.all_name[3]; break; case 4: textBlock5.Text = app.all_name[4]; break; } } } if (app.row == 9 && col == 1) { ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).IsEnabled = false; ((ApplicationBarIconButton)this.ApplicationBar.Buttons[1]).IsEnabled = false; } }
public CheckBoxWithMultiImagesText_BingMap() { InitializeComponent(); //为支持GIF图片增加的解码器 Decoders.AddDecoder <GifDecoder>(); }
//--------------------------------------------------------------------------------------------------------- //Alle vorinstallierten Styles wiederherstellen //--------------------------------------------------------------------------------------------------------- private void Restore_Click(object sender, RoutedEventArgs e) { //Abfrage ob wiederhergestellt werden soll if (MessageBox.Show(Lockscreen_Swap.AppResx.Z04_RestoreNote, Lockscreen_Swap.AppResx.Notification, MessageBoxButton.OKCancel) == MessageBoxResult.OK) { //Styles wiederherstellen for (int i = 1; i <= 9; i++) { //Prüfen ob Style vorhanden ist if (!file.FileExists("Styles/000000" + i + ".txt")) { //Style kopieren using (Stream input = Application.GetResourceStream(new Uri("Styles/" + i + ".txt", UriKind.Relative)).Stream) { // Create a stream for the new file in the local folder. using (filestream = file.CreateFile("Styles/000000" + i + ".txt")) { // Initialize the buffer. byte[] readBuffer = new byte[4096]; int bytesRead = -1; // Copy the file from the installation folder to the local folder. while ((bytesRead = input.Read(readBuffer, 0, readBuffer.Length)) > 0) { filestream.Write(readBuffer, 0, bytesRead); } } } //Bilder in Styles Images kppieren var tempImage = new WriteableBitmap(1, 1); //Bild kopieren using (Stream input = Application.GetResourceStream(new Uri("Images/StylesImages/" + i + ".png", UriKind.Relative)).Stream) { // Create a stream for the new file in the local folder. using (filestream = file.CreateFile("StylesImages/000000" + i + ".1.png")) { // Initialize the buffer. byte[] readBuffer = new byte[4096]; int bytesRead = -1; // Copy the file from the installation folder to the local folder. while ((bytesRead = input.Read(readBuffer, 0, readBuffer.Length)) > 0) { filestream.Write(readBuffer, 0, bytesRead); } } } //Bild laden byte[] tempData; MemoryStream tempMs; using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isfs = isf.OpenFile("StylesImages/000000" + i + ".1.png", FileMode.Open, FileAccess.Read)) { tempData = new byte[isfs.Length]; isfs.Read(tempData, 0, tempData.Length); isfs.Close(); } } tempMs = new MemoryStream(tempData); tempImage.SetSource(tempMs); //Bild Spiegeln tempImage = tempImage.Flip(WriteableBitmapExtensions.FlipMode.Vertical); //Bild speichern Decoders.AddDecoder <PngDecoder>(); var img = tempImage.ToImage(); var encoder = new PngEncoder(); using (var stream = new IsolatedStorageFileStream("StylesImages/000000" + i + ".2.png", FileMode.Create, file)) { encoder.Encode(img, stream); stream.Close(); } //Bild Spiegeln tempImage = tempImage.Flip(WriteableBitmapExtensions.FlipMode.Horizontal); //Bild speichern Decoders.AddDecoder <PngDecoder>(); img = tempImage.ToImage(); encoder = new PngEncoder(); using (var stream = new IsolatedStorageFileStream("StylesImages/000000" + i + ".3.png", FileMode.Create, file)) { encoder.Encode(img, stream); stream.Close(); } //Bild Spiegeln tempImage = tempImage.Flip(WriteableBitmapExtensions.FlipMode.Vertical); //Bild speichern Decoders.AddDecoder <PngDecoder>(); img = tempImage.ToImage(); encoder = new PngEncoder(); using (var stream = new IsolatedStorageFileStream("StylesImages/000000" + i + ".4.png", FileMode.Create, file)) { encoder.Encode(img, stream); stream.Close(); } } //Style in InstalledStyles schreiben InstalledStyles += "000000" + i + ".txt;"; InstalledStyles = InstalledStyles.Trim(new char[] { '\r', '\n' }); //Installierte Styles speichern filestream = file.CreateFile("Settings/InstalledStyles.txt"); sw = new StreamWriter(filestream); sw.WriteLine(InstalledStyles); sw.Flush(); filestream.Close(); } //Bilderliste neu erstellen ActionIfSelect = false; try { LBInstalled.SelectedIndex = -1; } catch { } CreateImages(); ActionIfSelect = true; SelectImages(); //Online Styles neu erstellen if (Source != "") { CreateOnlineImages(); } } }
public ScalingGifView() { InitializeComponent(); Decoders.AddDecoder <GifDecoder>(); }