Example #1
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/SmartReaderTest;component/Test/ViewTest.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel")));
     this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle")));
     this.PageTitle = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.GifImageContainer = ((ImageTools.Controls.AnimatedImage)(this.FindName("GifImageContainer")));
 }
Example #2
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Jackson;component/SignPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.GoSignButton = ((System.Windows.Controls.Button)(this.FindName("GoSignButton")));
     this.TiebaList = ((System.Windows.Controls.ListBox)(this.FindName("TiebaList")));
     this.VerifyCodeStack = ((System.Windows.Controls.StackPanel)(this.FindName("VerifyCodeStack")));
     this.VerifyCodeImage = ((ImageTools.Controls.AnimatedImage)(this.FindName("VerifyCodeImage")));
     this.VerifyCode = ((System.Windows.Controls.TextBox)(this.FindName("VerifyCode")));
     this.VerifyCodeConfirmButtom = ((System.Windows.Controls.Button)(this.FindName("VerifyCodeConfirmButtom")));
 }
Example #3
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Jackson;component/SignPage.xaml", System.UriKind.Relative));
     this.LayoutRoot              = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.GoSignButton            = ((System.Windows.Controls.Button)(this.FindName("GoSignButton")));
     this.TiebaList               = ((System.Windows.Controls.ListBox)(this.FindName("TiebaList")));
     this.VerifyCodeStack         = ((System.Windows.Controls.StackPanel)(this.FindName("VerifyCodeStack")));
     this.VerifyCodeImage         = ((ImageTools.Controls.AnimatedImage)(this.FindName("VerifyCodeImage")));
     this.VerifyCode              = ((System.Windows.Controls.TextBox)(this.FindName("VerifyCode")));
     this.VerifyCodeConfirmButtom = ((System.Windows.Controls.Button)(this.FindName("VerifyCodeConfirmButtom")));
 }
Example #4
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/NasaReader;component/RSSFeedsPage.xaml", System.UriKind.Relative));
     this.RSSFeedsPage1     = ((Microsoft.Phone.Controls.PhoneApplicationPage)(this.FindName("RSSFeedsPage1")));
     this.About             = ((Microsoft.Phone.Shell.ApplicationBarIconButton)(this.FindName("About")));
     this.LayoutRoot        = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.StackPanel        = ((System.Windows.Controls.StackPanel)(this.FindName("StackPanel")));
     this.Application_Title = ((System.Windows.Controls.TextBlock)(this.FindName("Application_Title")));
     this.Page_Title        = ((System.Windows.Controls.TextBlock)(this.FindName("Page_Title")));
     this.ContentPanel      = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.Image             = ((ImageTools.Controls.AnimatedImage)(this.FindName("Image")));
 }
