public void PropertyNameUtility_GetPropertyName_Basic()
        {
            Expression <Func <Level1, string> > lambdaExpression = _ => _.Id;
            string result = PropertyNameUtility.GetPropertyName(lambdaExpression, __jsonSerializerSettings, false);

            Assert.IsNotNull(result);
            Assert.AreEqual("id", result);
        }
Example #2
0
        public void PropertyNameUtility_GetPropertyName_JsonProperty()
        {
            Expression <Func <Level1, string> > lambdaExpression = _ => _.JsonProperty;
            string result = PropertyNameUtility.GetPropertyName(lambdaExpression, false);

            Assert.IsNotNull(result);
            Assert.AreEqual("json_property", result);
        }
Example #3
0
        public void PropertyNameUtility_GetPropertyName_Constant()
        {
            Expression <Func <Level1, string> > lambdaExpression1 = _ => Constants.SearchScore;
            string result = PropertyNameUtility.GetPropertyName(lambdaExpression1, false);

            Assert.IsNotNull(result);
            Assert.AreEqual("search.score()", result);
        }
        public void PropertyNameUtility_GetPropertyName_Child_JsonProperty()
        {
            Expression <Func <Level1, string> > lambdaExpression = _ => _.Complex.JsonProperty;
            string result = PropertyNameUtility.GetPropertyName(lambdaExpression, __jsonSerializerSettings, false);

            Assert.IsNotNull(result);
            Assert.AreEqual("complex/json_property", result);
        }
Example #5
0
        public void PropertyNameUtility_GetPropertyName_Child_Basic()
        {
            Expression <Func <Level1, string> > lambdaExpression = _ => _.Complex.Id;
            string result = PropertyNameUtility.GetPropertyName(lambdaExpression, false);

            Assert.IsNotNull(result);
            Assert.AreEqual("complex/id", result);
        }
        public void PropertyNameUtility_GetPropertyName_Constant()
        {
            Expression <Func <Level1, string> > lambdaExpression1 = _ => __someConstant;
            string result = PropertyNameUtility.GetPropertyName(lambdaExpression1, __jsonSerializerSettings, false);

            Assert.IsNotNull(result);
            Assert.AreEqual(__someConstant, result);
        }
        public void PropertyNameUtility_GetPropertyName_SearchScore()
        {
            Expression <Func <Level1, double> > lambdaExpression1 = _ => SearchFns.Score();
            string result = PropertyNameUtility.GetPropertyName(lambdaExpression1, __jsonSerializerSettings, false);

            Assert.IsNotNull(result);
            Assert.AreEqual("search.score()", result);
        }
        public void GoPreviousImage()
        {
            var currentPage = OpenedPage;

            OpenedPage = OpenedBook.Contents.LoopPrevious(currentPage);

            ContentsLoadTask.Load(OpenedPage);

            if (OpenedPage.IsLoaded)
            {
                RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => CurrentPage));
            }
        }
        protected override void Internal_UpdateInMemory(BookViewModel book)
        {
            BookFacade.Update(book);
            int index = BookSource.IndexOf(BookSource.Where(b => b.ID.Equals(book.ID)).Single());

            BookSource[index] = book;
            if (SearchedBooks != null)
            {
                index = SearchedBooks.IndexOf(SearchedBooks.Where(b => b.ID.Equals(book.ID)).Single());
                SearchedBooks[index] = book;
            }
            RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => OnStage));
        }
Example #10
0
 protected void Internal_AddToMemory(BookViewModel book)
 {
     BookSource.Add(book);
     RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => OnStage));
     if (observer != null)
     {
         observer.OnNext(new BookCollectionChanged()
         {
             Target       = book,
             TargetChange = new BookCollectionChanged.Add()
         });
     }
 }
