Exemple #1
0
 private void BackToTopTapped(object sender, TappedRoutedEventArgs e)
 {
     if (ImageGridView.Items.Count > 0)
     {
         ImageGridView.ScrollIntoView(ImageGridView.Items[0]);
     }
 }
Exemple #2
0
        private void ItemContainer_Loaded(object sender, RoutedEventArgs e)
        {
            var itemsPanel    = (ItemsWrapGrid)ImageGridView.ItemsPanelRoot;
            var itemContainer = (GridViewItem)sender;
            var itemIndex     = ImageGridView.IndexFromContainer(itemContainer);

            // Don't animate if we're not in the visible viewport
            if (itemIndex >= itemsPanel.FirstVisibleIndex && itemIndex <= itemsPanel.LastVisibleIndex)
            {
                var itemVisual = ElementCompositionPreview.GetElementVisual(itemContainer);
                var delayIndex = itemIndex - itemsPanel.FirstVisibleIndex;

                itemVisual.Opacity = 0f;
                itemVisual.Offset  = new Vector3(50, 0, 0);

                // Create KeyFrameAnimations
                var offsetAnimation = _compositor.CreateScalarKeyFrameAnimation();
                offsetAnimation.InsertExpressionKeyFrame(1f, "0");
                offsetAnimation.Duration  = TimeSpan.FromMilliseconds(700);
                offsetAnimation.DelayTime = TimeSpan.FromMilliseconds((delayIndex * 100));

                var fadeAnimation = _compositor.CreateScalarKeyFrameAnimation();
                fadeAnimation.InsertExpressionKeyFrame(1f, "1");
                fadeAnimation.Duration  = TimeSpan.FromMilliseconds(700);
                fadeAnimation.DelayTime = TimeSpan.FromMilliseconds(delayIndex * 100);

                // Start animations
                itemVisual.StartAnimation("Offset.X", offsetAnimation);
                itemVisual.StartAnimation("Opacity", fadeAnimation);
            }
            itemContainer.Loaded -= ItemContainer_Loaded;
        }
Exemple #3
0
        void PageLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            DataContext = new MainPageViewModel();
            ViewModel   = DataContext as MainPageViewModel;

            ImageGridView.Loaded += (sender3, args3) =>
            {
                ImageGridView.RightTapped += (o, eventArgs) =>
                {
                    eventArgs.Handled = false;
                    var elements  = VisualTreeHelper.FindElementsInHostCoordinates(eventArgs.GetPosition(o as UIElement), ImageGridView);
                    var imageView = elements.First((x) => x.GetType() == typeof(ImageEx)) as ImageEx;
                    Debug.WriteLine("imageView is " + imageView);
                    ViewModel.ImageContextOpened = imageView.DataContext as FullImageViewModel;
                };
            };

            if (ImageGridView.Items?.Count > 0 && GlobalInfo.SelectedImage > 0 && GlobalInfo.SelectedImage <= ImageGridView.Items.Count - 1)
            {
                ImageGridView.ScrollIntoView(ImageGridView.Items[GlobalInfo.SelectedImage]);
            }

            Debug.WriteLine("Image count in gridview is  " + ImageGridView.Items.Count);
            Debug.WriteLine("Image count in GlobalInfo is  " + GlobalInfo.CurrentSearch.Count);
            Debug.WriteLine("Image count in GlobalInfo ViewModels is  " + GlobalInfo.ImageViewModels.Count);
        }
Exemple #4
0
        private void ImageGridView_Loaded(object sender, RoutedEventArgs e)
        {
            var scrollViewer = ImageGridView.GetScrollViewer();

            scrollViewer.ViewChanging -= ScrollViewer_ViewChanging;
            scrollViewer.ViewChanging += ScrollViewer_ViewChanging;
        }