Example #5
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/GeoSearch;component/MyControls/CheckBoxWithMultiImagesText_BingMap.xaml", System.UriKind.Relative));
     this.StackPanelArea1     = ((System.Windows.Controls.StackPanel)(this.FindName("StackPanelArea1")));
     this.StackPanel_Icons    = ((System.Windows.Controls.StackPanel)(this.FindName("StackPanel_Icons")));
     this.isSelected_CheckBox = ((System.Windows.Controls.CheckBox)(this.FindName("isSelected_CheckBox")));
     this.Image_NodeType      = ((System.Windows.Controls.Image)(this.FindName("Image_NodeType")));
     this.Image_Animation     = ((System.Windows.Controls.Image)(this.FindName("Image_Animation")));
     this.Image_Legend        = ((System.Windows.Controls.Image)(this.FindName("Image_Legend")));
     this.Title = ((System.Windows.Controls.TextBlock)(this.FindName("Title")));
     this.showCombinedLayer_CheckBox = ((System.Windows.Controls.CheckBox)(this.FindName("showCombinedLayer_CheckBox")));
     this.Image_removeTreeViewItem   = ((System.Windows.Controls.Image)(this.FindName("Image_removeTreeViewItem")));
     this.ScrollViewer_Legend        = ((System.Windows.Controls.ScrollViewer)(this.FindName("ScrollViewer_Legend")));
     this.Image_Legend_Content       = ((System.Windows.Controls.Image)(this.FindName("Image_Legend_Content")));
     this.Image_Legend_GIF_Content   = ((ImageTools.Controls.AnimatedImage)(this.FindName("Image_Legend_GIF_Content")));
 }
        private void BindXamlElements()
        {
            _imageElement = GetTemplateChild(ImagePart) as AnimatedImage;

            _selectionArea = GetTemplateChild(SelectionAreaPart) as FrameworkElement;

            if (_selectionArea != null)
            {
                _selectionArea.MouseLeftButtonDown += new MouseButtonEventHandler(selectionArea_MouseLeftButtonDown);
                _selectionArea.LostMouseCapture    += new MouseEventHandler(selectionArea_LostMouseCapture);
                _selectionArea.MouseMove           += new MouseEventHandler(selectionArea_MouseMove);
            }

            _selectionBorder = GetTemplateChild(SelectionBorderPart) as Border;

            if (_selectionBorder != null)
            {
                _selectionBorder.MouseLeftButtonDown += new MouseButtonEventHandler(selectionBorder_MouseLeftButtonDown);
                _selectionBorder.LostMouseCapture    += new MouseEventHandler(selectionBorder_LostMouseCapture);
                _selectionBorder.MouseMove           += new MouseEventHandler(selectionBorder_MouseMove);
            }

            _scrollViewer = GetTemplateChild(ScrollViewerElementPart) as ScrollViewer;
        }
        private void LoadImageFromStream(Stream imageStream, bool isCached = false)
        {
            bool imageLoaded = false;
            ImagePanel.Children.Clear();
            _bitmap = null;
            _imageControl = null;
            _extImageControl = null;

            if (_dupStream != null)
            {
                _dupStream.Close();
                _dupStream = null;
            }

            if (imageStream != null)
            {
                try
                {
                    Image imageControl = new System.Windows.Controls.Image();

                    _bitmap = new System.Windows.Media.Imaging.BitmapImage();
                    _bitmap.SetSource(imageStream);
                    imageControl.Source = _bitmap;
                    imageControl.DataContext = this;

                    if (_bitmap.PixelHeight > 0)
                    {
                        ImageHeight = _bitmap.PixelHeight;
                    }

                    if (_bitmap.PixelWidth > 0)
                    {
                        ImageWidth = _bitmap.PixelWidth;
                    }

                    imageControl.MaxHeight = MaxImageHeight;
                    imageControl.MaxWidth = MaxImageWidth;

                    imageControl.DataContext = this;

                    CreateButtons();

                    ImagePanel.Children.Add(imageControl);
                    _imageControl = imageControl;

                    if (HandlePinch)
                    {
                        AddGestureHandler(imageControl);
                    }

                    ImagePanel.Height = double.NaN;
                    imageLoaded = true;
                    ImageState = ImageStateType.Loaded;
                }
                catch (Exception)
                {
                    imageLoaded = false;
                    _bitmap = null;
                    _imageControl = null;
                }

                if (!imageLoaded && (imageStream.Length > 200))
                {
                    try
                    {
                        imageStream.Seek(0, System.IO.SeekOrigin.Begin);

                        _dupStream = new MemoryStream();

                        imageStream.CopyTo(_dupStream);
                        _dupStream.Seek(0, System.IO.SeekOrigin.Begin);

                        ImageTools.Controls.AnimatedImage extImageControl = new ImageTools.Controls.AnimatedImage();

                        ImageTools.ExtendedImage image = new ImageTools.ExtendedImage();
                        image.SetSource(_dupStream);
                        extImageControl.Source = image;
                        extImageControl.DataContext = this;

                        if (image.PixelHeight > 0)
                        {
                            ImageHeight = image.PixelHeight;
                        }

                        if (image.PixelWidth > 0)
                        {
                            ImageWidth = image.PixelWidth;
                        }

                        extImageControl.MaxHeight = MaxImageHeight;
                        extImageControl.MaxWidth = MaxImageWidth;

                        extImageControl.DataContext = this;

                        CreateButtons();

                        ImagePanel.Children.Add(extImageControl);
                        _extImageControl = extImageControl;

                        if (HandlePinch)
                        {
                            AddGestureHandler(extImageControl);
                        }

                        ImagePanel.Height = double.NaN;
                        imageLoaded = true;
                        ImageState = ImageStateType.Loaded;
                    }
                    catch (Exception)
                    {

                    }
                }
            }

            if (!imageLoaded)
            {
                if (isCached)
                {
                    imageStream.Close();
                    App.Settings.OfflineContentManager.CleanupOfflineContent(OfflineID, ImageUrl);

                    IsOffline = false;
                    ImageState = ImageStateType.Unloaded;
                    ShowManualLoad();

                    _web = null;

                    if (ImageItemLoaded != null)
                    {
                        ImageItemLoaded(this, null);
                    }
                }
                else
                {
                    ImageState = ImageStateType.Error;

                    if (ShowViewerLink)
                    {
                        ShowViewer();
                    }
                    else
                    {
                        ShowError();
                    }
                }
            }

            _web = null;

            if (ImageItemLoaded != null)
            {
                ImageItemLoaded(this, null);
            }

            if (imageLoaded && !isCached && imageStream != null && CacheImage)
            {
                imageStream.Seek(0, System.IO.SeekOrigin.Begin);
                App.Settings.OfflineContentManager.SaveOfflineContent(OfflineID, ImageUrl, imageStream);
            }
        }