diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.Android/LogisticsMgrMobile.Android.csproj b/LogisticsMgrMobile/LogisticsMgrMobile.Android/LogisticsMgrMobile.Android.csproj index a158e91..a2cc060 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile.Android/LogisticsMgrMobile.Android.csproj +++ b/LogisticsMgrMobile/LogisticsMgrMobile.Android/LogisticsMgrMobile.Android.csproj @@ -64,6 +64,7 @@ + diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Mobile/Droid/Forms/Views/SlmWebViewRenderer.cs b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Mobile/Droid/Forms/Views/SlmWebViewRenderer.cs new file mode 100644 index 0000000..663d2ff --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Mobile/Droid/Forms/Views/SlmWebViewRenderer.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Android.App; +using Android.Content; +using Android.OS; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Sarand.Core.Base; +using Xamarin.Forms; +using Xamarin.Forms.Platform.Android; + +[assembly: ExportRenderer(typeof(WebView), typeof(Sarand.LogisticsMgr.Mobile.Droid.Forms.Views.SlmWebViewRenderer))] +namespace Sarand.LogisticsMgr.Mobile.Droid.Forms.Views +{ + //======================================================================= + /// + /// Rerplacement Web View Renderer to enable/override default behaviour. + /// 1. Enable scrcolling within Scroll View etc. + /// Ref. https://forums.xamarin.com/discussion/54365/android-enabling-scrolling-for-a-webview-inside-a-scrollview + /// + public class SlmWebViewRenderer : WebViewRenderer + { + //------------------------------------------------------------------- + // Construction. + public SlmWebViewRenderer (Context context) : base(context) + { + Logger.Trace(GetType().Name + " CTR"); + } + + //------------------------------------------------------------------- + protected override void OnElementChanged (ElementChangedEventArgs e) + { + base.OnElementChanged(e); + if (e.OldElement != null) + { + Control.Touch -= Control_Touch; + } + if (e.NewElement != null) + { + Control.Touch += Control_Touch; + } + } + + //------------------------------------------------------------------- + void Control_Touch (object sender, Android.Views.View.TouchEventArgs e) + { + // Executing this will prevent the Scrolling to be intercepted by parent views. + switch (e.Event.Action) + { + case MotionEventActions.Down: + Control.Parent.RequestDisallowInterceptTouchEvent(true); + break; + case MotionEventActions.Up: + Control.Parent.RequestDisallowInterceptTouchEvent(false); + break; + } + // Calling this will allow the scrolling event to be executed in the WebView. + Control.OnTouchEvent(e.Event); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} \ No newline at end of file diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Properties/AndroidManifest.xml b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Properties/AndroidManifest.xml index 2262671..5ccef57 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile.Android/Properties/AndroidManifest.xml +++ b/LogisticsMgrMobile/LogisticsMgrMobile.Android/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.UWP/LogisticsMgrMobile.UWP.csproj b/LogisticsMgrMobile/LogisticsMgrMobile.UWP/LogisticsMgrMobile.UWP.csproj index 1757b0a..cd4d4e0 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile.UWP/LogisticsMgrMobile.UWP.csproj +++ b/LogisticsMgrMobile/LogisticsMgrMobile.UWP/LogisticsMgrMobile.UWP.csproj @@ -144,7 +144,7 @@ - 1.1.0 + 1.2.0 diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.iOS/Info.plist b/LogisticsMgrMobile/LogisticsMgrMobile.iOS/Info.plist index 17545d7..634ca4e 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile.iOS/Info.plist +++ b/LogisticsMgrMobile/LogisticsMgrMobile.iOS/Info.plist @@ -2,37 +2,38 @@ - UIDeviceFamily - - 1 - 2 - - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - UISupportedInterfaceOrientations~ipad - - UIInterfaceOrientationPortrait - UIInterfaceOrientationPortraitUpsideDown - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - - MinimumOSVersion - 8.0 - CFBundleDisplayName - LogisticsMgrMobile - CFBundleIdentifier - com.companyname.LogisticsMgrMobile - CFBundleVersion - 1.0 - UILaunchStoryboardName - LaunchScreen - CFBundleName - LogisticsMgrMobile - XSAppIconAssets - Assets.xcassets/AppIcon.appiconset + UIDeviceFamily + + 1 + 2 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + MinimumOSVersion + 8.0 + CFBundleDisplayName + LogisticsMgrMobile + CFBundleIdentifier + com.companyname.LogisticsMgrMobile + CFBundleVersion + 1.0 + UILaunchStoryboardName + LaunchScreen + CFBundleName + LogisticsMgrMobile + XSAppIconAssets + Assets.xcassets/AppIcon.appiconset diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.iOS/LogisticsMgrMobile.iOS.csproj b/LogisticsMgrMobile/LogisticsMgrMobile.iOS/LogisticsMgrMobile.iOS.csproj index eb151b4..4f940c0 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile.iOS/LogisticsMgrMobile.iOS.csproj +++ b/LogisticsMgrMobile/LogisticsMgrMobile.iOS/LogisticsMgrMobile.iOS.csproj @@ -89,6 +89,9 @@ iPhone Distribution Entitlements.plist + + + @@ -149,7 +152,7 @@ - 1.1.0 + 1.2.0 diff --git a/LogisticsMgrMobile/LogisticsMgrMobile.iOS/Properties/AssemblyInfo.cs b/LogisticsMgrMobile/LogisticsMgrMobile.iOS/Properties/AssemblyInfo.cs index 4b20d87..651543e 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile.iOS/Properties/AssemblyInfo.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile.iOS/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LogisticsMgrMobile.iOS")] -[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyCopyright("Copyright © Sarand 2014-2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/LogisticsMgrMobile.csproj b/LogisticsMgrMobile/LogisticsMgrMobile/LogisticsMgrMobile.csproj index 398ad75..6947f92 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/LogisticsMgrMobile.csproj +++ b/LogisticsMgrMobile/LogisticsMgrMobile/LogisticsMgrMobile.csproj @@ -11,7 +11,7 @@ - + diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/App.xaml.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/App.xaml.cs index 225e8a0..df84e11 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/App.xaml.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/App.xaml.cs @@ -99,7 +99,8 @@ namespace Sarand.LogisticsMgr.Mobile.App sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN [IP4 int]", "http://10.1.4.13:34567/SaLogMgr")); sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN [IP6 int]", "http://[fe80:f4c9:7720:45d8:f1b0]:34567/SaLogMgr")); sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN - dev [403-IP6]", "http://[2a00:23c4:1b29:cc00:f14f:66b9:c098:242d]:34567/SaLogMgr")); - if (false/*allowLgp*/) + bool allowLgp = false; + if (allowLgp) { sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP", "http://SS-APP-LG1:34568/SaLogMgr")); sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP [IP4 int]", "http://10.1.20.12:34568/SaLogMgr")); diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMainPage.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMainPage.cs index bf20456..2500f06 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMainPage.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/App/SlmMainPage.cs @@ -1,10 +1,6 @@ using Sarand.Core.Base; -using Sarand.Core.Mobile.Forms.Controls; -using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Forms.Components; -using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates; using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main; using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetMovement.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetMovement.cs index 10e16d5..cc5ab9e 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetMovement.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetMovement.cs @@ -1,11 +1,9 @@ using Sarand.Core.Base; -using Sarand.Core.Mobile.Forms.Utils; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; using System; using System.Collections.Generic; using System.Text; @@ -89,11 +87,15 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Assets public void PopulateToControls (SlmContainer.Data data) { EntryAssetCode.Text = data.Code; + if (!StringUtil.IsEmpty(data.SizeCode) && !PickerAssetSize.ContainsCode(data.SizeCode)) + PickerAssetSize.AddItem(data.SizeCode, data.SizeCode); PickerAssetSize.SelectedCode= data.SizeCode; Changed = false; } public void PopulateToControls (SlmAssetMovement.Data data) { + if (!StringUtil.IsEmpty(data.AssetSizeCode) && !PickerAssetSize.ContainsCode(data.AssetSizeCode)) + PickerAssetSize.AddItem(data.AssetSizeCode, data.AssetSizeCode); PickerAssetSize.SelectedCode = data.AssetSizeCode; PickerMovementType.SelectedCode = movementTypes.GetCodeForType((int)data.MovementType); EntryReference.Text = data.MovementRef; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepair.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepair.cs index ccf4fcd..2ccf06b 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepair.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepair.cs @@ -2,10 +2,9 @@ using Sarand.Core.Mobile.Forms.Utils; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; using System; using System.Collections.Generic; using System.Text; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepairImage.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepairImage.cs index 31e45a7..5029071 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepairImage.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepairImage.cs @@ -1,7 +1,7 @@ using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; using System; using System.Collections.Generic; using System.Text; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepairJob.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepairJob.cs index 573cd15..b3ab92f 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepairJob.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Assets/SlmComponents_AssetRepairJob.cs @@ -2,9 +2,8 @@ using Sarand.Core.Mobile.Forms.Controls; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; using System; using System.Collections.Generic; using System.Text; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Bulk/SlmComponents_Berthing.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Bulk/SlmComponents_Berthing.cs index 8a9efd9..1414863 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Bulk/SlmComponents_Berthing.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Bulk/SlmComponents_Berthing.cs @@ -1,10 +1,7 @@ -using Sarand.Core.Base; -using Sarand.LogisticsMgr.Core.App; -using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Mobile.App; +using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; using System; using System.Collections.Generic; using System.Text; @@ -28,6 +25,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk //------------------------------------------------------------------- // Properties. + // Controls. // Vessel. public SlmPickerView PickerVessel { get; } = new SlmPickerView() { LabelText = "Vessel", ReadOnly = true }; // Berthing. @@ -63,6 +61,12 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk } public void PopulateToControls (SlmBerthing.Data data) { + // Vessel. + PickerVessel.SelectedItemId = data.VesselId; + // Companies. + PickerAgent.SelectedItemId = data.CompanyIdAgent; + PickerCustomer.SelectedItemId = data.CompanyIdCustomer; + // Common properties. EditorNotes.Text = data.Notes; Changed = false; } diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Bulk/SlmComponents_BerthingTask.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Bulk/SlmComponents_BerthingTask.cs index 3d862fd..0fc5edb 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Bulk/SlmComponents_BerthingTask.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/Bulk/SlmComponents_BerthingTask.cs @@ -1,9 +1,10 @@ using Sarand.Core.Base; +using Sarand.Core.Mobile.Tasks; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; using System; using System.Collections.Generic; using System.Text; @@ -21,7 +22,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk //------------------------------------------------------------------- // Construction. - public SlmComponents_BerthingTask() + public SlmComponents_BerthingTask () { berthingTaskTypes = SlmSystem.GetCodesOfType(Slm.SystemCode.BerthingTaskType); InitialiseComponents(); @@ -31,8 +32,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk // Properties. // Controls. public SlmPickerView_SystemCodes PickerTaskType { get; } = new SlmPickerView_SystemCodes(Slm.SystemCode.BerthingTaskType) { LabelText = "Task type" }; - public SlmDatePickerView DatePickerStarted { get; } = new SlmDatePickerView() { LabelText = "Started" }; - public SlmDatePickerView DatePickerCompleted { get; } = new SlmDatePickerView() { LabelText = "Completed" }; + public SlmDateTimePickerView DatePickerStarted { get; } = new SlmDateTimePickerView() { LabelText = "Started" }; + public SlmDateTimePickerView DatePickerCompleted { get; } = new SlmDateTimePickerView() { LabelText = "Completed" }; public SlmEditorView EntryRemarks { get; } = new SlmEditorView() { LabelText = "Remarks" }; //------------------------------------------------------------------- @@ -43,7 +44,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk //------------------------------------------------------------------- private void InitialiseComponents () { - // Filename. + // Started. + DatePickerStarted.DateTime = DateUtil.RoundTime(DateTime.Now, 15, DateUtil.RoundingDirection.Nearest); + + // Completed. + DatePickerCompleted.DateTime = DateUtil.RoundTime(DateTime.Now, 15, DateUtil.RoundingDirection.Nearest); + + // Remarks. EntryRemarks.MaxLength = (int)SlmDbDfn.GetColTextLen(SlmDbDfn.ColumnIdx.BerthingTask_Remarks); EntryRemarks.TextChanged += EntryRemarks_TextChanged; EntryRemarks.Completed += EntryRemarks_Completed; @@ -57,21 +64,37 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk public void PopulateToControls (SlmBerthingTask.Data data) { PickerTaskType.SelectedCode = berthingTaskTypes.GetCodeForType((int)data.BerthingTaskType); - DatePickerStarted.Date = data.Started; - DatePickerCompleted.Date = data.Completed; + DatePickerStarted.DateTime = data.Started; + DatePickerCompleted.DateTime = data.Completed; EntryRemarks.Text = data.Remarks; Changed = false; } public bool IsDataValid (SlmBerthingTask.Data data) { + if ((int)data.BerthingTaskType < 1) + { + DisplayAlert("Berthing Task", "Task type must be selected.", "OK"); + //EntryRemarks.Focus(); + return false; + } + if (StringUtil.IsEmpty(data.Remarks)) + { + DisplayAlert("Berthing Task", "Remarks must be entered.", "OK"); + //EntryRemarks.Focus(); + return false; + } return true; } public void PopulateFromControls (SlmBerthingTask.Data data) { - data.BerthingTaskType = (Slm.BerthingTaskType)berthingTaskTypes.GetTypeForCode(PickerTaskType.SelectedCode); - data.Started = DatePickerStarted.Date; - data.Completed = DatePickerCompleted.Date; - data.Remarks = EntryRemarks.Text; + if (PickerTaskType.Parent != null && PickerTaskType.IsVisible && !PickerTaskType.ReadOnly) + data.BerthingTaskType = (Slm.BerthingTaskType)berthingTaskTypes.GetTypeForCode(PickerTaskType.SelectedCode); + if (DatePickerStarted.Parent != null && DatePickerStarted.IsVisible && !DatePickerStarted.ReadOnly) + data.Started = DatePickerStarted.DateTime; + if (DatePickerCompleted.Parent != null && DatePickerCompleted.IsVisible && !DatePickerCompleted.ReadOnly) + data.Completed = DatePickerCompleted.DateTime; + if (EntryRemarks.Parent != null && EntryRemarks.IsVisible && !EntryRemarks.ReadOnly) + data.Remarks = EntryRemarks.Text; } //------------------------------------------------------------------- diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Config.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Config.cs index 1345e99..8515d94 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Config.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Config.cs @@ -1,9 +1,8 @@ using Sarand.Core.Base; -using Sarand.LogisticsMgr.Core.App; -using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; using System; using System.Collections.Generic; using System.Text; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Login.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Login.cs index fdc2671..70f4644 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Login.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Components/SlmComponents_Login.cs @@ -1,9 +1,8 @@ using Sarand.Core.Base; -using Sarand.LogisticsMgr.Core.App; -using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; using System; using System.Collections.Generic; using System.Text; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_Options.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_Options.cs index aa3dc34..34e9baf 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_Options.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_Options.cs @@ -1,11 +1,10 @@ using Sarand.Core.Base; -using Sarand.Core.Net; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Data; using Sarand.LogisticsMgr.Core.WebService; -using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Components; using System; using System.Collections.Generic; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_System.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_System.cs index 302196d..fb4e1e9 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_System.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Config/SlmPage_Config_System.cs @@ -1,6 +1,8 @@ using Sarand.Core.Base; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using System.Collections.Generic; using Xamarin.Essentials; using Xamarin.Forms; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_Movement.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_Movement.cs index b55421d..d31bcc4 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_Movement.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_Movement.cs @@ -4,7 +4,10 @@ using Sarand.Core.Bus; using Sarand.Core.Tasks; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets; using System; using System.Collections.Generic; @@ -148,46 +151,48 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets { // Asset Repair form. FormBodyView.Content = gridProperties; + gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing; + gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing; gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); //--------------------------------------------------------------- // Asset. - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryAssetCode); - AddControlViewToGrid(gridProperties, assetMovementComponents.PickerAssetSize); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryAssetCode); + gridProperties.AddControlViewToGrid(assetMovementComponents.PickerAssetSize); // Movement. - AddControlViewToGrid(gridProperties, assetMovementComponents.PickerMovementType); - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryReference); - AddControlViewToGrid(gridProperties, assetMovementComponents.DatePickerMovementDate); + gridProperties.AddControlViewToGrid(assetMovementComponents.PickerMovementType); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryReference); + gridProperties.AddControlViewToGrid(assetMovementComponents.DatePickerMovementDate); // Customer. - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryCustomer); - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryCustomerReference); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryCustomer); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryCustomerReference); // Location. - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryLocationStart); - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryLocationCurrent); - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryLocationFinish); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryLocationStart); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryLocationCurrent); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryLocationFinish); // Haulier & Registration. - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryHaulierInitial); - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryRegistrationInitial); - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryHaulierFinal); - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryRegistrationFinal); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryHaulierInitial); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryRegistrationInitial); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryHaulierFinal); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryRegistrationFinal); // Numbers. - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryPinNumber); - AddControlViewToGrid(gridProperties, assetMovementComponents.EntrySealNumber); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryPinNumber); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntrySealNumber); // Status. - AddControlViewToGrid(gridProperties, assetMovementComponents.EntryStatus); - AddControlViewToGrid(gridProperties, assetMovementComponents.DatePickerInProgressDate); - AddControlViewToGrid(gridProperties, assetMovementComponents.DatePickerCompletedDate); + gridProperties.AddControlViewToGrid(assetMovementComponents.EntryStatus); + gridProperties.AddControlViewToGrid(assetMovementComponents.DatePickerInProgressDate); + gridProperties.AddControlViewToGrid(assetMovementComponents.DatePickerCompletedDate); // Notes. - AddControlViewToGrid(gridProperties, assetMovementComponents.EditorNotes); + gridProperties.AddControlViewToGrid(assetMovementComponents.EditorNotes); //--------------------------------------------------------------- // Populate properties to components. diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_Repair.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_Repair.cs index 7bc80c8..15ae95c 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_Repair.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_Repair.cs @@ -6,7 +6,9 @@ using Sarand.Core.Xml; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.WebService; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets; using System; @@ -66,18 +68,20 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets { // Asset Repair form. FormBodyView.Content = gridProperties; + gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing; + gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing; gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); int rowIdx = -1; // Shipping line company. - AddControlViewToGrid(gridProperties, assetRepairComponents.PickerCompany); + gridProperties.AddControlViewToGrid(assetRepairComponents.PickerCompany); assetRepairComponents.PickerCompany.Populated += PickerCompany_Populated; assetRepairComponents.PickerCompany.SelectedIndexChanged += PickerCompany_SelectedIndexChanged; // Asset code. - AddControlViewToGrid(gridProperties, assetRepairComponents.EntryAssetCode); + gridProperties.AddControlViewToGrid(assetRepairComponents.EntryAssetCode); assetRepairComponents.EntryAssetCode.TextChanged += EntryAssetCode_TextChanged; assetRepairComponents.EntryAssetCode.Completed += EntryAssetCode_Completed; @@ -97,13 +101,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets assetSearchResultsWebView.AssetMovementSelected += AssetSearchResultsWebView_AssetMovementSelected; // Asset Size. - AddControlViewToGrid(gridProperties, assetRepairComponents.PickerAssetSize); + gridProperties.AddControlViewToGrid(assetRepairComponents.PickerAssetSize); // Repair Narrative. - AddControlViewToGrid(gridProperties, assetRepairComponents.EntryRepairNarrative); + gridProperties.AddControlViewToGrid(assetRepairComponents.EntryRepairNarrative); // Repair Inspector. - AddControlViewToGrid(gridProperties, assetRepairComponents.EntryRepairInspector); + gridProperties.AddControlViewToGrid(assetRepairComponents.EntryRepairInspector); // Jobs panel. SlmPanel_AssetRepair_Jobs.Config jobsPanelConfig = new SlmPanel_AssetRepair_Jobs.Config(); diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_RepairImage.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_RepairImage.cs index 6d577c6..5c8d3cb 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_RepairImage.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_RepairImage.cs @@ -1,12 +1,9 @@ -using Sarand.Core.Base; -using Sarand.Core.Bus; -using Sarand.Core.Tasks; -using Sarand.LogisticsMgr.Core.App; +using Sarand.Core.Bus; using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Core.WebService; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets; -using Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets; using System; using System.Collections.Generic; using System.Linq; @@ -59,14 +56,15 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets { // Asset Repair form. FormBodyView.Content = gridProperties; + gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing; + gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing; gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); - int rowIdx = -1; // Filename. - AddControlViewToGrid(gridProperties, repairImageComponents.EntryFilename); + gridProperties.AddControlViewToGrid(repairImageComponents.EntryFilename); } //------------------------------------------------------------------- diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_RepairJob.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_RepairJob.cs index 40d651b..905f217 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_RepairJob.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Assets/SlmFormPage_Assets_RepairJob.cs @@ -1,12 +1,10 @@ using Sarand.Core.Base; using Sarand.Core.Bus; -using Sarand.Core.Tasks; -using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Core.WebService; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets; -using Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets; using System; using System.Collections.Generic; using System.Linq; @@ -63,6 +61,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets { // Asset Repair form. FormBodyView.Content = gridProperties; + gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing; + gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing; gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); @@ -102,7 +102,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets Grid.SetColumnSpan(repairJobComponents.PickerRepair, 2); // Quantity. - AddControlViewToGrid(gridProperties, repairJobComponents.EntryQuantity); + gridProperties.AddControlViewToGrid(repairJobComponents.EntryQuantity); } //------------------------------------------------------------------- diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Bulk/SlmFormPage_Bulk_Berthing.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Bulk/SlmFormPage_Bulk_Berthing.cs index 49932c7..899a330 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Bulk/SlmFormPage_Bulk_Berthing.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Bulk/SlmFormPage_Bulk_Berthing.cs @@ -4,8 +4,13 @@ using Sarand.Core.Bus; using Sarand.Core.Tasks; using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.WebService; +using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Bus; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk; using Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk; using System; @@ -29,9 +34,10 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk //------------------------------------------------------------------- // Data members. private readonly Config config; - private SlmGrid gridProperties = new SlmGrid(); - private SlmComponents_Berthing berthingComponents = new SlmComponents_Berthing(); - private SlmPanel_Bulk_BerthingTasks berthingTasksPanel; + // Components. + private SlmStackLayout panelLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical }; + private SlmPanel_PropertySummary panelPropertySummary = new SlmPanel_PropertySummary(); + private SlmTabControl tabbedView = new SlmTabControl(); // Data to view/update. private SlmBerthing BerthingToUpdate; private SlmVessel Berthing_Vessel; @@ -45,10 +51,6 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk this.config = config; Title = "Bulk - Berthing"; AddMode = !SysId.IsValid(config.BerthingIdToUpdate); - if (config.ReadOnly) - { - berthingComponents.ReadOnly = true; - } PrepareFormData(); } @@ -78,7 +80,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk catch (Exception exc) { if (SacsSystem.DebugMode) Logger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc)); - CloseFormWithAlert(nameof(exc)+" on form initialisation.\n\n"+exc.Message); + CloseFormWithAlert(nameof(exc) + " on form initialisation.\n\n" + exc.Message); } }, taskDataPrepareData.CancellationToken) .ContinueWith(task => @@ -173,41 +175,50 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk private void InitialiseComponents () { // Asset Repair form. - gridProperties.BackgroundColor = Color.Transparent; - FormBodyView.Content = gridProperties; - gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); - gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); - gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); + FormBodyView.Content = panelLayout; - //--------------------------------------------------------------- - // Vessel. - AddControlViewToGrid(gridProperties, berthingComponents.PickerVessel); + // Summary Preopeties panel. + panelPropertySummary.BorderColor = SlmMobile.ItemListHeaderBorderColor; + panelPropertySummary.PanelBackgroundColor = SlmMobile.ItemListHeaderBackgroundColor; + panelPropertySummary.FontSize = panelPropertySummary.DefaultFontSize * SlmMobile.FontSizeRatio; + panelPropertySummary.ClearProperties(); + panelPropertySummary.AddProperty("Vessel", Berthing_Vessel?.Name ?? ""); + panelPropertySummary.AddProperty("Agent", Berthing_Company_Agent?.Name ?? ""); + panelPropertySummary.AddProperty("Customer", Berthing_Company_Customer?.Name ?? ""); + panelLayout.Children.Add(panelPropertySummary); - // Companies. - AddControlViewToGrid(gridProperties, berthingComponents.PickerAgent); - AddControlViewToGrid(gridProperties, berthingComponents.PickerCustomer); + // Tabbed panel. + tabbedView.HeaderFontSize = tabbedView.DefaultHeaderFontSize * SlmMobile.FontSizeRatio; + tabbedView.HeaderBackgroundColor = SlmMobile.TabControlHeaderBackgroundColor; + tabbedView.CaptionBackgroundColor = SlmMobile.TabControlCaptionBackgroundColor; + tabbedView.BodyBackgroundColor = SlmMobile.TabControlBodyBackgroundColor; + panelLayout.Children.Add(tabbedView); - // Notes. - AddControlViewToGrid(gridProperties, berthingComponents.EditorNotes); - - // Tasks panel. - SlmPanel_Bulk_BerthingTasks.Config berthingTasksPanelConfig = new SlmPanel_Bulk_BerthingTasks.Config(); - berthingTasksPanelConfig.BerthingForm = this; - berthingTasksPanel = new SlmPanel_Bulk_BerthingTasks(berthingTasksPanelConfig); - int rowIdx = gridProperties.RowDefinitions.Count; - gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - gridProperties.Children.Add(berthingTasksPanel, 0, rowIdx); - Grid.SetColumnSpan(berthingTasksPanel, 3); - - //--------------------------------------------------------------- - // Populate properties to components. - berthingComponents.PopulateToControls(Berthing_Vessel?.GetData() ?? new SlmVessel.Data()); - berthingComponents.PopulateToControls(BerthingToUpdate?.GetData() ?? new SlmBerthing.Data()); + // Initialise tabbed panels. + InitTabs(); // Complete page configuration. SetControlActivity(); Changed = false; } + private void InitTabs () + { + // Berthing panel. + SlmPanel_Berthing.Config configBerthing = new SlmPanel_Berthing.Config(); + configBerthing.BerthingToUpdate = BerthingToUpdate; + configBerthing.Berthing_Vessel = Berthing_Vessel; + configBerthing.Berthing_Company_Agent = Berthing_Company_Agent; + configBerthing.Berthing_Company_Customer = Berthing_Company_Customer; + configBerthing.ReadOnly = true; + SlmPanel_Berthing panelBerthing = new SlmPanel_Berthing(configBerthing); + tabbedView.AddPanel("Berthing", panelBerthing); + + // Tasks panel. + SlmPanel_Bulk_BerthingTasks.Config berthingTasksPanelConfig = new SlmPanel_Bulk_BerthingTasks.Config(); + berthingTasksPanelConfig.BerthingForm = this; + SlmPanel_Bulk_BerthingTasks berthingTasksPanel = new SlmPanel_Bulk_BerthingTasks(berthingTasksPanelConfig); + tabbedView.AddPanel("Tasks", berthingTasksPanel); + } //------------------------------------------------------------------- // C o n t r o l A c t i v i t y diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Bulk/SlmFormPage_Bulk_BerthingTask.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Bulk/SlmFormPage_Bulk_BerthingTask.cs index bfdbb4b..cfe5f7d 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Bulk/SlmFormPage_Bulk_BerthingTask.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Forms/Bulk/SlmFormPage_Bulk_BerthingTask.cs @@ -1,8 +1,8 @@ -using Sarand.Core.Base; -using Sarand.Core.Bus; -using Sarand.Core.Tasks; +using Sarand.Core.Bus; using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk; using System; using System.Collections.Generic; @@ -56,16 +56,18 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk { // Asset Repair form. FormBodyView.Content = gridProperties; + gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing; + gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing; gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); // Controls. - AddControlViewToGrid(gridProperties, berthingTaskComponents.PickerTaskType); - AddControlViewToGrid(gridProperties, berthingTaskComponents.DatePickerStarted); - AddControlViewToGrid(gridProperties, berthingTaskComponents.DatePickerCompleted); - AddControlViewToGrid(gridProperties, berthingTaskComponents.EntryRemarks); + gridProperties.AddControlViewToGrid(berthingTaskComponents.PickerTaskType); + gridProperties.AddControlViewToGrid(berthingTaskComponents.DatePickerStarted); + //gridProperties.AddControlViewToGrid(berthingTaskComponents.DatePickerCompleted); + gridProperties.AddControlViewToGrid(berthingTaskComponents.EntryRemarks); if (AddMode) { diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Templates/Page_Template_Main.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Templates/Page_Template_Main.cs index 683e5b7..8550678 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Templates/Page_Template_Main.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Pages/Templates/Page_Template_Main.cs @@ -1,7 +1,5 @@ using Sarand.Core.App; using Sarand.Core.Base; -using Sarand.LogisticsMgr.Mobile.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Forms.Views; using System; using System.Collections.Generic; @@ -13,6 +11,8 @@ using System.Text; using Xamarin.Forms; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.Core.Mobile.Utils; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates { diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetMovement_SearchResults.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetMovement_SearchResults.cs index d35b43d..838ca5b 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetMovement_SearchResults.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetMovement_SearchResults.cs @@ -4,7 +4,7 @@ using Sarand.Core.Tasks; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.WebService; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using System; using System.Collections.Generic; using System.Text; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Images.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Images.cs index c84bd77..9937774 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Images.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Images.cs @@ -1,6 +1,7 @@ using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets; using System; using System.Collections.Generic; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Jobs.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Jobs.cs index 64b524b..d1dd9f1 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Jobs.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Assets/SlmPanel_AssetRepair_Jobs.cs @@ -1,8 +1,9 @@ using Sarand.Core.App; using Sarand.Core.Mobile.Utils; using Sarand.LogisticsMgr.Core.Bus; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets; using System; using System.Collections.Generic; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Bulk/SlmPanel_Berthing.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Bulk/SlmPanel_Berthing.cs new file mode 100644 index 0000000..3fea0dc --- /dev/null +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Bulk/SlmPanel_Berthing.cs @@ -0,0 +1,89 @@ +using Sarand.Core.Bus; +using Sarand.LogisticsMgr.Core.Bus; +using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; +using Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk; +using System; +using System.Collections.Generic; +using System.Text; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk +{ + //======================================================================= + public class SlmPanel_Berthing : SlmPanel_ItemProperties + { + //------------------------------------------------------------------- + // Definitions. + public new class Config : SlmPanel_ItemProperties.Config + { + // Data to view/update. + public SlmBerthing BerthingToUpdate; + public SlmVessel Berthing_Vessel; + public SlmCompany Berthing_Company_Agent; + public SlmCompany Berthing_Company_Customer; + } + + //------------------------------------------------------------------- + // Data members. + private Config config; + // Components. + private SlmGrid gridProperties = new SlmGrid(); + private SlmComponents_Berthing berthingComponents = new SlmComponents_Berthing(); + + //------------------------------------------------------------------- + // Construction. + public SlmPanel_Berthing (Config config) : base(config) + { + this.config = config; + AddMode = config.BerthingToUpdate != null && !SysId.IsValid(config.BerthingToUpdate.Id); + if (config.ReadOnly) + { + berthingComponents.ReadOnly = true; + } + InitialiseComponents(); + } + + //------------------------------------------------------------------- + // I n i t i a l i s e + //------------------------------------------------------------------- + private void InitialiseComponents () + { + // Properties grid. + Content = gridProperties; + gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing; + gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing; + gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); + gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); + gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); + + //--------------------------------------------------------------- + // Vessel. + gridProperties.AddControlViewToGrid(berthingComponents.PickerVessel); + + // Companies. + gridProperties.AddControlViewToGrid(berthingComponents.PickerAgent); + gridProperties.AddControlViewToGrid(berthingComponents.PickerCustomer); + + // Notes. + gridProperties.AddControlViewToGrid(berthingComponents.EditorNotes); + + //--------------------------------------------------------------- + // Populate vessel and companies to pickers if not already present. + if (config.Berthing_Vessel != null && !berthingComponents.PickerVessel.ContainsId(config.Berthing_Vessel.Id)) + berthingComponents.PickerVessel.AddItem(config.Berthing_Vessel.Id, config.Berthing_Vessel.Name); + if (config.Berthing_Company_Agent != null && !berthingComponents.PickerAgent.ContainsId(config.Berthing_Company_Agent.Id)) + berthingComponents.PickerAgent.AddItem(config.Berthing_Company_Agent.Id, config.Berthing_Company_Agent.Name); + if (config.Berthing_Company_Customer != null && !berthingComponents.PickerCustomer.ContainsId(config.Berthing_Company_Customer.Id)) + berthingComponents.PickerCustomer.AddItem(config.Berthing_Company_Customer.Id, config.Berthing_Company_Customer.Name); + + // Populate properties to components. + berthingComponents.PopulateToControls(config.Berthing_Vessel?.GetData() ?? new SlmVessel.Data()); + berthingComponents.PopulateToControls(config.BerthingToUpdate?.GetData() ?? new SlmBerthing.Data()); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Bulk/SlmPanel_Bulk_BerthingTasks.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Bulk/SlmPanel_Bulk_BerthingTasks.cs index 3b73877..5b853cd 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Bulk/SlmPanel_Bulk_BerthingTasks.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Bulk/SlmPanel_Bulk_BerthingTasks.cs @@ -2,15 +2,20 @@ using Sarand.Core.Base; using Sarand.Core.Bus; using Sarand.Core.Mobile.Forms.Controls; +using Sarand.Core.Mobile.Forms.Panels; using Sarand.Core.Tasks; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk; +using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main; using System; using System.Collections.Generic; using System.Text; @@ -20,11 +25,11 @@ using Xamarin.Forms; namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk { //======================================================================= - public class SlmPanel_Bulk_BerthingTasks : SlmPanel_AssociatedItems + public class SlmPanel_Bulk_BerthingTasks : SlmPanel { //------------------------------------------------------------------- // Definitions. - public new class Config : SlmPanel_AssociatedItems.Config + public new class Config : SlmPanel.Config { public SlmFormPage_Bulk_Berthing BerthingForm { get; set; } } @@ -34,8 +39,9 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk private Config config; private readonly List berthingTaskTypes; private List berthingTaskDataList = new List(); - private SlmLabel labelSummary = new SlmLabel(); - //private SlmGrid gridDetails = new SlmGrid(); + // Components. + private SlmStackLayout panelLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical }; + private SaxPanel_ItemListSummary panelSummary = new SaxPanel_ItemListSummary(); private SlmWebView webViewDetails = new SlmWebView(); private String berthingTaskUpdatePrefix = "BthTskUpdate_"; @@ -52,6 +58,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk //------------------------------------------------------------------- // Properties. + public String MessageCaption { get; } = "Berthing Tasks"; public List BerthingTasks { get { return new List(berthingTaskDataList); } } //------------------------------------------------------------------- @@ -59,17 +66,23 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk //------------------------------------------------------------------- private void InitialiseComponents () { - Caption = "Berthing Tasks"; + // Main layout - vertical stack. + VerticalOptions = LayoutOptions.Fill; + panelLayout.VerticalOptions = LayoutOptions.Fill; + Content = panelLayout; - // Summary panel. - labelSummary.HorizontalOptions = LayoutOptions.FillAndExpand; - SummaryPanel.Content = labelSummary; + // Messages panel. + panelSummary.ShowAddButton = !config.ReadOnly; + panelSummary.AddClicked += PanelSummary_AddClicked; + panelSummary.MessageFontSize = panelSummary.DefaultMessageFontSize * SlmMobile.FontSizeRatio; + panelLayout.Children.Add(panelSummary); - // Details panel. - webViewDetails.HorizontalOptions = LayoutOptions.StartAndExpand; - webViewDetails.VerticalOptions = LayoutOptions.StartAndExpand; + // Berthing Task list component. + webViewDetails.HorizontalOptions = LayoutOptions.Fill; + webViewDetails.VerticalOptions = LayoutOptions.FillAndExpand; webViewDetails.AppNavigating += WebViewDetails_AppNavigating; - DetailsPanel.Content = webViewDetails; + webViewDetails.MinimumHeightRequest = 120; + panelLayout.Children.Add(webViewDetails); RefreshPanels(); } @@ -91,7 +104,10 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk catch (Exception exc) { if (SacsSystem.DebugMode) Logger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc)); - ErrorStateMessage = nameof(exc) + " on population - " + exc.Message; + Device.BeginInvokeOnMainThread(() => + { + panelSummary.SetMessage(nameof(exc) + " on population - " + exc.Message, SaMessageLevel.Exception); + }); } }, taskDataPrepareData.CancellationToken) .ContinueWith(task => @@ -138,32 +154,29 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk //------------------------------------------------------------------- private void RefreshSummaryPanel () { + panelSummary.ClearMessage(); if (berthingTaskDataList.Count == 0) - labelSummary.Text = "No tasks defined"; + panelSummary.SetMessage(new SacsMessage("No tasks defined")); else if (berthingTaskDataList.Count == 1) - labelSummary.Text = "1 task defined"; + panelSummary.SetMessage(new SacsMessage("1 task defined")); else - labelSummary.Text = berthingTaskDataList.Count + " tasks defined"; + panelSummary.SetMessage(new SacsMessage(berthingTaskDataList.Count + " tasks defined")); } //------------------------------------------------------------------- private void RefreshDetailsPanel () { List html = new List(); - html.Add("" + GetItemListStyles().Concat("\n") + GetItemListScripts().Concat("\n") + ""); + html.Add("" + GetBerthingTaskListStyles().Concat("\n") + GetBerthingTaskListScripts().Concat("\n") + ""); foreach (SlmBerthingTask.Data item in berthingTaskDataList) { html.Add("
"); html.Add(""); html.Add(" "); + html.Add(" "); html.Add(" "); - html.Add(" "); html.Add(" "); html.Add(" "); - html.Add(" "); - html.Add(" "); - html.Add(" "); - html.Add(" "); - html.Add(" "); + html.Add(" "); html.Add(" "); if (SacsSystem.DebugMode) { @@ -178,29 +191,19 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk html.Add(""); webViewDetails.Html = html.Concat("\n"); } - private List GetItemListStyles () + private List GetBerthingTaskListStyles () { - return new List() + List styles = new List(SlmMainPanel_ItemList.GetItemListBaseStyles()); + styles.AddRange(new String[] { - "", - "", - "", - "" - }; + }); + return styles; } - private List GetItemListScripts () + private List GetBerthingTaskListScripts () { - return new List() + List scripts = new List(SlmMainPanel_ItemList.GetItemListBaseScripts()); + scripts.AddRange(new String[] { - "", - "", - "", - "", "" - }; + }); + return scripts; } //------------------------------------------------------------------- // P a n e l E v e n t s //------------------------------------------------------------------- - protected override void ButtonAddItem_Clicked (object sender, EventArgs e) + private void PanelSummary_AddClicked (object sender, EventArgs e) { SlmFormPage_Bulk_BerthingTask.Config formConfig = new SlmFormPage_Bulk_BerthingTask.Config(config.BerthingForm.BerthingId); SlmFormPage_Bulk_BerthingTask berthingTaskForm = new SlmFormPage_Bulk_BerthingTask(formConfig); @@ -231,7 +235,6 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk { berthingTaskDataList.Add(berthingTaskData); RefreshPanels(); - DropDown(); } } }; @@ -247,13 +250,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk SysId berthingTaskId = new SysId(StringUtil.ToInt(eventArgs.AppAction.Right(eventArgs.AppAction.Length - berthingTaskUpdatePrefix.Length))); if (!SysId.IsValid(berthingTaskId)) { - DisplayAlert(Caption, "Invalid berthing task selected.", "OK"); + DisplayAlert(MessageCaption, "Invalid berthing task selected.", "OK"); return; } SlmBerthingTask.Data berthingTaskData = berthingTaskDataList.Find(item => item.Id.Equals(berthingTaskId)); if (!SysId.IsValid(berthingTaskId)) { - DisplayAlert(Caption, "Failed to retrieve berthing task.", "OK"); + DisplayAlert(MessageCaption, "Failed to retrieve berthing task.", "OK"); return; } @@ -267,7 +270,6 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk { berthingTaskDataList.Add(berthingTaskData); RefreshPanels(); - DropDown(); } }; Application.Current.MainPage.Navigation.PushModalAsync(berthingTaskForm, false); diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/Assets/SlmMainPanel_AssetMovements.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/Assets/SlmMainPanel_AssetMovements.cs index 5031e7a..997241d 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/Assets/SlmMainPanel_AssetMovements.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/Assets/SlmMainPanel_AssetMovements.cs @@ -8,6 +8,7 @@ using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets; using System; using System.Collections.Generic; @@ -197,6 +198,21 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets configRequest.Context.Debug = SacsSystem.DebugMode; // Filter. Dictionary filter = AssetMgr.GetAssetMovementQueryFilter_Mobile(assetMovementParams); + + //--------------------------------------------------- + // ToDo Temporary fix to list all containers if up to 100 + // so that entire train is listed rather than having to page through results. + configRequest.RequestType = SlmWebServiceRequest.RequestType.Count; + SlmWebServiceClient.ItemCountResponseData itemCountResponseData = await new SlmWebServiceClient().RequestItemCount(configRequest, filter, taskDataRefreshList_Local); + if (itemCountResponseData.ItemCount <= 100) + { + // Clear paging and refresh filter. + assetMovementParams.ResultsPaging.PageNo = 1; + assetMovementParams.ResultsPaging.PageLength = (ushort)itemCountResponseData.ItemCount; + filter = AssetMgr.GetAssetMovementQueryFilter_Mobile(assetMovementParams); + } + //--------------------------------------------------- + // Columns. List queryColumns = new List() { @@ -220,6 +236,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets }; // Request User profile. if (SacsSystem.DebugMode) Logger.Debug(fn + " Querying data - START"); + configRequest.RequestType = SlmWebServiceRequest.RequestType.QueryList; SlmWebServiceClient.QueryListResponseData responseData = await new SlmWebServiceClient().RequestQueryList(configRequest, filter, queryColumns, taskDataRefreshList_Local); if (SacsSystem.DebugMode) Logger.Debug(fn + " Querying data - END Items: " + (responseData?.Items.Count.ToString() ?? "None") + (taskDataRefreshList_Local.IsCancellationRequested ? " [Cancelled]" : "")); @@ -239,6 +256,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets taskDataRefreshList = null; }); if (SacsSystem.DebugMode) Logger.Debug(fn + " Timer method complete."); + // Kill timer with false response. return false; }); } @@ -248,10 +266,10 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets { // Refresh paging properties. if (responseData != null) - HeaderPanel.SetPaging(responseData.PageNo, responseData.PageLength, responseData.Total); + HeaderPanel.SetPaging(responseData.PageNo, responseData.PageLength, responseData.Total > 0 ? responseData.Total : responseData.Count); else HeaderPanel.SetPaging(0, 0, 0); // Construct item list HTML. - string html = ""+GetItemListStyles().Concat("\n")+GetItemListScripts().Concat("\n")+""; + string html = ""+GetAssetMovementListStyles().Concat("\n")+GetAssetMovementListScripts().Concat("\n")+""; if (message != null) { String messageClass = "inf"; @@ -277,8 +295,9 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets { html += "
"; html += "
Started" + DateUtil.Format(item.Started, "ddd d-MMM-yyyy HH:mm") + "Type" + berthingTaskTypes.GetDescForType((int)item.BerthingTaskType) + "Status" + SacsSystem.GetStatusDesc(item.Status) + "
Started" + DateUtil.Format(item.Started, "ddd d-MMM-yyyy") + "Completed" + DateUtil.Format(item.Completed, "ddd d-MMM-yyyy") + "
Arrived" + item.Remarks.ReplaceAll("\n","
") + "
Remarks" + item.Remarks.ReplaceAll("\n", "
") + "
"; + html += " "; html += " "; - html += " "; + html += " "; html += " "; html += " "; html += " "; @@ -309,29 +328,19 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets ItemListWebView.Html = html; //Logger.Debug("HTML: " + html); } - private List GetItemListStyles () + private List GetAssetMovementListStyles () { - return new List() + List styles = new List(GetItemListBaseStyles()); + styles.AddRange(new String[] { - "", - "", - "", - "" - }; + }); + return styles; } - private List GetItemListScripts () + private List GetAssetMovementListScripts () { - return new List() + List scripts = new List(GetItemListBaseScripts()); + scripts.AddRange(new String[] { - "", - "", - "", - "", "" - }; + }); + return scripts; } //------------------------------------------------------------------- @@ -368,7 +378,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets SlmFormPage_Assets_Movement.Config pageConfig = new SlmFormPage_Assets_Movement.Config(); pageConfig.AssetMovementIdToUpdate = assetMovementId; pageConfig.ReadOnly = true; - if (pageConfig.ReadOnly) pageConfig.NavigationMode = Core.Forms.Base.SlmFormPage.NavigationMode.Close; + if (pageConfig.ReadOnly) pageConfig.NavigationMode = SlmFormPage.NavigationMode.Close; SlmFormPage_Assets_Movement assetRepairForm = new SlmFormPage_Assets_Movement (pageConfig); //assetRepairForm.Disappearing += (sender2, e2) => { }; SlmGlobals_Mobile.Application.MainPage.Navigation.PushModalAsync(assetRepairForm, false); diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/Bulk/SlmMainPanel_Bulk_Berthings.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/Bulk/SlmMainPanel_Bulk_Berthings.cs index 880c73e..e313f70 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/Bulk/SlmMainPanel_Bulk_Berthings.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/Bulk/SlmMainPanel_Bulk_Berthings.cs @@ -9,6 +9,7 @@ using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Bus; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk; using System; using System.Collections.Generic; @@ -239,6 +240,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk taskDataRefreshList = null; }); if (SacsSystem.DebugMode) Logger.Debug(fn + " Timer method complete."); + // Kill timer with false response. return false; }); } @@ -248,10 +250,10 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk { // Refresh paging properties. if (responseData != null) - HeaderPanel.SetPaging(responseData.PageNo, responseData.PageLength, responseData.Total); + HeaderPanel.SetPaging(responseData.PageNo, responseData.PageLength, responseData.Total > 0 ? responseData.Total : responseData.Count); else HeaderPanel.SetPaging(0, 0, 0); // Construct item list HTML. - string html = ""+GetItemListStyles().Concat("\n")+GetItemListScripts().Concat("\n")+""; + string html = ""+GetBerthingListStyles().Concat("\n")+GetBerthingListScripts().Concat("\n")+""; if (message != null) { String messageClass = "inf"; @@ -277,9 +279,9 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk { html += "
"; html += "
Container" + item.GetValue(cols.Asset_Code.DataName) + "Container" + item.GetValue(cols.Asset_Code.DataName) + "Size" + item.GetValue(cols.AssetSizeCode.DataName) + "
"; + html += " "; html += " "; - html += " "; - html += " "; + html += " "; html += " "; html += " "; html += " "; @@ -290,18 +292,23 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk html += " "; html += " "; html += " "; - html += " "; - SaStatus berthingStatus = SacsSystem.GetStatusForCode(item.GetValue(cols.Status.DataName)); - html += " "; - html += " "; - html += " "; - html += " "; - html += " "; - html += " "; + // Expected/Arrived. + DateTime expected = item.GetDateTimeValue(cols.Expected.DataName); + DateTime arrived = item.GetDateTimeValue(cols.Arrived.DataName); + if (DateUtil.IsValid(arrived)) + html += " "; + else html += " "; if (SacsSystem.DebugMode) + html += " "; + html += " "; + // Completed/Departed. + DateTime completed = item.GetDateTimeValue(cols.Completed.DataName); + DateTime departed = item.GetDateTimeValue(cols.Departed.DataName); + if (DateUtil.IsValid(completed)) { html += " "; - html += " "; + html += " "; + html += " "; html += " "; } html += "
Vessel" + item.GetValue(cols.VesselName.DataName) + "" + "Vessel" + item.GetValue(cols.VesselName.DataName) + "
Customer" + item.GetValue(cols.CustomerName.DataName) + "Bollard" + item.GetValue(cols.Bollard.DataName) + "
Arrived" + DateUtil.Format(item.GetDateTimeValue(cols.Arrived.DataName), "ddd d-MMM-yyyy") + "Status" + SacsSystem.GetStatusDesc(berthingStatus) + "
Completed" + DateUtil.Format(item.GetDateTimeValue(cols.Completed.DataName), "ddd d-MMM-yyyy") + "Departed" + DateUtil.Format(item.GetDateTimeValue(cols.Departed.DataName), "ddd d-MMM-yyyy") + "
Arrived" + DateUtil.Format(arrived, "ddd d-MMM-yyyy") + "Expected" + DateUtil.Format(expected, "ddd d-MMM-yyyy") + "Id" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "
Id" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "Completed" + DateUtil.Format(completed, "ddd d-MMM-yyyy") + "Departed" + DateUtil.Format(departed, "ddd d-MMM-yyyy") + "
"; @@ -313,29 +320,19 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk ItemListWebView.Html = html; //Logger.Debug("HTML: " + html); } - private List GetItemListStyles () + private List GetBerthingListStyles () { - return new List() + List styles = new List(GetItemListBaseStyles()); + styles.AddRange(new String[] { - "", - "", - "", - "" - }; + }); + return styles; } - private List GetItemListScripts () + private List GetBerthingListScripts () { - return new List() + List scripts = new List(GetItemListBaseScripts()); + scripts.AddRange(new String[] { - "", - "", - "", - "", "" - }; + }); + return scripts; } //------------------------------------------------------------------- @@ -372,7 +370,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk SlmFormPage_Bulk_Berthing.Config pageConfig = new SlmFormPage_Bulk_Berthing.Config(); pageConfig.BerthingIdToUpdate = berthingId; pageConfig.ReadOnly = true; - if (pageConfig.ReadOnly) pageConfig.NavigationMode = Core.Forms.Base.SlmFormPage.NavigationMode.Close; + if (pageConfig.ReadOnly) pageConfig.NavigationMode = SlmFormPage.NavigationMode.Close; SlmFormPage_Bulk_Berthing assetRepairForm = new SlmFormPage_Bulk_Berthing (pageConfig); //assetRepairForm.Disappearing += (sender2, e2) => { }; SlmGlobals_Mobile.Application.MainPage.Navigation.PushModalAsync(assetRepairForm, false); diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Home.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Home.cs index 3c66a54..3c7b23b 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Home.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Home.cs @@ -1,6 +1,7 @@ using Sarand.Core.Mobile.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Components; using System; using System.Collections.Generic; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ItemList.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ItemList.cs index 0a5a53c..5a1023a 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ItemList.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_ItemList.cs @@ -1,11 +1,11 @@ using Sarand.Core.Base; using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Forms.Panels; +using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; -using Sarand.LogisticsMgr.Mobile.Forms.Components; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; @@ -97,6 +97,34 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main protected abstract void RefreshItemList (uint pageNo = 1); protected abstract void DisplayItemList (SlmWebServiceClient.QueryListResponseData responseData, SacsMessage message = null); + //------------------------------------------------------------------- + public static List GetItemListBaseStyles () + { + return new List() + { + "", + "", + "", + "" + }; + } + public static List GetItemListBaseScripts () + { + return new List() + { + "", + "", + "", + "", + }; + } + //------------------------------------------------------------------- // P a n e l A c t i o n s //------------------------------------------------------------------- diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Login.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Login.cs index 3fb4227..47e1332 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Login.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Panels/Main/SlmMainPanel_Login.cs @@ -3,11 +3,11 @@ using Sarand.Core.Base; using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Utils; using Sarand.Core.Tasks; -using Sarand.Core.Xml; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Components; using System; using System.Collections.Generic; diff --git a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Views/SlmMenuView.cs b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Views/SlmMenuView.cs index 476864c..6788f01 100644 --- a/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Views/SlmMenuView.cs +++ b/LogisticsMgrMobile/LogisticsMgrMobile/Mobile/Forms/Views/SlmMenuView.cs @@ -1,7 +1,7 @@ using Sarand.Core.Mobile.Forms.Views; -using Sarand.LogisticsMgr.Mobile.App; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using System; using System.Collections.Generic; using System.Text; @@ -90,6 +90,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Views if (option.Command != null) { var tapGestureRecognizer = new TapGestureRecognizer(); + tapGestureRecognizer.Tapped += MeunOption_Tapped; tapGestureRecognizer.Tapped += (s, e) => { option.Command.Execute(null); InvokeMenuOptionClicked(); }; optionLabel.GestureRecognizers.Add(tapGestureRecognizer); if (optionImage != null) @@ -98,6 +99,21 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Views } } + private void MeunOption_Tapped (object sender, EventArgs e) + { + // Want to highlight option that has been tapped to reassure the user that it is being actioned. + // May need to add MenuOptionPanel across grid row to be able to idntify relevant label + // rather than relying on the label itself being tapped. + Element element = (sender as Element); + Label label = (sender as Label); + if (sender is Element) + { + var parent = element.Parent; // Grid. + if (label != null) + label.TextColor = Color.Red; + } + } + //------------------------------------------------------------------- // M e n u E v e n t s //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/App/SlmMobile.cs b/SaLogMgrMobCore/Mobile/Core/App/SlmMobile.cs index e9dbd4e..40ab6b0 100644 --- a/SaLogMgrMobCore/Mobile/Core/App/SlmMobile.cs +++ b/SaLogMgrMobCore/Mobile/Core/App/SlmMobile.cs @@ -64,10 +64,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App { get { - if (SaxApplication.MinDeviceDimension > 2000) return "18px"; - if (SaxApplication.MinDeviceDimension > 1600) return "16px"; - if (SaxApplication.MinDeviceDimension > 1200) return "14px"; - return "12px"; + if (SaxApplication.MinDeviceDimension > 2000) return "14pt"; + if (SaxApplication.MinDeviceDimension > 1600) return "13pt"; + if (SaxApplication.MinDeviceDimension > 1200) return "12pt"; + if (SaxApplication.MinDeviceDimension > 1000) return "11pt"; + return "10pt"; } } public static double FontSizeRatio @@ -99,11 +100,18 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App public static float ItemListHeaderBorderRadius = 6.0f; public static Color ItemListHeaderBorderColor = ApplicationBarBackgroundColor; public static Color ItemListHeaderBackgroundColor = Color.FromHex("#F0F0F0"); + // Forms. + public static double FormGridRowSpacing { get; } = 4.0; + public static double FormGridColumnSpacing { get; } = 4.0; // Controls. public static Color ControlBackgroundColor { get; } = Color.FromHex("#F8F8F8"); public static Color ControlBorderColor { get; } = Color.FromHex("#E0E0E0"); public static double ControlBorderWidth { get; } = 0.5; public static Thickness LabelMargin { get; } = new Thickness(4.0, 8.0, 0, 0); + // Tab controls. + public static Color TabControlHeaderBackgroundColor { get; } = Color.Transparent; + public static Color TabControlCaptionBackgroundColor { get; } = Color.FromHex("#E0E0E0"); + public static Color TabControlBodyBackgroundColor { get; } = Color.FromHex("#F8F8F8"); // Associated items panel. public static Color AssociatedItemsCaptionBackgroundColor { get; } = Color.FromHex("#becee4"); public static Color AssociatedItemsCaptionTextColor { get; } = Color.FromHex("#f8f8f8"); diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmComponents.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmComponents.cs index c026d52..f210b7a 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmComponents.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmComponents.cs @@ -1,4 +1,5 @@ using Sarand.Core.Mobile.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; using System; using System.Collections.Generic; using System.Text; @@ -7,7 +8,7 @@ using Xamarin.Forms; namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base { //======================================================================= - public class SlmComponents : SaxComponents + public class SlmComponents : SlmPanel { //------------------------------------------------------------------- // Definitions. @@ -23,6 +24,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Properties. + public bool Changed { get; protected set; } = false; //------------------------------------------------------------------- // C o n f i g u r e C o m p o n e n t s diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmControlView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmControlView.cs similarity index 73% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmControlView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmControlView.cs index f6a2a6b..ed2c31f 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmControlView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmControlView.cs @@ -1,5 +1,7 @@ using Sarand.Core.Base; using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Core.Mgr; using System; using System.Collections.Generic; @@ -7,7 +9,7 @@ using System.Runtime.CompilerServices; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public abstract class SlmControlView : SlmContentView @@ -20,11 +22,9 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base // Components. private SlmContentView outerView = new SlmContentView(); private SlmContentView embeddedView = new SlmContentView(); - private readonly SlmLabel labelReadOnly = new SlmLabel(); // Styling. private Thickness borderThickness = new Thickness(); private Color borderColor = Color.Transparent; - private bool readOnly = false; //------------------------------------------------------------------- // Construction. @@ -40,8 +40,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base BorderWidth = SlmMobile.ControlBorderWidth; // Read-only label configuration. - labelReadOnly.BackgroundColor = Color.Transparent; - labelReadOnly.Margin = new Thickness(SlmMobile.LabelMargin.Left, SlmMobile.LabelMargin.Top); + ReadOnlyLabel.BackgroundColor = Color.Transparent; + ReadOnlyLabel.Margin = new Thickness(SlmMobile.LabelMargin.Left, SlmMobile.LabelMargin.Top); SetControlActivity(); } @@ -51,6 +51,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base // Label. public SlmLabel Label { get; } = new SlmLabel() { Text = "" }; public String LabelText { get { return Label.Text; } set { if (Label.Text.Equals(value)) return; Label.Text = value; } } + /// Control used for read-only display. + protected SlmLabel ReadOnlyLabel { get; } = new SlmLabel() { Text = "" }; // Styling. public Thickness BorderThickness { @@ -62,21 +64,16 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base set { BorderThickness = new Thickness(value); } } public Color BorderColor { get; set; } - public bool ReadOnly - { - get { return readOnly; } - set { if (readOnly == value) return; readOnly = value; SetControlActivity(); } - } protected String ReadOnlyText { - get{ return labelReadOnly.Text; } - set { if (labelReadOnly.Text.Equals(value)) return; labelReadOnly.Text = value; } + get{ return ReadOnlyLabel.Text; } + set { if (ReadOnlyLabel.Text.Equals(value)) return; ReadOnlyLabel.Text = value; } } //------------------------------------------------------------------- // C o n f i g u r e C o m p o n e n t s //------------------------------------------------------------------- - /// Control configuration that can b changed dynamically. + /// Control configuration that can be changed dynamically. protected override void ConfigureComponents () { // Outer view acts as border. @@ -93,11 +90,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base protected override void SetControlActivity () { base.SetControlActivity(); - SetControlsReadOnly(); } protected override void SetControlsReadOnly () { - if (readOnly) Content = labelReadOnly; + base.SetControlsReadOnly(); + if (ReadOnly) Content = ReadOnlyLabel; } //------------------------------------------------------------------- @@ -118,21 +115,12 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // V i e w E v e n t s //------------------------------------------------------------------- - protected override void OnParentSet () - { - base.OnParentSet(); - } - //------------------------------------------------------------------- - protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) - { - base.OnPropertyChanging(propertyName); - } protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); //Logger.Debug(GetType().Name + ".OnPropertyChanged Name=" + propertyName); - if (propertyName.EqualsCI("Padding")) + if (propertyName.EqualsCI(PaddingProperty.PropertyName)) { if (!embeddedView.Padding.Equals(Padding)) { @@ -141,25 +129,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base Padding = new Thickness(); } } - else if (propertyName.EqualsCI("BackgroundColor")) + else if (propertyName.EqualsCI(BackgroundColorProperty.PropertyName)) { embeddedView.BackgroundColor = BackgroundColor; } } - //------------------------------------------------------------------- - protected override void OnChildAdded (Element child) - { - base.OnChildAdded(child); - } - protected override void OnChildRemoved (Element child) - { - base.OnChildRemoved(child); - } - //------------------------------------------------------------------- - protected override void OnSizeAllocated (double width, double height) - { - base.OnSizeAllocated(width, height); - } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmDatePickerView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmDatePickerView.cs similarity index 83% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmDatePickerView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmDatePickerView.cs index b5a8dc9..aea9cfb 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmDatePickerView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmDatePickerView.cs @@ -1,13 +1,12 @@ using Sarand.Core.Base; -using Sarand.Core.Mobile.Forms.Controls; -using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public class SlmDatePickerView : SlmControlView @@ -48,7 +47,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // C o n f i g u r e C o m p o n e n t s //------------------------------------------------------------------- - /// Control configuration that can b changed dynamically. + /// Control configuration that can be changed dynamically. protected override void ConfigureComponents () { base.ConfigureComponents(); @@ -60,7 +59,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base protected override void SetControlActivity () { base.SetControlActivity(); - SetControlsReadOnly(); + DatePicker.IsEnabled = IsEnabled; } protected override void SetControlsReadOnly () { @@ -71,11 +70,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // V i e w E v e n t s //------------------------------------------------------------------- - protected override void OnParentSet () - { - base.OnParentSet(); - } - //------------------------------------------------------------------- protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) { base.OnPropertyChanging(propertyName); @@ -83,16 +77,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); - //Logger.Debug(GetType().Name + ".OnPropertyChanged Name=" + propertyName); - } - //------------------------------------------------------------------- - protected override void OnChildAdded (Element child) - { - base.OnChildAdded(child); - } - protected override void OnChildRemoved (Element child) - { - base.OnChildRemoved(child); } //------------------------------------------------------------------- protected override void OnSizeAllocated (double width, double height) diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmDateTimePickerView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmDateTimePickerView.cs new file mode 100644 index 0000000..e228798 --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmDateTimePickerView.cs @@ -0,0 +1,97 @@ +using Sarand.Core.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Text; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews +{ + //======================================================================= + public class SlmDateTimePickerView : SlmControlView + { + //------------------------------------------------------------------- + // Definitions. + + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SlmDateTimePickerView (SlmDateTimePicker suppliedPicker = null) + { + // Control configuration. + if (suppliedPicker != null) DateTimePicker = suppliedPicker; + DateTimePicker.BackgroundColor = Color.Transparent; + + // Control events. + DateTimePicker.BackgroundColor = Color.Transparent; + DateTimePicker.DateSelected += DateTimePicker_DateSelected; + DateTimePicker.Focused += DateTimePicker_Focused; + DateTimePicker.Unfocused += DateTimePicker_Unfocused; + + ConfigureComponents(); + SetControlActivity(); + } + + //------------------------------------------------------------------- + // Properties. + protected SlmDateTimePicker DateTimePicker { get; } = new SlmDateTimePicker(); + public DateTime DateTime + { + get { return DateTimePicker.DateTime; } + set { if (DateTimePicker.DateTime.CompareTo(value) == 0) return; DateTimePicker.DateTime = value; } + } + + //------------------------------------------------------------------- + // C o n f i g u r e C o m p o n e n t s + //------------------------------------------------------------------- + /// Control configuration that can be changed dynamically. + protected override void ConfigureComponents () + { + base.ConfigureComponents(); + } + + //------------------------------------------------------------------- + // C o n t r o l A c t i v i t y + //------------------------------------------------------------------- + protected override void SetControlActivity () + { + base.SetControlActivity(); + DateTimePicker.IsEnabled = IsEnabled; + } + protected override void SetControlsReadOnly () + { + base.SetControlsReadOnly(); + if (!ReadOnly) Content = DateTimePicker; + } + + //------------------------------------------------------------------- + // V i e w E v e n t s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + // C o n t r o l E v e n t s + //------------------------------------------------------------------- + public event EventHandler DateSelected; + private void DateTimePicker_DateSelected (object sender, DateChangedEventArgs e) + { + ReadOnlyText = DateTimePicker.FormattedDateTime; + if (ReadOnly) return; + if (DateSelected != null) DateSelected.Invoke(sender, e); + } + //------------------------------------------------------------------- + private void DateTimePicker_Focused (object sender, FocusEventArgs e) + { + Control_Focused(sender, e); + } + private void DateTimePicker_Unfocused (object sender, FocusEventArgs e) + { + Control_Unfocused(sender, e); + } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEditorView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmEditorView.cs similarity index 74% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEditorView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmEditorView.cs index 8190c53..908f4ee 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEditorView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmEditorView.cs @@ -1,13 +1,12 @@ using Sarand.Core.Base; -using Sarand.Core.Mobile.Forms.Controls; -using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public class SlmEditorView : SlmControlView @@ -17,20 +16,21 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Data members. - private readonly SlmEditor entry = new SlmEditor(); + private readonly SlmEditor editorControl = new SlmEditor(); //------------------------------------------------------------------- // Construction. public SlmEditorView () { // Control configuration. - entry.BackgroundColor = Color.Transparent; + editorControl.BackgroundColor = Color.Transparent; + EditorVerticalOptions = LayoutOptions.FillAndExpand; // Editor events. - entry.Focused += Editor_Focused; - entry.Unfocused += Editor_Unfocused; - entry.TextChanged += Editor_TextChanged; - entry.Completed += Editor_Completed; + editorControl.Focused += Editor_Focused; + editorControl.Unfocused += Editor_Unfocused; + editorControl.TextChanged += Editor_TextChanged; + editorControl.Completed += Editor_Completed; ConfigureComponents(); SetControlActivity(); @@ -40,18 +40,37 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base // Properties. public int MaxLength { - get { return entry.MaxLength; } - set { entry.MaxLength = value; } + get { return editorControl.MaxLength; } + set { editorControl.MaxLength = value; } } public Keyboard Keyboard { - get { return entry.Keyboard; } - set { entry.Keyboard = value; } + get { return editorControl.Keyboard; } + set { editorControl.Keyboard = value; } } public String Text { - get { return entry.Text; } - set { value = StringUtil.EmptyOnNull(value); if (entry.Text != null && entry.Text.Equals(value)) return; entry.Text = value; } + get { return editorControl.Text; } + set { value = StringUtil.EmptyOnNull(value); if (editorControl.Text != null && editorControl.Text.Equals(value)) return; editorControl.Text = value; } + } + // Editor configuration. + public LayoutOptions EditorVerticalOptions + { + get { return editorControl.VerticalOptions; } + set + { + editorControl.VerticalOptions = value; + ReadOnlyLabel.VerticalOptions = value; + } + } + public LayoutOptions EditorHorizontalOptions + { + get { return editorControl.HorizontalOptions; } + set + { + editorControl.HorizontalOptions = value; + ReadOnlyLabel.HorizontalOptions = value; + } } //------------------------------------------------------------------- @@ -74,7 +93,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base protected override void SetControlsReadOnly () { base.SetControlsReadOnly(); - if (!ReadOnly) Content = entry; + if (!ReadOnly) Content = editorControl; } //------------------------------------------------------------------- @@ -94,7 +113,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base public event EventHandler TextChanged; private void Editor_TextChanged (object sender, TextChangedEventArgs e) { - ReadOnlyText = entry.Text; + ReadOnlyText = editorControl.Text; if (ReadOnly) return; if (TextChanged != null) TextChanged.Invoke(sender, e); } diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntryView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmEntryView.cs similarity index 97% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntryView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmEntryView.cs index 9c4f648..dfb2004 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntryView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmEntryView.cs @@ -1,13 +1,13 @@ using Sarand.Core.Base; using Sarand.Core.Mobile.Forms.Controls; -using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public class SlmEntryView : SlmControlView diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmLabelView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmLabelView.cs similarity index 93% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmLabelView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmLabelView.cs index a6997e3..45c16db 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmLabelView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmLabelView.cs @@ -7,7 +7,7 @@ using System.Runtime.CompilerServices; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public class SlmLabelView : SlmControlView @@ -38,7 +38,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // C o n f i g u r e C o m p o n e n t s //------------------------------------------------------------------- - /// Control configuration that can b changed dynamically. + /// Control configuration that can be changed dynamically. protected override void ConfigureComponents () { ReadOnly = true; diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPickerView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView.cs similarity index 72% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPickerView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView.cs index b86b701..fdcd993 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPickerView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView.cs @@ -1,13 +1,15 @@ using Sarand.Core.Base; +using Sarand.Core.Bus; using Sarand.Core.Mobile.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public class SlmPickerView : SlmControlView @@ -48,22 +50,67 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base get { return picker.SelectedIndex; } set { if (picker.SelectedIndex == value) return; picker.SelectedIndex = value; } } + //public object SelectedItem { get { return picker.SelectedItem; } set { picker.SelectedItem = value; } } public SlmPicker.SlmPickerItem SelectedPickerItem { get { return picker.SelectedPickerItem; } } - public object SelectedItem + public SysId SelectedItemId { - get { return picker.SelectedItem; } - set { picker.SelectedItem = value; } + get { return picker.SelectedItemId; } + set { picker.SelectedItemId = value; } + } + public String SelectedItemCode + { + get { return picker.SelectedItemCode; } + set { picker.SelectedItemCode = value; } } //------------------------------------------------------------------- // C o n f i g u r e C o m p o n e n t s //------------------------------------------------------------------- - /// Control configuration that can b changed dynamically. + /// Control configuration that can be changed dynamically. protected override void ConfigureComponents () { base.ConfigureComponents(); } + //------------------------------------------------------------------- + // P i c k e r D a t a + //------------------------------------------------------------------- + /// + /// Does the list contain an item with the same Id. + /// NB Invalid Id values are matched. + /// + public bool ContainsId (SysId id) + { + return picker.ContainsItemId(id); + } + /// + /// Does the list contain an item with the same code. + /// NB Codes are case-insensitive. + /// + public bool ContainsCode (string code) + { + return picker.ContainsItemCode(code); + } + //------------------------------------------------------------------- + /// + /// Add an item identified by a SysId value. + /// NB Fails if an item already exists with the same id. + /// + public bool AddItem (SysId id, String caption) + { + picker.AddItem(id, caption); + return true; + } + /// + /// Add an item identified by a code value. + /// NB Fails if an item already exists with the same case-insensitive code. + /// + public bool AddItem (String code, String caption) + { + picker.AddItem(code, caption); + return true; + } + //------------------------------------------------------------------- // C o n t r o l A c t i v i t y //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_CodeType.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_CodeType.cs similarity index 94% rename from SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_CodeType.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_CodeType.cs index 248dcb6..d1ccae1 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_CodeType.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_CodeType.cs @@ -1,19 +1,17 @@ using Sarand.Core.Base; -using Sarand.Core.Bus; using Sarand.Core.CodeTypes; using Sarand.Core.Tasks; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.CodeTypes; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Mgr; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public class SlmPickerView_CodeType : SlmPickerView @@ -29,16 +27,15 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls get { return (Picker as SlmPicker_CodeType).CodeType; } set { (Picker as SlmPicker_CodeType).CodeType = value; } } - public bool ContainsCode (String code) - { - return Picker.ContainsItemCode(code); - } public String SelectedCode { get { return (Picker as SlmPicker_CodeType).SelectedCode; } set { (Picker as SlmPicker_CodeType).SelectedCode = value; } } + //------------------------------------------------------------------- + // Utilities. + //------------------------------------------------------------------- } //======================================================================= diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_Companies.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_Companies.cs similarity index 97% rename from SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_Companies.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_Companies.cs index e8efa76..ef267e8 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_Companies.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_Companies.cs @@ -4,7 +4,7 @@ using Sarand.Core.Tasks; using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Mgr; using System; using System.Collections.Generic; @@ -12,7 +12,7 @@ using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public class SlmPickerView_Companies : SlmPickerView diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SiteDefinitions.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_SiteDefinitions.cs similarity index 89% rename from SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SiteDefinitions.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_SiteDefinitions.cs index a3b5eef..bd70cb1 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SiteDefinitions.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_SiteDefinitions.cs @@ -1,19 +1,13 @@ using Sarand.Core.Base; -using Sarand.Core.Bus; -using Sarand.Core.CodeTypes; -using Sarand.Core.Tasks; -using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.CodeTypes; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Mgr; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public class SlmPickerView_SiteDefinitions : SlmPickerView diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SystemCodes.cs b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_SystemCodes.cs similarity index 86% rename from SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SystemCodes.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_SystemCodes.cs index 25f94d1..11a2a4b 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPickerView_SystemCodes.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/ControlViews/SlmPickerView_SystemCodes.cs @@ -1,19 +1,13 @@ using Sarand.Core.Base; -using Sarand.Core.Bus; -using Sarand.Core.CodeTypes; -using Sarand.Core.Tasks; using Sarand.LogisticsMgr.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.CodeTypes; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Mgr; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews { //======================================================================= public class SlmPickerView_SystemCodes : SlmPickerView @@ -60,10 +54,12 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls public void PopulateSystemCodes () { Items.Clear(); + if (systemCodes.Count > 1) + AddItem("", ""); foreach (TypeCodeDesc systemCode in systemCodes) - { AddItem(systemCode.Code, systemCode.Desc); - } + if (systemCodes.Count == 1) + SelectedItemCode = systemCodes[0].Code; } //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmDatePicker.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmDatePicker.cs similarity index 91% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmDatePicker.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmDatePicker.cs index 67e809d..4322642 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmDatePicker.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmDatePicker.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls { //======================================================================= public class SlmDatePicker : SaxDatePicker @@ -30,7 +30,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base // Properties. //------------------------------------------------------------------- - // P i c k e r E v e n t s + // C o n t r o l E v e n t s //------------------------------------------------------------------- //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmDateTimePicker.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmDateTimePicker.cs new file mode 100644 index 0000000..37029c9 --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmDateTimePicker.cs @@ -0,0 +1,39 @@ +using Sarand.Core.Base; +using Sarand.Core.Bus; +using Sarand.Core.Mobile.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.App; +using System; +using System.Collections.Generic; +using System.Text; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls +{ + //======================================================================= + public class SlmDateTimePicker : SaxDateTimePicker + { + //------------------------------------------------------------------- + // Definitions. + + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SlmDateTimePicker () + { + // Font sizing. + FontSize = FontSize * SlmMobile.FontSizeRatio; + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // C o n t r o l E v e n t s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEditor.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmEditor.cs similarity index 78% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEditor.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmEditor.cs index 39e0197..dd82029 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEditor.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmEditor.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls { //======================================================================= public class SlmEditor : SaxEditor @@ -27,6 +27,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Properties. + //------------------------------------------------------------------- + // C o n t r o l E v e n t s + //------------------------------------------------------------------- + //------------------------------------------------------------------- } //======================================================================= diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntry.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmEntry.cs similarity index 78% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntry.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmEntry.cs index 2984ab2..948ca3d 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmEntry.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmEntry.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls { //======================================================================= public class SlmEntry : SaxEntry @@ -27,6 +27,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Properties. + //------------------------------------------------------------------- + // C o n t r o l E v e n t s + //------------------------------------------------------------------- + //------------------------------------------------------------------- } //======================================================================= diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmImageButton.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmImageButton.cs new file mode 100644 index 0000000..bd22836 --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmImageButton.cs @@ -0,0 +1,33 @@ +using Sarand.Core.Mobile.Forms.Controls; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls +{ + //======================================================================= + public class SlmImageButton : SaxImageButton + { + //------------------------------------------------------------------- + // Definitions. + + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SlmImageButton () + { + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // C o n t r o l E v e n t s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmLabel.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmLabel.cs similarity index 79% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmLabel.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmLabel.cs index d844de7..e85488d 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmLabel.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmLabel.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls { //======================================================================= public class SlmLabel : SaxLabel @@ -30,6 +30,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Properties. + //------------------------------------------------------------------- + // C o n t r o l E v e n t s + //------------------------------------------------------------------- + //------------------------------------------------------------------- } //======================================================================= diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPicker.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPicker.cs similarity index 90% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPicker.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPicker.cs index 8d60d19..793ee7e 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPicker.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmPicker.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls { //======================================================================= public class SlmPicker : SaxPicker @@ -30,7 +30,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base // Properties. //------------------------------------------------------------------- - // P i c k e r E v e n t s + // C o n t r o l E v e n t s //------------------------------------------------------------------- //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmTabControl.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmTabControl.cs new file mode 100644 index 0000000..46f6bd7 --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmTabControl.cs @@ -0,0 +1,34 @@ +using Sarand.Core.Mobile.Forms.Controls; +using Sarand.Core.Mobile.Forms.Views; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls +{ + //======================================================================= + public class SlmTabControl : SaxTabControl + { + //------------------------------------------------------------------- + // Definitions. + + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SlmTabControl () + { + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // C o n t r o l E v e n t s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmTimePicker.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmTimePicker.cs new file mode 100644 index 0000000..f0ead42 --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Controls/SlmTimePicker.cs @@ -0,0 +1,39 @@ +using Sarand.Core.Base; +using Sarand.Core.Bus; +using Sarand.Core.Mobile.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.App; +using System; +using System.Collections.Generic; +using System.Text; +using Xamarin.Forms; + +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls +{ + //======================================================================= + public class SlmTimePicker : SaxTimePicker + { + //------------------------------------------------------------------- + // Definitions. + + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SlmTimePicker () + { + // Font sizing. + FontSize = FontSize * SlmMobile.FontSizeRatio; + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + // C o n t r o l E v e n t s + //------------------------------------------------------------------- + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmStackLayout.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Layouts/SlmStackLayout.cs similarity index 93% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmStackLayout.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Layouts/SlmStackLayout.cs index bed0768..0502de9 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmStackLayout.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Layouts/SlmStackLayout.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts { //======================================================================= public class SlmStackLayout : SaxStackLayout diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentPage.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Pages/SlmContentPage.cs similarity index 97% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentPage.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Pages/SlmContentPage.cs index 8f0e4e4..684440f 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentPage.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Pages/SlmContentPage.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Pages { //======================================================================= public class SlmContentPage : SaxContentPage diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFormPage.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Pages/SlmFormPage.cs similarity index 94% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFormPage.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Pages/SlmFormPage.cs index 06e748f..533eac5 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFormPage.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Pages/SlmFormPage.cs @@ -1,6 +1,9 @@ using Sarand.Core.Mobile.Forms.Controls; using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Core.Mgr; using System; using System.Collections.Generic; @@ -9,7 +12,7 @@ using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Pages { //======================================================================= public abstract class SlmFormPage : SlmContentPage @@ -143,20 +146,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base buttonClose.Clicked += ButtonClose_Clicked; } - //------------------------------------------------------------------- - /// - /// Add label and control to form grid. - /// NB Control takes up 2 rows by default to allow for control pairs (control + button etc). - /// - protected static void AddControlViewToGrid (SlmGrid grid, SlmControlView controlView) - { - int rowIdx = grid.RowDefinitions.Count; - grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); - grid.Children.Add(controlView.Label, 0, rowIdx); - grid.Children.Add(controlView, 1, rowIdx); - Grid.SetColumnSpan(controlView, 2); - } - //------------------------------------------------------------------- // C o n f i g u r e F o r m //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmMainPanel.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmMainPanel.cs similarity index 96% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmMainPanel.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmMainPanel.cs index 6c44cda..9d1dab5 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmMainPanel.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmMainPanel.cs @@ -8,7 +8,7 @@ using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels { //======================================================================= public class SlmMainPanel : SlmPanel @@ -29,7 +29,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base { this.config = new Config(); } - protected SlmMainPanel (Config config) + protected SlmMainPanel (Config config) : base(config) { this.config = config; } diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPanel.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel.cs similarity index 70% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPanel.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel.cs index d133810..fd3288e 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmPanel.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel.cs @@ -1,4 +1,5 @@ using Sarand.LogisticsMgr.Mobile.Core.App; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using Sarand.LogisticsMgr.Mobile.Core.Mgr; using System; using System.Collections.Generic; @@ -8,7 +9,7 @@ using System.Text; using System.Threading.Tasks; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels { //======================================================================= public class SlmPanel : SlmContentView @@ -17,6 +18,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base // Definitions. public class Config { + public Boolean ReadOnly { get; set; } } //------------------------------------------------------------------- @@ -57,41 +59,16 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- protected override void SetControlActivity () { + base.SetControlActivity(); } protected override void SetControlsReadOnly () { + base.SetControlsReadOnly(); } //------------------------------------------------------------------- // P a n e l E v e n t s //------------------------------------------------------------------- - protected override void OnParentSet () - { - base.OnParentSet(); - } - //------------------------------------------------------------------- - protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) - { - base.OnPropertyChanging(propertyName); - } - protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) - { - base.OnPropertyChanged(propertyName); - } - //------------------------------------------------------------------- - protected override void OnChildAdded (Element child) - { - base.OnChildAdded(child); - } - protected override void OnChildRemoved (Element child) - { - base.OnChildRemoved(child); - } - //------------------------------------------------------------------- - protected override void OnSizeAllocated (double width, double height) - { - base.OnSizeAllocated(width, height); - } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_AssociatedItems.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_AssociatedItems.cs index 53b3b34..897ae67 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_AssociatedItems.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_AssociatedItems.cs @@ -1,9 +1,9 @@ using Sarand.Core.App; using Sarand.Core.Mobile.Utils; -using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App; -using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; -using Sarand.LogisticsMgr.Mobile.Core.Mgr; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts; +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; using System; using System.Collections.Generic; using System.Text; @@ -23,10 +23,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels //------------------------------------------------------------------- // Data members. private Config config; - private SlmAccountMgr_Mobile accountMgr; - private SlmBerthingMgr_Mobile berthingMgr; - private SlmAssetMgr_Mobile assetMgr; - private SlmWebServiceClient webServiceClient; // Layout. private SlmFrame viewPanel = new SlmFrame(); private SlmStackLayout stackLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical }; @@ -118,18 +114,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels get { return labelCaption.Text; } set { if (labelCaption.Text.Equals(value)) return; labelCaption.Text = value; } } - // Session. - protected SlmUserContext_Mobile UserContext { get { return SlmGlobals_Mobile.SessionProfile.UserContext_Mobile; } } - protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } } // Layout. protected SlmPanel SummaryPanel { get { return panelSummary; } } protected SlmPanel DetailsPanel { get { return panelDetails; } } protected String ErrorStateMessage { get; set; } - // Managers. - protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } } - protected SlmBerthingMgr_Mobile BerthingMgr { get { if (berthingMgr == null) berthingMgr = new SlmBerthingMgr_Mobile(SessionContext); return berthingMgr; } } - protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } } - public SlmWebServiceClient WebServiceClient { get { if (webServiceClient == null) webServiceClient = new SlmWebServiceClient(); return webServiceClient; } } + // NB Session properties, managers and WebService are defined in SlmContentView. //------------------------------------------------------------------- // I t e m s T o g g l e diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_ItemProperties.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_ItemProperties.cs new file mode 100644 index 0000000..8903947 --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_ItemProperties.cs @@ -0,0 +1,36 @@ +using Sarand.LogisticsMgr.Mobile.Core.Forms.Views; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels +{ + //======================================================================= + public class SlmPanel_ItemProperties : SlmContentView + { + //------------------------------------------------------------------- + // Definitions. + public class Config + { + public bool ReadOnly { get; set; } + } + + //------------------------------------------------------------------- + // Data members. + private Config config; + + //------------------------------------------------------------------- + // Construction. + public SlmPanel_ItemProperties (Config config) + { + this.config = config; + } + + //------------------------------------------------------------------- + // Properties. + public bool AddMode { get; protected set; } + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_PropertySummary.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_PropertySummary.cs new file mode 100644 index 0000000..5b6877a --- /dev/null +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Panels/SlmPanel_PropertySummary.cs @@ -0,0 +1,29 @@ +using Sarand.Core.Mobile.Forms.Panels; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels +{ + //======================================================================= + public class SlmPanel_PropertySummary : SaxPanel_PropertySummary + { + //------------------------------------------------------------------- + // Definitions. + + //------------------------------------------------------------------- + // Data members. + + //------------------------------------------------------------------- + // Construction. + public SlmPanel_PropertySummary () + { + } + + //------------------------------------------------------------------- + // Properties. + + //------------------------------------------------------------------- + } + //======================================================================= +} diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmContentView.cs similarity index 72% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmContentView.cs index 4115806..12b84a5 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmContentView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmContentView.cs @@ -1,4 +1,5 @@ using Sarand.Core.Mobile.Forms.Views; +using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Mgr; using System; @@ -9,7 +10,7 @@ using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views { //======================================================================= public class SlmContentView : SaxContentView @@ -22,6 +23,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base private SlmAccountMgr_Mobile accountMgr = null; private SlmBerthingMgr_Mobile berthingMgr = null; private SlmAssetMgr_Mobile assetMgr = null; + private SlmWebServiceClient webServiceClient; //------------------------------------------------------------------- // Construction. @@ -31,11 +33,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Properties. + // Session. + protected SlmUserContext_Mobile UserContext { get { return SlmGlobals_Mobile.SessionProfile.UserContext_Mobile; } } protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } } // Managers. protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } } protected SlmBerthingMgr_Mobile BerthingMgr { get { if (berthingMgr == null) berthingMgr = new SlmBerthingMgr_Mobile(SessionContext); return berthingMgr; } } protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } } + public SlmWebServiceClient WebServiceClient { get { if (webServiceClient == null) webServiceClient = new SlmWebServiceClient(); return webServiceClient; } } //------------------------------------------------------------------- // C o n f i g u r e C o m p o n e n t s @@ -49,41 +54,16 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- protected override void SetControlActivity () { + base.SetControlActivity(); } protected override void SetControlsReadOnly () { + base.SetControlsReadOnly(); } //------------------------------------------------------------------- // V i e w E v e n t s //------------------------------------------------------------------- - protected override void OnParentSet () - { - base.OnParentSet(); - } - //------------------------------------------------------------------- - protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) - { - base.OnPropertyChanging(propertyName); - } - protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) - { - base.OnPropertyChanged(propertyName); - } - //------------------------------------------------------------------- - protected override void OnChildAdded (Element child) - { - base.OnChildAdded(child); - } - protected override void OnChildRemoved (Element child) - { - base.OnChildRemoved(child); - } - //------------------------------------------------------------------- - protected override void OnSizeAllocated (double width, double height) - { - base.OnSizeAllocated(width, height); - } //------------------------------------------------------------------- } diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFrame.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmFrame.cs similarity index 93% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFrame.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmFrame.cs index f62c60d..dd85f8a 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmFrame.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmFrame.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; using System.Text; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views { //======================================================================= public class SlmFrame : SaxFrame diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmGrid.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmGrid.cs similarity index 72% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmGrid.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmGrid.cs index b9515e0..c4efd47 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmGrid.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmGrid.cs @@ -1,11 +1,12 @@ using Sarand.Core.Mobile.Forms.Templates; +using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views { //======================================================================= public class SlmGrid : SaxGrid @@ -25,6 +26,21 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base //------------------------------------------------------------------- // Properties. + //------------------------------------------------------------------- + /// + /// Add label and control to form grid. + /// NB Control takes up 2 rows by default to allow for control pairs (control + button etc). + /// + public void AddControlViewToGrid (SlmControlView controlView, ushort controlColumnSpan = 2) + { + int rowIdx = RowDefinitions.Count; + RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + Children.Add(controlView.Label, 0, rowIdx); + Children.Add(controlView, 1, rowIdx); + if (controlColumnSpan > 0) + SetColumnSpan(controlView, 2); + } + //------------------------------------------------------------------- // G r i d E v e n t s //------------------------------------------------------------------- diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmScrollView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmScrollView.cs similarity index 97% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmScrollView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmScrollView.cs index 8f297e3..fc237f7 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmScrollView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmScrollView.cs @@ -6,7 +6,7 @@ using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views { //======================================================================= public class SlmScrollView : ScrollView diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmView.cs similarity index 92% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmView.cs index abd5396..48512db 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmView.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views { //======================================================================= public class SlmView : SaxView diff --git a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmWebView.cs b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmWebView.cs similarity index 97% rename from SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmWebView.cs rename to SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmWebView.cs index 5553116..e0fe3f4 100644 --- a/SaLogMgrMobCore/Mobile/Core/Forms/Base/SlmWebView.cs +++ b/SaLogMgrMobCore/Mobile/Core/Forms/Views/SlmWebView.cs @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.Text; using Xamarin.Forms; -namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base +namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views { //======================================================================= public class SlmWebView : SaxWebView diff --git a/SaLogMgrMobCore/SaLogMgrMobCore.csproj b/SaLogMgrMobCore/SaLogMgrMobCore.csproj index 370fd3d..9672b44 100644 --- a/SaLogMgrMobCore/SaLogMgrMobCore.csproj +++ b/SaLogMgrMobCore/SaLogMgrMobCore.csproj @@ -6,7 +6,7 @@ - +