Exemple #5
0
        private void ImageGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            // Prepare the connected animation for navigation to the detail page.
            persistedItem = e.ClickedItem as ImageFileInfo;
            ImageGridView.PrepareConnectedAnimation("itemAnimation", e.ClickedItem, "ItemImage");

            this.Frame.Navigate(typeof(DetailPage), e.ClickedItem);
        }
Exemple #6
0
 // Called by the Loaded event of the ImageGridView.
 private async void StartConnectedAnimationForBackNavigation()
 {
     // Run the connected animation for navigation back to the main page from the detail page.
     if (persistedItem != null)
     {
         ImageGridView.ScrollIntoView(persistedItem);
         ConnectedAnimation animation = ConnectedAnimationService.GetForCurrentView().GetAnimation("backAnimation");
         if (animation != null)
         {
             await ImageGridView.TryStartConnectedAnimationAsync(animation, persistedItem, "ItemImage");
         }
     }
 }
Exemple #7
0
    private void LoadFiles(DirectoryInfo info)
    {
        var files = info.GetFiles();

        if (files != null)
        {
            imagefiles = files;
            foreach (var item in files)
            {
                ImageGridView.DataSource = files;
                ImageGridView.DataBind();
            }
        }
    }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            var id = e.Parameter;

            _adventure = await DataProvider.Instance.GetAdventure(id as string);

            AdventureNameText.Text = _adventure.Name.ToUpper();
            if (_adventure.User != null)
            {
                UserImage.ImageSource = new BitmapImage(new Uri(_adventure.User.Image));
            }

            for (var i = _adventure.Photos.Count - 1; i > -1; --i)
            {
                _photos.Add(_adventure.Photos[i]);
            }

            if (_photos.Count > 0)
            {
                var randomPhoto = _photos[new Random().Next(0, _photos.Count)];
                BackgroundImage.ImageSource = await GetBitmapImage(randomPhoto.Uri, randomPhoto.IsLocal);
            }
            else
            {
                // show someting
            }

            if (App.IsXbox())
            {
                ImageGridView.FindDescendant <GridViewItem>()?.Focus(FocusState.Keyboard);
            }
            else if (ConnectedService.Instance.Rome != null)
            {
                if (App.IsMobile())
                {
                    FindName("BottomConnectButton");
                    BottomRemoteSystemsList.ItemsSource = Rome.ConnectedService.Instance.Rome.AvailableRemoteSystems;
                    _flyout = BottomFlyout;
                }
                else
                {
                    FindName("ConnectButton");
                    RemoteSystemsList.ItemsSource = Rome.ConnectedService.Instance.Rome.AvailableRemoteSystems;
                    _flyout = Flyout;
                }
            }

            base.OnNavigatedTo(e);
        }
Exemple #9
0
        private void ImageGridView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                //get selected ImageGrid item and convert to LocationPin
                LocationPin loc = (ImageGridView.SelectedItem) as LocationPin;

                //move the slider along
                CheckPointSlider.Value = this.ViewModel.MileStoneLocations.IndexOf(loc);

                ImageGridView.ScrollIntoView(loc, ScrollIntoViewAlignment.Leading);
            }
            catch (Exception ex)
            {
            }
        }
        private void ImageGridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var item      = e.ClickedItem;
            var container = ImageGridView.ContainerFromItem(item) as FrameworkElement;
            var rootGrid  = (container as GridViewItem).ContentTemplateRoot as Grid;

            Canvas.SetZIndex(container, ++_zindex);

            _containerVisual = ElementCompositionPreview.GetElementVisual(container);

            var unsplashImg = item as UnsplashImageBase;

            var maskBorder = rootGrid.Children[2] as FrameworkElement;
            var img        = rootGrid.Children[1] as FrameworkElement;

            ToggleItemPointAnimation(maskBorder, img, false);

            OnClickItemStarted?.Invoke(unsplashImg, container);
        }
