コード例 #1
0
ファイル: HelperLoader.cs プロジェクト: AFNANAMIN/KarveCar
        /// <summary>
        ///  Load Data Transfer All. Violate SRP.
        /// </summary>
        /// <returns></returns>
        private async Task <IEnumerable <Dto> > LoadDtoAll()
        {
            IEnumerable <Dto> list = null;

            try
            {
                HelperView?.Clear();
                var countItem = await _helperDataServices.GetItemsCount <Entity>();

                var currentList = new IncrementalList <Dto>(LoadMoreItems)
                {
                    MaxItemCount = countItem
                };
                var tmplist = await _helperDataServices.GetPagedSummaryDoAsync <Dto, Entity>(1, PageSize);

                HelperView = currentList;
                HelperView.LoadItems(tmplist);
                list = currentList;
            }
            catch (Exception e)
            {
                throw new DataLayerException(e.Message, e);
            }
            if (list == null)
            {
                return(null);
            }
            return(list);
        }
コード例 #2
0
        /// <summary>
        /// Конструктор
        /// </summary>
        /// <param name="parPlatform">Объект платформы</param>
        public HelperController(Platform parPlatform)
        {
            _helper = new Helper();
            View    = new HelperView(parPlatform, _helper);
            _helper.Initialize();

            parPlatform.EscDown += OnEscDown;
        }
コード例 #3
0
 /// <summary>
 ///  Update the value.
 /// </summary>
 protected virtual void Update()
 {
     HelperView = LoadView();
     if (HelperView != null)
     {
         PreviousValue = CurrentValue;
         CurrentValue  = HelperView.FirstOrDefault();
     }
 }
コード例 #4
0
        /// <summary>
        ///  Element to delete the entity
        /// </summary>
        /// <param name="payLoad">Payload to be deleted</param>
        /// <returns></returns>
        public override async Task <bool> DeleteEntity(DataPayLoad payLoad)
        {
            var  cv            = CurrentValue;
            bool entityDeleted = false;

            if (cv != null)
            {
                entityDeleted = await DataServices.GetHelperDataServices()
                                .ExecuteAsyncDelete <Dto, Entity>(cv);

                if (entityDeleted)
                {
                    HelperView.Remove(cv);
                    HelperDto = HelperView.FirstOrDefault();
                    //Update();
                }
                else
                {
                    MessageBox.Show("Error deleting item");
                }
            }
            return(entityDeleted);
        }
コード例 #5
0
 /// <summary>
 ///  Update.
 /// </summary>
 protected override void Update()
 {
     HelperView    = LoadView();
     PreviousValue = CurrentValue;
     CurrentValue  = HelperView.FirstOrDefault();
 }
コード例 #6
0
 internal void ShowTeachingTips() =>
 HelperView.ShowTeachingTips(GaugeView.TeachingTipTarget, JournalView.TeachingTipTarget);