Beispiel #1
0
        public async Task UpdateQueryAsync()
        {
            var raw = await DatabaseAccessService.GetVirtualfolderImagesWithGroupsAndTags(DatabaseId);

            var currentIds = AllImages.Select(i => i.DatabaseId).ToList();
            var rawCount   = raw.Count;

            for (int i = rawCount - 1; i >= 0; i--)
            {
                for (int j = currentIds.Count - 1; j >= 0; j--)
                {
                    if (raw[i].Id == currentIds[j])
                    {
                        raw.RemoveAt(i);
                        currentIds.RemoveAt(j);
                        break;
                    }
                }
            }

            AllImages.RemoveAll(i => currentIds.Contains(i.DatabaseId));

            foreach (var item in raw)
            {
                AllImages.Add(await ImageItem.FromDatabaseImage(item, viewMode: ImageItem.Options.None));
            }

            ReorderImages();
        }
Beispiel #2
0
 private void ReportProgressForImageSearch(TheImage obj)
 {
     foundImageCount = (foundImageCount + obj.ImageDirTotalImages);
     //TODO : write here invoke required and invoke to display images found count on form
     //if(InvokeRequired)
     //    Invoke(new Action(() => label13.Text = foundImageCount.ToString() + " images found"));
     AllImages.Add(obj);
 }
        public async void UploadFile(object param)
        {
            if (!CrossMedia.Current.IsPickPhotoSupported)
            {
                await Application.Current.MainPage.DisplayAlert("File Not Supported.", "Permission not granted to files.", "STÄNG");

                return;
            }

            var file = await CrossMedia.Current.PickPhotoAsync(new PickMediaOptions
            {
                PhotoSize = PhotoSize.Large,
            });

            if (file != null)
            {
                string[] temp       = file.Path.Split('/');
                string[] tempName   = temp[temp.Length - 1].Split('.');
                string   filename   = tempName[0];
                string   foldername = DateTime.Now.ToString("yyyy-MM-dd") + "/" + DateTime.Now.ToString("H-mm-ss");
                string   filePath   = "Files/NyKvalitetsRapport/" + Application.Current.Properties["CompanyId"].ToString() + "/" + Application.Current.Properties["OfficeId"].ToString() + "/" + foldername + "/" + temp[temp.Length - 1];

                var        content = new MultipartFormDataContent();
                Uri        host    = new Uri("http://www.bisoft.se/Bisoft/receiver.ashx");
                UriBuilder ub      = new UriBuilder(host)
                {
                    Query = string.Format("filename={0}", filePath)
                };

                Stream data = file.GetStream();

                WebClient c = new WebClient();
                c.OpenWriteCompleted += (sender, e) =>
                {
                    PushData(data, e.Result);
                    e.Result.Close();
                    data.Close();

                    if (AllImages == null)
                    {
                        AllImages = new ObservableCollection <QRAttachedFile>();
                    }

                    QRAttachedFile phfile = new QRAttachedFile();
                    phfile.FileName = filename;
                    phfile.FilePath = filePath;
                    phfile.Id       = 0;

                    AllImages.Add(phfile);
                    UpdateUploadedFiles();
                };
                c.OpenWriteAsync(ub.Uri);
            }
            else
            {
                await Application.Current.MainPage.DisplayAlert("File not supported.", "Ingen fil vald.", "STÄNG");
            }
        }
Beispiel #4
0
        public void LoadModel(SectionModel model)
        {
            Title       = model.Title;
            TextContent = model.TextContent;
            ListItems.LodeModel(model.ListItems);
            SectionType = model.Type;

            AllImages.Clear();

            foreach (var imageModel in model.AllImages)
            {
                AllImages.Add(ImageReference.FromModel(imageModel));
            }

            if (AllImages.Count < 0)
            {
                AllImages.Add(new ImageReference());
            }
        }
Beispiel #5
0
 private void DoAddImage()
 {
     AllImages.Add(new ImageReference());
 }