Exemple #11
0
        private async Task TapItemAsync(ImageItem image)
        {
            if (!(await CheckListImageDownloadedAsync(image)))
            {
                return;
            }

            _tappedContainer = ImageGridView.ContainerFromItem(image) as GridViewItem;

            var rootGrid = _tappedContainer.ContentTemplateRoot as Grid;

            _tappedContainerVisual = ElementCompositionPreview.GetElementVisual(_tappedContainer);

            var maskBorder = rootGrid.Children[2] as FrameworkElement;
            var img        = rootGrid.Children[1] as FrameworkElement;

            ToggleItemPointOverAnimation(maskBorder, img, false);

            OnClickItemStarted?.Invoke(image, rootGrid);
        }
Exemple #12
0
        private void TapItem(UnsplashImageBase image)
        {
            if (string.IsNullOrEmpty(image.ListImageBitmap.LocalPath))
            {
                return;
            }

            var container = ImageGridView.ContainerFromItem(image) as FrameworkElement;
            var rootGrid  = (container as GridViewItem).ContentTemplateRoot as Grid;

            Canvas.SetZIndex(container, ++_zindex);

            _containerVisual = ElementCompositionPreview.GetElementVisual(container);

            var maskBorder = rootGrid.Children[2] as FrameworkElement;
            var img        = rootGrid.Children[1] as FrameworkElement;

            ToggleItemPointAnimation(maskBorder, img, false);

            OnClickItemStarted?.Invoke(image, container);
        }
Exemple #13
0
        public static Task <Control> Get(ProgressWorker a1, SynchronizationContext context, Window window, bool npc)
        {
            var source = new TaskCompletionSource <Control>();

            context.Send(obj => {
                var control = new ImageGridView();
                var t       = new Thread(() => {
                    if (!(obj is Tuple <ProgressWorker, TaskCompletionSource <Control> > tuple))
                    {
                        return;
                    }
                    var worker = tuple.Item1;
                    var tcs    = tuple.Item2;
                    try {
                        var i = 0;
                        worker.ReportProgress(0, "Loading heroes...");
                        if (TrackedFiles == null || !TrackedFiles.ContainsKey(0x75))
                        {
                            throw new DataToolWpfException("Open storage first");
                        }

                        var max = TrackedFiles[0x75].Count;

                        foreach (var key in TrackedFiles[0x75])
                        {
                            try {
                                var hero = GetInstance <STUHero>(key);
                                if (hero == null)
                                {
                                    continue;
                                }
                                string heroNameActual = GetString(hero.m_0EDCE350) ?? teResourceGUID.Index(key).ToString("X");

                                heroNameActual = heroNameActual.TrimEnd(' ');

                                ProgressionUnlocks progressionUnlocks = new ProgressionUnlocks(hero);
                                if (progressionUnlocks.LevelUnlocks == null && !npc)
                                {
                                    continue;
                                }
                                if (progressionUnlocks.LootBoxesUnlocks != null && npc)
                                {
                                    continue;
                                }

                                var tex = hero.m_8203BFE1.FirstOrDefault(x => teResourceGUID.Index(x.m_id) == 0x40C9 || teResourceGUID.Index(x.m_id) == 0x40CA)?.m_texture;

                                if (tex == 0)
                                {
                                    tex = hero.m_8203BFE1.FirstOrDefault()?.m_texture;
                                }

                                var image = new byte[] { };

                                var width  = 128;
                                var height = 128;

                                if (tex != 0)
                                {
                                    teTexture texture = new teTexture(OpenFile(tex));
                                    if (texture.PayloadRequired)
                                    {
                                        ulong payload        = texture.GetPayloadGUID(tex);
                                        Stream payloadStream = OpenFile(payload);
                                        if (payloadStream != null)
                                        {
                                            texture.LoadPayload(payloadStream);
                                        }
                                        else
                                        {
                                            continue;
                                        }
                                    }

                                    width  = texture.Header.Width;
                                    height = texture.Header.Height;

                                    Stream ms = texture.SaveToDDS();

                                    image = DDSConverter.ConvertDDS(ms, DXGI_FORMAT.R8G8B8A8_UNORM, DDSConverter.ImageFormat.PNG, 0);
                                }

                                var entry      = control.Add(heroNameActual, image, 128, (int)ImagingHelper.CalculateSizeAS(height, width, 128));
                                entry.Payload  = progressionUnlocks;
                                entry.OnClick += (sender, args) => {
                                    window.Close();
                                };
                            } catch {
                                // ignored
                            } finally {
                                i += 1;
                                worker.ReportProgress((int)(i / (float)max * 100));
                            }
                        }

                        tcs.SetResult(control);
                    } catch (Exception e) {
                        tcs.SetException(e);
                    } finally {
                        worker.ReportProgress(100);
                    }
                });
                t.SetApartmentState(ApartmentState.STA);
                t.Start();
            }, new Tuple <ProgressWorker, TaskCompletionSource <Control> >(a1, source));
            return(source.Task);
        }
 private void SelectAll_Click(object sender, RoutedEventArgs e)
 {
     ImageGridView.SelectAll();
     SelMos = 0;
     MuestraInfo();
 }
