Ejemplo n.º 1
0
        private async Task ExecuteSearchPicturesCommand(string searchTerm)
        {
            Pictures.Clear();
            var pictures = await PicturesDataStore.GetItemsAsync(searchTerm).ConfigureAwait(false);

            Pictures = new ObservableCollection <Picture>(pictures);
        }
        private void Flush(bool all = false)
        {
            passwordOfst   = 0;
            roomNameOfst   = 0;
            artistNameOfst = 0;
            hotspotOfst    = 0;
            pictureOfst    = 0;
            firstLProp     = 0;
            firstDrawCmd   = 0;
            nbrDrawCmds    = 0;
            nbrHotspots    = 0;
            nbrLProps      = 0;
            nbrPictures    = 0;
            base.Clear();

            if (all)
            {
                ID       = 0;
                Name     = null;
                Artist   = null;
                Password = null;
                LooseProps.Clear();
                Pictures.Clear();
                DrawCommands.Clear();
                Hotspots.Clear();
            }
        }
Ejemplo n.º 3
0
        async Task ExecuteLoadTagPicturesCommand(int tagId)
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;

            try
            {
                Pictures.Clear();
                var pictures = await DataStore.GetTaggedPictures(tagId).ConfigureAwait(false);

                foreach (var picture in pictures)
                {
                    Pictures.Add(picture);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 4
0
        async Task ExecuteLoadPicturesCommand()
        {
            if (IsBusy)
            {
                return;
            }
            IsBusy = true;

            try
            {
                Pictures.Clear();
                var pictures = await DataStore.GetItemsAsync().ConfigureAwait(false);

                foreach (var picture in pictures)
                {
                    Pictures.Add(picture);
                }
            }
            catch (Exception ex)
            {
                // To do: implement logging
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 5
0
        private async Task ExectueLoadPicturesCommand()
        {
            Pictures.Clear();
            var pictures = await PicturesDataStore.GetItemsAsync().ConfigureAwait(false);

            Pictures = new ObservableCollection <Picture>(pictures);
        }
Ejemplo n.º 6
0
 private void LimpiarColecciones()
 {
     Application.Current.Dispatcher.Invoke(new Action(() =>
     {
         Pictures.Clear();
     }));
 }
Ejemplo n.º 7
0
        private async Task ExecuteLoadTaggedPicturesCommand(int tagId)
        {
            Pictures.Clear();
            var pictures = await TagsDataStore.GetTaggedPictures(tagId).ConfigureAwait(false);

            Pictures = new ObservableCollection <Picture>(pictures);
        }
Ejemplo n.º 8
0
        private async Task ExecuteLoadAlbumPicturesCommand(int albumId)
        {
            Pictures.Clear();
            var pictures = await AlbumsDataStore.GetAlbumPictures(albumId).ConfigureAwait(false);

            Pictures = new ObservableCollection <Picture>(pictures);
        }
        public async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Pictures.Clear();

                var service         = DependencyService.Get <IRateApplication>();
                var directory       = service.GetStorageDirectory();
                var audioRecordings = System.IO.Path.Combine(directory, "Audio");

                var movies = System.IO.Directory.GetFiles(audioRecordings);
                foreach (var item in movies)
                {
                    var fi = new System.IO.FileInfo(item);

                    var name = fi.Name;
                    if (name.Contains("PocketPro - "))
                    {
                        name = name.Substring(name.IndexOf(" - ") + 3);
                        name = name.Substring(0, name.IndexOf("."));
                        var timestamp = DateTime.TryParseExact(name, "yyyyMMdd_HHmmss", CultureInfo.InvariantCulture, DateTimeStyles.None, out var Date);

                        Pictures.Add(new Media()
                        {
                            Path  = item,
                            Title = fi.Name,
                            Type  = MediaType.Audio,
                            Size  = fi.Length.ToBytesCount(),
                            Date  = Date.ToString("HH:mm tt, MMMM dd")
                        });
                    }
                }

                var items = await Datastores.Pictures.GetItemsAsync(true);

                foreach (var item in items)
                {
                    Pictures.Add(item);
                }

                OnPropertyChanged("NoItems");
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 10
0
 private void clearAllFields()
 {
     _bloodPressure = 0;
     _weight        = 0;
     Date           = DateTime.Now;
     Comment        = "";
     Prescriptions  = "";
     Pictures.Clear();
 }
Ejemplo n.º 11
0
 public void Reset(IPage page)
 {
     Pictures.Clear();
     foreach (var picture in page.Pictures)
     {
         var editablePicture = new EditablePicture();
         editablePicture.Reset(picture);
         Pictures.Add(editablePicture);
     }
     Layout = page.Layout;
 }
Ejemplo n.º 12
0
        private void LoadCardsToBorder()
        {
            Rectangles.Clear();
            Pictures.Clear();
            int widht  = 8;
            int height = 8;

            PexesoService.StartPexeso(height, widht);
            int x   = 2;
            int y   = 2;
            int row = 0;

            foreach (var a in PexesoService.GameCards)
            {
                Canvas.SetLeft(a.Img, x);
                Canvas.SetTop(a.Img, y);
                // Rectangle
                SolidColorBrush pomCo = new SolidColorBrush()
                {
                    Color   = Colors.Black,
                    Opacity = 1
                };
                SolidColorBrush pomCoB = new SolidColorBrush()
                {
                    Color = Colors.BlueViolet
                };
                Rectangle pomR = new Rectangle()
                {
                    Width  = PexesoService.PictureWidth,
                    Height = PexesoService.PictureHeight,
                    Fill   = pomCo,
                    Stroke = pomCoB,
                };
                Canvas.SetLeft(pomR, x);
                Canvas.SetTop(pomR, y);
                Rectangles.Add(pomR);
                Pictures.Add(a.Img);

                a.PositionX = x;
                a.PositionY = y;
                a.Status    = StatusCardEnum.Covered;
                x          += PexesoService.PictureWidth + 5;
                if (Pictures.Count % widht == 0)
                {
                    row++;
                    x  = 2;
                    y += PexesoService.PictureHeight + 5;
                }
                if (row == height)
                {
                    break;
                }
            }
        }
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Pictures.Clear();

                var service         = DependencyService.Get <IRateApplication>();
                var directory       = service.GetStorageDirectory();
                var moviesDirectory = System.IO.Path.Combine(directory, "Movies");

                var movies = System.IO.Directory.GetFiles(moviesDirectory);
                foreach (var item in movies)
                {
                    var fi = new System.IO.FileInfo(item);
                    if (fi.FullName.EndsWith(".mp4"))
                    {
                        Pictures.Add(new Media()
                        {
                            Path      = item,
                            ThumbPath = $"{fi.FullName.Replace(".mp4", String.Empty)}.png",
                            Title     = fi.Name,
                            Type      = MediaType.Picture
                        });
                    }
                }

                var items = await Datastores.Pictures.GetItemsAsync(true);

                foreach (var item in items)
                {
                    Pictures.Add(item);
                }

                OnPropertyChanged("NoItems");
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        ///     Loads the users pictures from the webserver
        /// </summary>
        /// <param name="controller">The controller which Monobehaviour's used in the request</param>
        /// <param name="onComplete">The method to fire when the loading is done</param>
        public void LoadPictures(MonoBehaviour controller, Action <FileProtocolQueue> onComplete = null)
        {
            Pictures.Clear();
            var fileQueue = new FileProtocolQueue(onComplete, www => Pictures.Add(www.texture));

            foreach (var imageName in ImageNames)
            {
                fileQueue.Attach(new FileProtocol(Protocol.Download, controller)
                                 .Target("finder")
                                 .For(ProfileInfo.PlayerUID)
                                 .AddParameter("name", imageName) as FileProtocol);
            }
            fileQueue.Commit();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Start the searching thread in background.
        /// If one was already running, stops it.
        /// </summary>
        private void StartSearch()
        {
            grp_photos.Enabled  = false;
            grp_options.Enabled = false;
            grp_to.Enabled      = false;
            btn_import.Enabled  = false;
            if (bwk_searchPics.IsBusy)
            {
                bwk_searchPics.CancelAsync();
            }
            Pictures.Clear();
            SelectedPictures.Clear();

            bwk_searchPics.RunWorkerAsync();
        }
Ejemplo n.º 16
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Pictures.Clear();
                var service           = DependencyService.Get <IRateApplication>();
                var directory         = service.GetStorageDirectory();
                var picturesDirectory = System.IO.Path.Combine(directory, "Pictures");
                var pictures          = System.IO.Directory.GetFiles(picturesDirectory);
                foreach (var item in pictures)
                {
                    var fi = new System.IO.FileInfo(item);

                    Pictures.Add(new Media()
                    {
                        Path = item, Title = fi.Name, Type = MediaType.Picture
                    });
                }

                var items = await Datastores.Pictures.GetItemsAsync(true);

                foreach (var item in items)
                {
                    Pictures.Add(item);
                }

                OnPropertyChanged("NoItems");
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 17
0
 public void Reset(IPage page)
 {
     Pictures.Clear();
     Pictures.AddRange(page.Pictures.Select(p => new PictureDto(p)));
     Layout = page.Layout;
 }