瀏覽代碼

Cleaned Up Image Rotation and Handling Code

Frank van den Bos 1 年之前
父節點
當前提交
c9723c459e

+ 1 - 2
prs.mobile.new/PRS.Mobile.Droid/MainActivity.cs

@@ -65,8 +65,7 @@ namespace PRS.Mobile.Droid
             
             AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
             TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;
-                    
-                    
+            
             if (!string.IsNullOrWhiteSpace(Intent?.Data?.EncodedAuthority))
             {
                 string s = Intent?.Data?.Path ?? "";

+ 3 - 3
prs.mobile.new/PRS.Mobile/Components/DigitalForms/Editor/Views/DigitalFormEmbeddedImage.cs

@@ -21,8 +21,8 @@ namespace PRS.Mobile
 
         private void RotateImage()
         {
-            _value.Thumbnail = MobileUtils.RotateImage(_value.Thumbnail);
-            _value.Data = MobileUtils.RotateImage(_value.Data);
+            _value.Thumbnail = MobileUtils.ImageTools.RotateImage(_value.Thumbnail, 90F, 100);
+            _value.Data = MobileUtils.ImageTools.RotateImage(_value.Data, 90F, 100);
             UpdateUI();
         }
         
@@ -40,7 +40,7 @@ namespace PRS.Mobile
 
         protected override void SetValue(Guid value) => _value.ID = value;
         
-        protected override byte[] CreateThumbnail(byte[] data, float maxwidth = 200, float maxheight=200)
+        protected override byte[] CreateThumbnail(byte[] data, int maxwidth = 256, int maxheight=256)
         {
             return MobileUtils.ImageTools.CreateThumbnail(data, maxwidth, maxheight);
         }

+ 1 - 1
prs.mobile.new/PRS.Mobile/Components/DigitalForms/Editor/Views/DigitalFormEmbeddedMedia.cs

@@ -66,7 +66,7 @@ namespace PRS.Mobile
             Children.Add(_button);
         }
         
-        protected abstract byte[] CreateThumbnail(byte[] data, float maxwidth = 200, float maxheight = 200);
+        protected abstract byte[] CreateThumbnail(byte[] data, int maxwidth = 256, int maxheight = 256);
 
         protected void UpdateUI()
         {

+ 1 - 1
prs.mobile.new/PRS.Mobile/Components/DigitalForms/Editor/Views/DigitalFormEmbeddedVideo.cs

@@ -29,7 +29,7 @@ namespace PRS.Mobile
 
         protected override void SetValue(byte[] value) => _value.Thumbnail = value;
         
-        protected override byte[] CreateThumbnail(byte[] data, float maxwidth = 200, float maxheight=200)
+        protected override byte[] CreateThumbnail(byte[] data, int maxwidth = 256, int maxheight=256)
         {
             return MobileUtils.ImageTools.CreateVideoThumbnail(data, maxwidth, maxheight);
         }

+ 3 - 3
prs.mobile.new/PRS.Mobile/Components/DigitalForms/Editor/Views/DigitalFormMultiImage.cs

@@ -64,7 +64,7 @@ namespace PRS.Mobile
             foreach (var val in _value)
             {
                 if ((val.Thumbnail?.Any() != true) && (val.Data?.Any() == true))
-                    val.Thumbnail = MobileUtils.ImageTools.CreateThumbnail(val.Data, 200, 200);
+                    val.Thumbnail = MobileUtils.ImageTools.CreateThumbnail(val.Data, 256, 256);
             }
             DoUpdateUI();
         }
@@ -155,7 +155,7 @@ namespace PRS.Mobile
                     DFLayoutEmbeddedMediaValue val = new DFLayoutEmbeddedMediaValue()
                     {
                         Data = doc.Data,
-                        Thumbnail = MobileUtils.ImageTools.CreateThumbnail(doc.Data, 200, 200)
+                        Thumbnail = MobileUtils.ImageTools.CreateThumbnail(doc.Data, 256, 256)
                     };
                     _value.Add(val);
                     Device.BeginInvokeOnMainThread(DoUpdateUI);
@@ -182,7 +182,7 @@ namespace PRS.Mobile
                     DFLayoutEmbeddedMediaValue val = new DFLayoutEmbeddedMediaValue()
                     {
                         Data = doc.Data,
-                        Thumbnail = MobileUtils.ImageTools.CreateThumbnail(doc.Data, 200, 200)
+                        Thumbnail = MobileUtils.ImageTools.CreateThumbnail(doc.Data, 256, 256)
                     };
                     _value.Add(val);
                     Device.BeginInvokeOnMainThread(DoUpdateUI);

+ 1 - 1
prs.mobile.new/PRS.Mobile/CustomControls/ImageViewer/ImageViewerPage.xaml.cs

@@ -82,7 +82,7 @@ namespace PRS.Mobile
         {
             if (_doc == null)
                 return;
-            _doc.Data = MobileUtils.RotateImage(_doc.Data);
+            _doc.Data = MobileUtils.ImageTools.RotateImage(_doc.Data,90F,100);
             _doc.CRC = CoreUtils.CalculateCRC(_doc.Data);
             var msg = "Image Rotated on Mobile Device";
             new Client<Document>().Save(_doc, msg);

+ 4 - 3
prs.mobile.new/PRS.Mobile/Main/PINLoginPage.xaml.cs

@@ -197,11 +197,12 @@ namespace PRS.Mobile
                     {
                         var urls = comps.First().Split(',').Where(x => x != "").ToArray();
                         var settings = comps.Last().Split(',').Where(x => x != "").ToArray();
-                        if (urls.Any() && (settings.Length == 3))
+                        if (urls.Any() && (settings.Length > 3))
                         {
                             String user = settings[0];
                             String password = settings[1];
                             DateTime expiry = DateTime.Parse(settings[2]);
+                            var profilename = settings.Length > 3 ? settings[3] : "Default Profile";
                             if (expiry > DateTime.Now)
                             {
                                 _default = new MobileDatabaseSettings();
@@ -211,8 +212,8 @@ namespace PRS.Mobile
                                 _default.IsDefault = true;
                                 _default.CacheID = Guid.NewGuid();
                                 _settings.Clear();
-                                _settings["Autoconfigured"] = _default;
-                                new LocalConfiguration<MobileDatabaseSettings>().SaveAll(_settings);
+                                _settings[profilename] = _default;
+                                new LocalConfiguration<MobileDatabaseSettings>().SaveAll(_settings, true);
                                 DisplayAlert("Autoconfiguration", "Configuration Updated Successfully!!", "OK");
                             }
                             else