Exemplo n.º 1
0
        public ActivityLogDetailsView(Model.ActivityLogList model)
        {
            _iBatteryListDisplayedID = 0;
            // Bind our BindingContext
            Model = model;

            NavigationPage.SetHasNavigationBar(this, true);

            InitializeComponent();
            //
            LoadFields();
            //
            // Save Button
            btnSaveSC.Clicked += (sender, e) => {
                // Save the Date/Time value.
                Model.LogDateTime = PickerLogDate.Date;
                Model.LogDateTime = Model.LogDateTime.Add(PickerLogTime.Time);
                if ((EntryMinutes.Text != "") && (EntrySeconds.Text != ""))
                {
                    int iMinutesInSecs = Convert.ToInt32(EntryMinutes.Text) * 60;
                    int iTimeInSecs    = iMinutesInSecs + Convert.ToInt32(EntrySeconds.Text);
                    Model.LogTimeInSeconds = iTimeInSecs;
                }
                ActivityLog ALRec = TransferToActivityLogRec(Model);
                Model.ID = App.Database.SaveActivityLog(ALRec);
                Navigation.PopAsync();
            };
            //
            // Cancel Button
            btnCancelSC.Clicked += (sender, e) => {
                Navigation.PopAsync();
            };
            //
            // Delete Button
            btnDeleteSC.Clicked += (sender, e) => {
                App.Database.DeleteActivityLog(Model.ID);
                Navigation.PopAsync();
            };
            //
            // Display Item Name list
            entryActivityType.Focused += (sender, e) =>
            {
                _sCurrentListType = "ACTIVITYTYPE";
                // create a new details view with the item
                var view = new ListDataListView(_sCurrentListType, true);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Item Name list
            entryModelName.Focused += (sender, e) =>
            {
                // create a new details view with the item
                var view = new RCModelListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Battery 1 Name list
            entryBattery1Name.Focused += (sender, e) =>
            {
                _iBatteryListDisplayedID = 1;
                // create a new details view with the item
                var view = new BatteryListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Battery 2 Name list
            entryBattery2Name.Focused += (sender, e) =>
            {
                _iBatteryListDisplayedID = 2;
                // create a new details view with the item
                var view = new BatteryListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
        }
        public ActivityLogDetailsView(Model.ActivityLogList model)
        {
            _iBatteryListDisplayedID = 0;
            // Bind our BindingContext
            Model = model;

            NavigationPage.SetHasNavigationBar(this, true);

            InitializeComponent();
            //
            LoadFields();
            //
            // Save Button
            btnSaveSC.Clicked += (sender, e) => {
                // Save the Date/Time value.
                Model.LogDateTime = PickerLogDate.Date;
                Model.LogDateTime = Model.LogDateTime.Add(PickerLogTime.Time);
                if ((EntryMinutes.Text != "") && (EntrySeconds.Text != ""))
                {
                    int iMinutesInSecs = Convert.ToInt32(EntryMinutes.Text) * 60;
                    int iTimeInSecs = iMinutesInSecs + Convert.ToInt32(EntrySeconds.Text);
                    Model.LogTimeInSeconds = iTimeInSecs;
                }
                ActivityLog ALRec = TransferToActivityLogRec(Model);
                Model.ID = App.Database.SaveActivityLog(ALRec);
                Navigation.PopAsync();
            };
            //
            // Cancel Button
            btnCancelSC.Clicked += (sender, e) => {
                Navigation.PopAsync();
            };
            //
            // Delete Button
            btnDeleteSC.Clicked += (sender, e) => {
                App.Database.DeleteActivityLog(Model.ID);
                Navigation.PopAsync();
            };
            //
            // Display Item Name list
            entryActivityType.Focused += (sender, e) =>
            {
                _sCurrentListType = "ACTIVITYTYPE";
                // create a new details view with the item
                var view = new ListDataListView(_sCurrentListType, true);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Item Name list
            entryModelName.Focused += (sender, e) =>
            {
                // create a new details view with the item
                var view = new RCModelListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Battery 1 Name list
            entryBattery1Name.Focused += (sender, e) =>
            {
                _iBatteryListDisplayedID = 1;
                // create a new details view with the item
                var view = new BatteryListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
            //
            // Display Battery 2 Name list
            entryBattery2Name.Focused += (sender, e) =>
            {
                _iBatteryListDisplayedID = 2;
                // create a new details view with the item
                var view = new BatteryListView(false);
                //// tell the navigator to show the new view
                Navigation.PushAsync(view);
            };
        }