Example #11
0
        public void PropertyNameUtility_GetPropertyName_ChildCollection_Basic()
        {
            Expression <Func <Level1, IEnumerable <string> > > lambdaExpression1 = _ => _.CollectionComplex.Select(s => s.Id);
            string result = PropertyNameUtility.GetPropertyName(lambdaExpression1, false);

            Assert.IsNotNull(result);
            Assert.AreEqual("collectionComplex/id", result);

            Expression <Func <Level1, string> > lambdaExpression2 = _ => _.CollectionComplex.First().Id;

            result = PropertyNameUtility.GetPropertyName(lambdaExpression2, false);
            Assert.IsNotNull(result);
            Assert.AreEqual("collectionComplex/id", result);
        }
        public void PropertyNameUtility_GetPropertyName_ChildCollection_JsonProperty()
        {
            Expression <Func <Level1, IEnumerable <string> > > lambdaExpression1 = _ => _.CollectionComplex.Select(s => s.JsonProperty);
            string result = PropertyNameUtility.GetPropertyName(lambdaExpression1, __jsonSerializerSettings, false);

            Assert.IsNotNull(result);
            Assert.AreEqual("collectionComplex/json_property", result);

            Expression <Func <Level1, string> > lambdaExpression2 = _ => _.CollectionComplex.First().JsonProperty;

            result = PropertyNameUtility.GetPropertyName(lambdaExpression2, __jsonSerializerSettings, false);
            Assert.IsNotNull(result);
            Assert.AreEqual("collectionComplex/json_property", result);
        }
Example #13
0
        protected virtual void Internal_UpdateInMemory(BookViewModel book)
        {
            BookFacade.Update(book);
            int index = BookSource.IndexOf(BookSource.Where(b => b.ID.Equals(book.ID)).Single());

            BookSource[index] = book;
            RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => OnStage));
            if (observer != null)
            {
                observer.OnNext(new BookCollectionChanged()
                {
                    Target       = book,
                    TargetChange = new BookCollectionChanged.Update()
                });
            }
        }
Example #14
0
        public void UpdateProgress(int current, int total, TimeKeeper timekeeper)
        {
            _TotalCount = total;
            _Current    = current;
            timekeeper.RecordTime();
            if (current > 100 && current < total)
            {
                var sum                        = (DateTime.Now - timekeeper.BeginTaskDatetime.Value);
                var avgMilliseconds            = sum.TotalMilliseconds / current;
                var remain                     = total - current;
                var remainTimesAvgMilliseconds = remain * avgMilliseconds;

                var now = DateTime.Now;

                if (_previousUpdateDateTime.HasValue)
                {
                    var duration = now - _previousUpdateDateTime.Value;
                    if (duration.Seconds >= 1)
                    {
                        EstimateRemainTime      = TimeSpan.FromMilliseconds(remainTimesAvgMilliseconds);
                        _previousUpdateDateTime = now;
                    }
                }
                else
                {
                    _previousUpdateDateTime = now;
                }
            }
            else if (current == total)
            {
                EstimateRemainTime      = null;
                _previousUpdateDateTime = null;
            }
            RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => Current));
            RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => Progress));
            RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => EstimateRemainTime));
        }
Example #15
0
        public void PropertyNameUtility_GetPropertyName_Null()
        {
            Expression <Func <Level1, string> > lambdaExpression = null;

            PropertyNameUtility.GetPropertyName(lambdaExpression, false);
        }
Example #16
0
 public void ButtonStateUpdate_UpdateRevertRemove()
 {
     OnPropertyChanged(PropertyNameUtility.GetPropertyName(() => UpdateRevertButtonIsEnable),
                       PropertyNameUtility.GetPropertyName(() => RemoveButtonIsEnable));
 }
Example #17
0
 public void ButtonsStateUpdate_Add()
 {
     OnPropertyChanged(PropertyNameUtility.GetPropertyName(() => AddButtonIsEnable));
 }
        public void PropertyNameUtility_GetPropertyName_Null()
        {
            Expression <Func <Level1, string> > lambdaExpression = null;

            PropertyNameUtility.GetPropertyName(lambdaExpression, __jsonSerializerSettings, false);
        }
Example #19
0
 public void ObserveSelectedEntityTags()
 {
     RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => SelectedEntityTags));
 }
Example #20
0
 public void ObserveTagCount()
 {
     RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => TagCount));
 }
Example #21
0
        public void SwitchOrdering()
        {
            _OrderAscending = !_OrderAscending;

            RaisePropertyChanged(PropertyNameUtility.GetPropertyName(() => OnStage));
        }