Beispiel #1
0
        private async void OnLogIn()
        {
            PopupVM.ShowPopup(Framework.Resx.UIStringResource.Loading, false);

            this.FromLogInFromLogInPage = true;
            var client = new Elmah.WebApiClient.AuthenticationApiClient(Elmah.MVVMLightViewModels.WebServiceConfig.WebApiRootUrl);

            LoginResponse = await client.LogInAsync(this.Email, this.Password);

            if (LoginResponse.Succeeded)
            {
                LoginResponse.LoggedInSource = Framework.WebApi.LoggedInSource.LogInPage;
                PopupVM.HidePopup();
                this.ErrorMessage = string.Empty;

                await Framework.Xaml.ApplicationPropertiesHelper.SetSignInData(
                    this.Email
                    , this.RememberMe?this.Password : null
                    , this.RememberMe, this.AutoSignIn, LoginResponse.Token, LoginResponse.EntityID ?? 0, !LoginResponse.EntityID.HasValue, null);

                AppVM.SignInData = Framework.Xaml.ApplicationPropertiesHelper.GetSignInData();
                this.IsVisible   = false;

                App.Current.MainPage = new NavigationPage(new Elmah.XamarinForms.Pages.AppLoadingPage());
                MessagingCenter.Send <Elmah.XamarinForms.ViewModels.AppLoadingVM, Framework.WebApi.AuthenticationResponse>(AppLoadingVM, Elmah.XamarinForms.ViewModels.AppLoadingVM.MessageTitle_LoadData, LoginResponse);
            }
            else
            {
                this.ErrorMessage = Framework.Resx.UIStringResource.Account_LogIn_FailureText;
                //PopupVM.HidePopup();
            }
        }
