コード例 #1
0
        /// <summary>
        /// Déclenche l'événement IsBusyChanged
        /// </summary>
        protected override void OnIsBusyChanged()
        {
            base.OnIsBusyChanged();

            // Refresh commands
            SearchCommand.RaiseCanExecuteChanged();
        }
コード例 #2
0
        public string this[string columnName]
        {
            get
            {
                var bulderError = new StringBuilder();

                if (columnName == "OriginalSelectValue" && OriginalSelectValue == null)
                {
                    bulderError.AppendLine("Нужно указать город отправления.");
                }
                else if (columnName == "DestinationSelectValue" && DestinationSelectValue == null)
                {
                    bulderError.AppendLine("Нужно указать город прибытия.");
                }
                else if (columnName == "DestinationSelectValue" && DestinationSelectValue == OriginalSelectValue)
                {
                    bulderError.AppendLine("Город прибытия не может совпадать с городом отправления");
                }
                else if (columnName == "DepartDate" && !DepartDate.HasValue)
                {
                    bulderError.AppendLine("Выбирите дату");
                }
                else if (columnName == "ReturnDate" && !ReturnDate.HasValue)
                {
                    bulderError.AppendLine("Выбирите дату");
                }

                Error = bulderError.ToString();
                SearchCommand.RaiseCanExecuteChanged();

                return(Error);
            }
        }
コード例 #3
0
ファイル: SearchModel.cs プロジェクト: jimmyvh/SearchMSAccess
        private void SearchModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "ZoekBestand":
                if (ZoekBestand)
                {
                    FolderPath = "";
                }
                break;

            case "ZoekMap":
                if (ZoekMap)
                {
                    FilePath = "";
                }
                break;

            case "SearchTerm":
            case "FolderPath":
            case "FilePath":
                SearchCommand.RaiseCanExecuteChanged();
                break;
            }
        }
コード例 #4
0
        private async Task <ImageResponse> SearchUpdateImages(string text, CancellationToken cancellationToken)
        {
            var imageResponce = await GetImagesAsync(text, cancellationToken);

            // _images.Clear();
            _nextUrl = imageResponce.Return(x => x.NextUrl, null);

            if (_nextUrl == null && _lastInstagramImageId == imageResponce.MinTagId)
            {
                SearchCommand.RaiseCanExecuteChanged();
                await Task.FromResult(imageResponce);
            }

            _lastInstagramImageId = imageResponce.MinTagId;
            foreach (var image in imageResponce.Return(x => x.Images, Enumerable.Empty <WebBrowsing.Image>()))
            {
                InstagramImageViewModel viewModel = new InstagramImageViewModel(image.Data,
                                                                                image.Width, image.Height, image.Url, image.FullName, image.ProfilePictureData, image.UrlAvatar, image.UserName);
                _images.Add(viewModel);
            }

            SearchCommand.RaiseCanExecuteChanged();
            cancellationToken.ThrowIfCancellationRequested();

            return(await Task.FromResult(imageResponce));
        }
コード例 #5
0
        protected virtual void OnSearchCommandHandler()
        {
            IsSearching = true;
            SearchCommand.RaiseCanExecuteChanged();

            IsMessageVisible = false;
        }
コード例 #6
0
 private void OnModelPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     SearchCommand.RaiseCanExecuteChanged();
     AddCommand.RaiseCanExecuteChanged();
     DeleteCommand.RaiseCanExecuteChanged();
     SaveCommand.RaiseCanExecuteChanged();
     CancelCommand.RaiseCanExecuteChanged();
 }
コード例 #7
0
 protected virtual void RaiseAllCanExecuteChanged()
 {
     SearchCommand.RaiseCanExecuteChanged();
     AddCommand.RaiseCanExecuteChanged();
     DeleteCommand.RaiseCanExecuteChanged();
     SaveCommand.RaiseCanExecuteChanged();
     CancelCommand.RaiseCanExecuteChanged();
 }
コード例 #8
0
 private void RaiseCanExecuteCommands()
 {
     NextMonthCommand.RaiseCanExecuteChanged();
     PreviousMonthCommand.RaiseCanExecuteChanged();
     RemoveUserCommand.RaiseCanExecuteChanged();
     CurrentMonthCommand.RaiseCanExecuteChanged();
     SearchCommand.RaiseCanExecuteChanged();
     ClearAllCommand.RaiseCanExecuteChanged();
     PrintCommand.RaiseCanExecuteChanged();
 }
コード例 #9
0
 public override void AfterItemPermissionsCompleted()
 {
     base.AfterItemPermissionsCompleted();
     NewCommand.RaiseCanExecuteChanged();
     EditCommand.RaiseCanExecuteChanged();
     SaveCommand.RaiseCanExecuteChanged();
     SearchCommand.RaiseCanExecuteChanged();
     DeleteCommand.RaiseCanExecuteChanged();
     PrintCommand.RaiseCanExecuteChanged();
     CancelCommand.RaiseCanExecuteChanged();
     ExportCommand.RaiseCanExecuteChanged();
 }
コード例 #10
0
        /// <summary>
        /// Déclenche l'événement <see cref="CriteriaErrorsChanged"/> si une propiété de <see cref="Criteria"/> contient une erreur
        /// </summary>
        protected virtual void OnCriteriaErrorsChanged(object sender, DataErrorsChangedEventArgs e)
        {
            CriteriaErrorsChanged?.Invoke(sender, e);

            if (sender != null && e != null)
            {
                OnErrorsChanged(sender, e.PropertyName);
            }

            // Refresh commands
            SearchCommand.RaiseCanExecuteChanged();
        }
コード例 #11
0
        protected virtual async Task OnSearchResultHandler(SearchResultMessage message)
        {
            if (message.IsFinished)
            {
                IsSearching = false;
                SearchCommand.RaiseCanExecuteChanged();
            }
            else
            {
                Message          = message.Message;
                IsMessageVisible = !String.IsNullOrEmpty(message.Message);
            }

            await Task.Yield();
        }
コード例 #12
0
        private void UpdateSelectedMonth(MonthViewModel monthViewModel)
        {
            MonthViewModel viewModel;
            bool           exist = _searchQuery.SelectedMonths.TryGetValue(monthViewModel.Number, out viewModel);

            if (monthViewModel.IsChecked && !exist)
            {
                _searchQuery.SelectedMonths.Add(monthViewModel.Number, monthViewModel);
            }
            else if (exist)
            {
                _searchQuery.SelectedMonths.Remove(viewModel.Number);
            }

            SearchCommand.RaiseCanExecuteChanged();
        }
コード例 #13
0
        private void Search(string text)
        {
            if (!string.IsNullOrEmpty(_previousSearch))
            {
                if (string.Compare(text, _previousSearch, StringComparison.OrdinalIgnoreCase) != 0)
                {
                    _nextUrl = null;
                    Images.Clear();
                }
            }
            _previousSearch = text;
            SearchCommand.RaiseCanExecuteChanged();

            _searchTokenSource.Cancel();
            _searchTokenSource = new CancellationTokenSource();

            SearchAsyncOperation = new NotifyTaskCompletion <ImageResponse>(SearchUpdateImages(text, _searchTokenSource.Token));
        }
コード例 #14
0
 private void SetIsBusy(bool isBusy)
 {
     _isBusy = isBusy;
     SearchCommand.RaiseCanExecuteChanged();
     CustomSearchCommand.RaiseCanExecuteChanged();
 }
コード例 #15
0
 private void UpdateCommands()
 {
     GoBackCommand.RaiseCanExecuteChanged();
     SearchCommand.RaiseCanExecuteChanged();
 }