Exemple #15
0
 public void SmoothScrollToPosition(double y)
 {
     ImageGridView.GetScrollViewer().ChangeView(null, y, null, false);
 }
Exemple #16
0
 public void ScrollToTop()
 {
     ImageGridView.GetScrollViewer().ChangeView(null, 0, null);
 }
        private void StudentFullDetailsForm_Load(object sender, EventArgs e)
        {
            int BoundsWidth  = Screen.PrimaryScreen.Bounds.Width;
            int BoundsHeight = Screen.PrimaryScreen.Bounds.Height;
            int X_Coordinate = BoundsWidth - this.Width;
            int Y_Coordinate = BoundsHeight - this.Height;

            Location = new Point(X_Coordinate / 2, (Y_Coordinate / 2) + 26);
            ImageGridView.Select();

            //EXCEPTION 1
            try
            {
                variables           = new Variables();
                opacityform         = new OpacityForm();
                cryptography        = new Cryptography();
                sqlconnectionconfig = new SQLConnectionConfig();

                RegistryKey registrykey = Registry.CurrentUser.OpenSubKey(@variables.pathname);
                string      tempdata    = registrykey.GetValue("SQLServerConnectionString").ToString();

                //USER SQLSERVER CONNECTION SETTINGS
                sqlconnectionconfig.SqlConnectionString = cryptography.Decrypt(tempdata);
                sqlconnection = new SqlConnection(sqlconnectionconfig.SqlConnectionString);
                sqlconnection.Open();

                //INNER EXCEPTION 1
                try
                {
                    //RETRIEVE ACCOUNT PICTURE
                    Retrieve_Account_Picture();

                    //RETRIEVE PERSONAL INFORMATION
                    Retrieve_Student_Personal_Info();

                    //RETRIEVE FAMILY BACKGROUND INFORMATION
                    Retrieve_Family_Background_Info();

                    //RETRIEVE ACCOUNT INFORMATION
                    Retrieve_Account_Info();
                }

                catch (Exception exception)
                {
                    opacityform.Show();
                    MessageBox.Show(exception.Message.ToString(), "@Student Details Form Inner Exception 1",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);

                    opacityform.Hide();
                }
            }

            catch (Exception exception)
            {
                opacityform.Show();
                MessageBox.Show(exception.Message.ToString(), "@Student Details Form Exception 1",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                opacityform.Hide();
            }
        }
Exemple #18
0
 public ImageListControl()
 {
     this.InitializeComponent();
     this._compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;
     this._listVisual = ImageGridView.GetVisual();
 }
Exemple #19
0
 public ImageListControl()
 {
     this.InitializeComponent();
     this._compositor = this.GetVisual().Compositor;
     this._listVisual = ImageGridView.GetVisual();
 }