Beispiel #2
0
            //public ICommand ShowItemBottomUpActionSheetCommand => new Command<Elmah.DataSourceEntities.ElmahType>(OnShowItemBottomUpActionSheetCommand);

            //private void OnShowItemBottomUpActionSheetCommand(Elmah.DataSourceEntities.ElmahType item)
            //{
            //    var selectedActionItemModels = new List<Tuple<Framework.Xaml.StandardRouteRelativeKey, Framework.Xaml.ControlParentOptions>>();
            //
            //    selectedActionItemModels.Add(new Tuple<Framework.Xaml.StandardRouteRelativeKey, Framework.Xaml.ControlParentOptions>(Framework.Xaml.StandardRouteRelativeKey., Framework.Xaml.ControlParentOptions.InPopup));
            //
            //    var actionSheetVM = GetItemActionSheet(item, selectedActionItemModels);
            //
            //    PopupVM.ShowBottomUpActionSheet(actionSheetVM);
            //}

            //public Framework.Xaml.ActionForm.ActionSheetVM GetItemInlineActionSheet(Elmah.DataSourceEntities.ElmahType item)
            //{
            //    var selectedActionItemModels = new List<Tuple<Framework.Xaml.StandardRouteRelativeKey, Framework.Xaml.ControlParentOptions>>();
            //
            //    selectedActionItemModels.Add(new Tuple<Framework.Xaml.StandardRouteRelativeKey, Framework.Xaml.ControlParentOptions>(Framework.Xaml.StandardRouteRelativeKey., Framework.Xaml.ControlParentOptions.InPopup));
            //
            //    return GetItemActionSheet(item, selectedActionItemModels);
            //}

            //public Framework.Xaml.ActionForm.ActionSheetVM GetItemActionSheet(
            //    Elmah.DataSourceEntities.ElmahType item
            //    , List<Tuple<Framework.Xaml.StandardRouteRelativeKey, Framework.Xaml.ControlParentOptions>> selectedList)
            //{
            //    var actionItems = new List<Framework.Xaml.ActionForm.ActionItemModel>();
            //
            //    foreach (var selected in selectedList)
            //        actionItems.Add(GetActionItemModel(item, selected.Item1, selected.Item2));
            //
            //    var actionSheetVM = new Framework.Xaml.ActionForm.ActionSheetVM { HasIcon = true, ActionItems = new ObservableCollection<Framework.Xaml.ActionForm.ActionItemModel>(actionItems) };
            //    return actionSheetVM;
            //}

            /*************************************
            * List of NavigateToCommand *
            *************************************/
            // 1. ItemVM
            #region 1. ItemVM

            // 1.1. NavigateTo Create
            // 1.1.1. NavigateToCommand_Create

            /*
             * public ICommand NavigateToCommand_Create { get; private set; }
             * public async void OnNavigateToCommand_Create(Elmah.DataSourceEntities.ElmahType item)
             * {
             *  PopupVM.HidePopup();
             *
             *  var request = GetLoadDataRequest_NavigateToCommand_Create<Elmah.DataSourceEntities.ElmahType>(item);
             *  DetailsFormActionSheetWhenCreate = GetDetailsFormActionSheetWhenCreate(ItemVM);
             *
             *  MessagingCenter.Send<Elmah.MVVMLightViewModels.ElmahType.ItemVM, Framework.Xaml.LoadItemDataRequest<Elmah.DataSourceEntities.ElmahType>>(
             *      ItemVM, Elmah.MVVMLightViewModels.ElmahType.ItemVM.MessageTitle_AssignItem, request);
             *  await NavigateAsync(DomainKey, Framework.Xaml.StandardRouteRelativeKey.Create.ToString());
             *
             *  //var parameters = new Dictionary<string, string>();
             *
             * //parameters.Add("type", item.Type.ToString());
             *
             *  //await NavigateAsync(DomainKey, Framework.Xaml.StandardRouteRelativeKey.Create.ToString(), parameters);
             * }
             */

            // 1.1.2. ShowPopupCommand_Create

            public override void OnShowPopupCommand_Create(Elmah.DataSourceEntities.ElmahType item)
            {
                PopupVM.HidePopup();

                var request = GetLoadDataRequest_ShowPopupCommand_Create <Elmah.DataSourceEntities.ElmahType>(item);

                DetailsFormActionSheetWhenCreate = GetDetailsFormActionSheetWhenCreate(ItemVM);

                MessagingCenter.Send <Elmah.MVVMLightViewModels.ElmahType.ItemVM, Framework.Xaml.LoadItemDataRequest <Elmah.DataSourceEntities.ElmahType> >(
                    ItemVM, Elmah.MVVMLightViewModels.ElmahType.ItemVM.MessageTitle_AssignItem, request);

                PopupVM.ShowItemControlPopup(Framework.Xaml.StandardRouteRelativeKey.Create.ToString(), true);
            }
Beispiel #3
0
            // 1.4. NavigateTo Edit
            // 1.4.1. NavigateToCommand_Edit

            /*
             * public ICommand NavigateToCommand_Edit { get; private set; }
             * public async void OnNavigateToCommand_Edit(Elmah.DataSourceEntities.ElmahType item)
             * {
             *  PopupVM.HidePopup();
             *
             *  var criteria = new Elmah.DataSourceEntities.ElmahTypeIdentifier {
             *      Type = item.Type
             *  };
             *  var request = GetLoadDataRequest_ShowPopupCommand_Details<Elmah.DataSourceEntities.ElmahTypeIdentifier>(criteria);
             *  DetailsFormActionSheetWhenEdit = GetDetailsFormActionSheetWhenEdit(ItemVM);
             *  MessagingCenter.Send<Elmah.MVVMLightViewModels.ElmahType.ItemVM, Framework.Xaml.LoadItemDataRequest<Elmah.DataSourceEntities.ElmahTypeIdentifier>>(
             *      ItemVM, Elmah.MVVMLightViewModels.ElmahType.ItemVM.MessageTitle_LoadItem, request);
             *  await NavigateAsync(DomainKey, Framework.Xaml.StandardRouteRelativeKey.Edit.ToString());
             *
             *  //var parameters = new Dictionary<string, string>();
             *
             * //parameters.Add("type", item.Type.ToString());
             *
             *  //await NavigateAsync(DomainKey, Framework.Xaml.StandardRouteRelativeKey.Edit.ToString(), parameters);
             * }
             */

            // 1.4.2. ShowPopupCommand_Edit
            public override async void OnShowPopupCommand_Edit(Elmah.DataSourceEntities.ElmahType item)
            {
                PopupVM.HidePopup();

                var criteria = new Elmah.DataSourceEntities.ElmahTypeIdentifier {
                    Type = item.Type
                };
                var request = GetLoadDataRequest_ShowPopupCommand_Edit <Elmah.DataSourceEntities.ElmahTypeIdentifier>(criteria);

                DetailsFormActionSheetWhenEdit = GetDetailsFormActionSheetWhenEdit(ItemVM);
                MessagingCenter.Send <Elmah.MVVMLightViewModels.ElmahType.ItemVM, Framework.Xaml.LoadItemDataRequest <Elmah.DataSourceEntities.ElmahTypeIdentifier> >(
                    ItemVM, Elmah.MVVMLightViewModels.ElmahType.ItemVM.MessageTitle_LoadItem, request);
                PopupVM.ShowItemControlPopup(Framework.Xaml.StandardRouteRelativeKey.Edit.ToString(), true);
            }
Beispiel #4
0
        public async Task LoadData()
        {
            if (PopupVM.PopupOption == Framework.Xaml.PopupOptions.RegularPopup)
            {
                return;
            }

            PopupVM.ShowPopup(Framework.Resx.UIStringResource.Loading, false);

            try
            {
                // TODO: how to convert local image to ImageSource
                // 1. Header
                CoverImage = "cover.png";
                DateToday  = DateTime.Now;

                // 1.1. Person First Name
                var entityID = AppVM.SignInData.EntityID;

                //var vm = DependencyService.Resolve<NTierOnTime.MVVMLightViewModels.Employee.IndexVM>();
                //NavigationVM.Employee.SetCriteria_CommonResultView(entityID, null);
                //MessagingCenter.Send<NTierOnTime.MVVMLightViewModels.Employee.IndexVM, Framework.Xaml.LoadListDataRequest>(vm, NTierOnTime.MVVMLightViewModels.Employee.IndexVM.MessageTitle_LoadData,
                //    new Framework.Xaml.LoadListDataRequest { ListItemViewMode = ListItemViewModes.NavigationWhenClickItem });

                this.NickName = "Hey, You";

                /*
                 * var personItem = await AppVM.Caching.PersonRepository.GetItemFromTableAsync(t => t.EntityID == entityID);
                 *
                 * if (personItem == null)
                 * {
                 *  this.NickName = "Hey, You";
                 * }
                 * else
                 * {
                 *  this.NickName = personItem.NickName ?? personItem.FirstName ?? personItem.LastName ?? "Hey, You";
                 * }
                 */

                //// 1.2. Weather
                //await GetWeather();

                // 2. Metadata
                //var client = new Elmah.WebApiClient.HomeApiClient(Elmah.MVVMLightViewModels.WebServiceConfig.WebApiRootUrl, Elmah.MVVMLightViewModels.WebServiceConfig.UseToken, Elmah.MVVMLightViewModels.WebServiceConfig.Token);
                //var metaData = await client.GetDashboardVM(AppVM.SignInData.ShortGuid);
                //DashboardFlags = metaData.DashboardFlags;

                // 3. Contacts
                try
                {
                    var contacts = await Plugin.ContactService.CrossContactService.Current.GetContactListAsync();

                    System.Collections.ObjectModel.ObservableCollection <Plugin.ContactService.Shared.Contact> b = new System.Collections.ObjectModel.ObservableCollection <Plugin.ContactService.Shared.Contact>(contacts);
                }
                catch (Exception ex)
                {
                }

                //NavigationVM.Employee.SendMessage_Init_CommonResultView(entityID, null, Framework.Xaml.ListItemViewModes.NavigationWhenClickItem, true, nameof(NTierOnTime.DataSourceEntities.Employee.ModifiedDate), Framework.Queries.QueryOrderDirections.Descending);
            }
            catch (Exception ex)
            {
            }

            PopupVM.HidePopup();

            IsContentVisible = true;
        }