예제 #1
0
 /// <summary>
 /// Refreshes ItemSource of steps listbox
 /// </summary>
 private void RefreshSteps()
 {
     CollectionViewSource.GetDefaultView(LbSteps.ItemsSource).Refresh();
 }
    // Store SortDescriptions in dictionary
    private void UpdateSorting()
    {
        ICollectionView view = CollectionViewSource.GetDefaultView(ItemsSource);

        m_SortDescriptions[ItemsSource] = new List <SortDescription>(view.SortDescriptions);
    }
 public void FillData()
 {
     SpellVisualEffects.GetAllSpellVisualEffects();
     spellVisualEffectsView = CollectionViewSource.GetDefaultView(SpellVisualEffects);
 }
예제 #4
0
        public void Save()
        {   //Get an instance of the service using Helper class
            var client = Helper.getServiceClient();

            try
            {   //Get the current object in the EditGrid
                var BankAccountToSave = (FIN_BankAccount)CollectionViewSource.GetDefaultView(bank.BankAccountGrid.DataContext).CurrentItem;
                //This is used incase a user never enters a textbox but still needs validating
                bank.BankAccountBankBranchDropDown.GetBindingExpression(CustomSearchDropDown.CustomSelectedItemProperty).UpdateSource();
                bank.txt_BankAccount_AccountSEQNo.GetBindingExpression(TextBox.TextProperty).UpdateSource();

                //Checking if all controls are in valid state
                if (!Helper.IsValid(bank.BankAccountGrid))
                {
                    MessageBox.Show("Please fix errors before continuing", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }
                //A user is trying to add a record here
                if (bank.BtnAdd.IsChecked == true)
                {
                    if (!client.BankAccountExists(BankAccountToSave))
                    {
                        ApiAck ack = client.CreateBankAccount(BankAccountToSave);
                        if (ack.CallStatus == EApiCallStatus.Success)
                        {
                            MessageBox.Show("Record Added Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
                            //Complete the Add operation. i.e.; Re-enable tabs,textboxes and datagrid
                            CompleteAdd();
                        }
                        else
                        {
                            MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Record Already Exists", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    }
                }
                //Else the user is trying to update a record
                else
                {
                    ApiAck ack = client.UpdateBankAccount(BankAccountToSave);
                    if (ack.CallStatus == EApiCallStatus.Success)
                    {
                        MessageBox.Show("Record Updated Successfully", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
                        CompleteUpdate();
                    }
                    else
                    {
                        MessageBox.Show(ack.ReturnedMessage, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    }
                }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Nothing to Update", "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Message", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
예제 #5
0
        public WorldViewModel()
        {
            if (IsInDesignModeStatic)
            {
                return;
            }

            CheckUpdates = Settings.Default.CheckUpdates;

            if (CheckUpdates)
            {
                CheckVersion();
            }


            IsAutoSaveEnabled = Settings.Default.Autosave;

            _undoManager           = new UndoManager(this);
            _clipboard             = new ClipboardManager(this);
            World.ProgressChanged += OnProgressChanged;
            Brush.BrushChanged    += OnPreviewChanged;
            UpdateTitle();

            _spriteFilter       = string.Empty;
            _spritesView        = (ListCollectionView)CollectionViewSource.GetDefaultView(World.Sprites);
            _spritesView.Filter = o =>
            {
                if (string.IsNullOrWhiteSpace(_spriteFilter))
                {
                    return(true);
                }

                var sprite = (Sprite)o;

                string[] _spriteFilterSplit = _spriteFilter.Split('/');
                foreach (string _spriteWord in _spriteFilterSplit)
                {
                    if (sprite.TileName == _spriteWord)
                    {
                        return(true);
                    }
                    if (sprite.Name == _spriteWord)
                    {
                        return(true);
                    }
                    if (sprite.TileName != null && sprite.TileName.IndexOf(_spriteWord, StringComparison.OrdinalIgnoreCase) >= 0)
                    {
                        return(true);
                    }
                    if (sprite.Name != null && sprite.Name.IndexOf(_spriteWord, StringComparison.OrdinalIgnoreCase) >= 0)
                    {
                        return(true);
                    }
                }

                if (sprite.TileName == _spriteFilter)
                {
                    return(true);
                }
                if (sprite.Name == _spriteFilter)
                {
                    return(true);
                }
                if (sprite.TileName != null && sprite.TileName.IndexOf(_spriteFilter, StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    return(true);
                }
                if (sprite.Name != null && sprite.Name.IndexOf(_spriteFilter, StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    return(true);
                }

                return(false);
            };

            _spritesView2        = (ListCollectionView)CollectionViewSource.GetDefaultView(World.Sprites2);
            _spritesView2.Filter = o =>
            {
                if (string.IsNullOrWhiteSpace(_spriteFilter))
                {
                    return(true);
                }

                var sprite = (SpriteFull)o;

                string[] _spriteFilterSplit = _spriteFilter.Split(new char[] { '/', ',' }, StringSplitOptions.RemoveEmptyEntries);

                if (sprite.Tile.ToString().StartsWith(_spriteFilter))
                {
                    return(true);
                }

                foreach (string _spriteWord in _spriteFilterSplit)
                {
                    if (sprite.Name == _spriteWord)
                    {
                        return(true);
                    }
                    if (sprite.Name != null && sprite.Name.IndexOf(_spriteWord, StringComparison.OrdinalIgnoreCase) >= 0)
                    {
                        return(true);
                    }

                    foreach (var style in sprite.Styles)
                    {
                        if (style.Value.Name != null && style.Value.Name.IndexOf(_spriteWord, StringComparison.OrdinalIgnoreCase) >= 0)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            };

            UpdateSpriteStyleView();

            _saveTimer.AutoReset = true;
            _saveTimer.Elapsed  += SaveTimerTick;
            // 3 minute save timer
            _saveTimer.Interval = 3 * 60 * 1000;

            _undoManager.Redid     += UpdateMinimap;
            _undoManager.Undid     += UpdateMinimap;
            _undoManager.UndoSaved += UpdateMinimap;

            // Test File Association and command line
            if (Application.Current.Properties["OpenFile"] != null)
            {
                string filename = Application.Current.Properties["OpenFile"].ToString();
                LoadWorld(filename);
            }
        }
예제 #6
0
 /// <summary>
 /// 转换为ICollectionView
 /// </summary>
 /// <param name="data"></param>
 /// <returns></returns>
 public static ICollectionView AsICV(this IEnumerable data)
 {
     return(CollectionViewSource.GetDefaultView(data));
 }
예제 #7
0
        internal StyleViewModel(OptionSet optionSet, IServiceProvider serviceProvider) : base(optionSet, serviceProvider, LanguageNames.CSharp)
        {
            var collectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(CodeStyleItems);

            collectionView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(AbstractCodeStyleOptionViewModel.GroupName)));

            var qualifyGroupTitle               = CSharpVSResources.this_preferences_colon;
            var predefinedTypesGroupTitle       = CSharpVSResources.predefined_type_preferences_colon;
            var varGroupTitle                   = CSharpVSResources.var_preferences_colon;
            var nullCheckingGroupTitle          = CSharpVSResources.null_checking_colon;
            var fieldGroupTitle                 = ServicesVSResources.Field_preferences_colon;
            var codeBlockPreferencesGroupTitle  = ServicesVSResources.Code_block_preferences_colon;
            var expressionPreferencesGroupTitle = ServicesVSResources.Expression_preferences_colon;
            var variablePreferencesGroupTitle   = ServicesVSResources.Variable_preferences_colon;

            var qualifyMemberAccessPreferences = new List <CodeStylePreference>
            {
                new CodeStylePreference(CSharpVSResources.Prefer_this, isChecked: true),
                new CodeStylePreference(CSharpVSResources.Do_not_prefer_this, isChecked: false),
            };

            var predefinedTypesPreferences = new List <CodeStylePreference>
            {
                new CodeStylePreference(ServicesVSResources.Prefer_predefined_type, isChecked: true),
                new CodeStylePreference(ServicesVSResources.Prefer_framework_type, isChecked: false),
            };

            var typeStylePreferences = new List <CodeStylePreference>
            {
                new CodeStylePreference(CSharpVSResources.Prefer_var, isChecked: true),
                new CodeStylePreference(CSharpVSResources.Prefer_explicit_type, isChecked: false),
            };

            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.QualifyFieldAccess, CSharpVSResources.Qualify_field_access_with_this, s_fieldDeclarationPreviewTrue, s_fieldDeclarationPreviewFalse, this, optionSet, qualifyGroupTitle, qualifyMemberAccessPreferences));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.QualifyPropertyAccess, CSharpVSResources.Qualify_property_access_with_this, s_propertyDeclarationPreviewTrue, s_propertyDeclarationPreviewFalse, this, optionSet, qualifyGroupTitle, qualifyMemberAccessPreferences));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.QualifyMethodAccess, CSharpVSResources.Qualify_method_access_with_this, s_methodDeclarationPreviewTrue, s_methodDeclarationPreviewFalse, this, optionSet, qualifyGroupTitle, qualifyMemberAccessPreferences));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.QualifyEventAccess, CSharpVSResources.Qualify_event_access_with_this, s_eventDeclarationPreviewTrue, s_eventDeclarationPreviewFalse, this, optionSet, qualifyGroupTitle, qualifyMemberAccessPreferences));

            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInDeclaration, ServicesVSResources.For_locals_parameters_and_members, s_intrinsicPreviewDeclarationTrue, s_intrinsicPreviewDeclarationFalse, this, optionSet, predefinedTypesGroupTitle, predefinedTypesPreferences));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferIntrinsicPredefinedTypeKeywordInMemberAccess, ServicesVSResources.For_member_access_expressions, s_intrinsicPreviewMemberAccessTrue, s_intrinsicPreviewMemberAccessFalse, this, optionSet, predefinedTypesGroupTitle, predefinedTypesPreferences));

            // Use var
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.UseImplicitTypeForIntrinsicTypes, CSharpVSResources.For_built_in_types, s_varForIntrinsicsPreviewTrue, s_varForIntrinsicsPreviewFalse, this, optionSet, varGroupTitle, typeStylePreferences));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.UseImplicitTypeWhereApparent, CSharpVSResources.When_variable_type_is_apparent, s_varWhereApparentPreviewTrue, s_varWhereApparentPreviewFalse, this, optionSet, varGroupTitle, typeStylePreferences));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.UseImplicitTypeWherePossible, CSharpVSResources.Elsewhere, s_varWherePossiblePreviewTrue, s_varWherePossiblePreviewFalse, this, optionSet, varGroupTitle, typeStylePreferences));

            // Code block
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferBraces, ServicesVSResources.Prefer_braces, s_preferBraces, s_preferBraces, this, optionSet, codeBlockPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferAutoProperties, ServicesVSResources.analyzer_Prefer_auto_properties, s_preferAutoProperties, s_preferAutoProperties, this, optionSet, codeBlockPreferencesGroupTitle));

            AddParenthesesOptions(Options);

            // Expression preferences
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferObjectInitializer, ServicesVSResources.Prefer_object_initializer, s_preferObjectInitializer, s_preferObjectInitializer, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferCollectionInitializer, ServicesVSResources.Prefer_collection_initializer, s_preferCollectionInitializer, s_preferCollectionInitializer, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferPatternMatchingOverIsWithCastCheck, CSharpVSResources.Prefer_pattern_matching_over_is_with_cast_check, s_preferPatternMatchingOverIsWithCastCheck, s_preferPatternMatchingOverIsWithCastCheck, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferPatternMatchingOverAsWithNullCheck, CSharpVSResources.Prefer_pattern_matching_over_as_with_null_check, s_preferPatternMatchingOverAsWithNullCheck, s_preferPatternMatchingOverAsWithNullCheck, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferConditionalExpressionOverAssignment, ServicesVSResources.Prefer_conditional_expression_over_if_with_assignments, s_preferConditionalExpressionOverIfWithAssignments, s_preferConditionalExpressionOverIfWithAssignments, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferConditionalExpressionOverReturn, ServicesVSResources.Prefer_conditional_expression_over_if_with_returns, s_preferConditionalExpressionOverIfWithReturns, s_preferConditionalExpressionOverIfWithReturns, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferExplicitTupleNames, ServicesVSResources.Prefer_explicit_tuple_name, s_preferExplicitTupleName, s_preferExplicitTupleName, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferSimpleDefaultExpression, ServicesVSResources.Prefer_simple_default_expression, s_preferSimpleDefaultExpression, s_preferSimpleDefaultExpression, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferInferredTupleNames, ServicesVSResources.Prefer_inferred_tuple_names, s_preferInferredTupleName, s_preferInferredTupleName, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferInferredAnonymousTypeMemberNames, ServicesVSResources.Prefer_inferred_anonymous_type_member_names, s_preferInferredAnonymousTypeMemberName, s_preferInferredAnonymousTypeMemberName, this, optionSet, expressionPreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferLocalOverAnonymousFunction, ServicesVSResources.Prefer_local_function_over_anonymous_function, s_preferLocalFunctionOverAnonymousFunction, s_preferLocalFunctionOverAnonymousFunction, this, optionSet, expressionPreferencesGroupTitle));

            AddExpressionBodyOptions(optionSet, expressionPreferencesGroupTitle);

            // Variable preferences
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferInlinedVariableDeclaration, ServicesVSResources.Prefer_inlined_variable_declaration, s_preferInlinedVariableDeclaration, s_preferInlinedVariableDeclaration, this, optionSet, variablePreferencesGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferDeconstructedVariableDeclaration, ServicesVSResources.Prefer_deconstructed_variable_declaration, s_preferDeconstructedVariableDeclaration, s_preferDeconstructedVariableDeclaration, this, optionSet, variablePreferencesGroupTitle));

            // Null preferences.
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferThrowExpression, CSharpVSResources.Prefer_throw_expression, s_preferThrowExpression, s_preferThrowExpression, this, optionSet, nullCheckingGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CSharpCodeStyleOptions.PreferConditionalDelegateCall, CSharpVSResources.Prefer_conditional_delegate_call, s_preferConditionalDelegateCall, s_preferConditionalDelegateCall, this, optionSet, nullCheckingGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferCoalesceExpression, ServicesVSResources.Prefer_coalesce_expression, s_preferCoalesceExpression, s_preferCoalesceExpression, this, optionSet, nullCheckingGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferNullPropagation, ServicesVSResources.Prefer_null_propagation, s_preferNullPropagation, s_preferNullPropagation, this, optionSet, nullCheckingGroupTitle));
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferIsNullCheckOverReferenceEqualityMethod, CSharpVSResources.Prefer_is_null_over_ReferenceEquals, s_preferIsNullOverReferenceEquals, s_preferIsNullOverReferenceEquals, this, optionSet, nullCheckingGroupTitle));

            // Field preferences.
            CodeStyleItems.Add(new BooleanCodeStyleOptionViewModel(CodeStyleOptions.PreferReadonly, ServicesVSResources.Prefer_readonly, s_preferReadonly, s_preferReadonly, this, optionSet, fieldGroupTitle));
        }
예제 #8
0
 public void fillGridAbsence()
 {
     AbsenceList        = CollectionViewSource.GetDefaultView(absenceControl.getAllAbsence());
     AbsenceList.Filter = new Predicate <object>(Filter);
 }
예제 #9
0
 private void txtFilter_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
 {
     CollectionViewSource.GetDefaultView(this.pickupList.ItemsSource).Refresh();
 }
예제 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaElement" /> class.
        /// </summary>
        public MediaElement()
            : base()
        {
            ContentGrid = new Grid {
                Name = nameof(ContentGrid)
            };
            Content = ContentGrid;
            ContentGrid.HorizontalAlignment = HorizontalAlignment.Stretch;
            ContentGrid.VerticalAlignment   = VerticalAlignment.Stretch;
            ContentGrid.Children.Add(ViewBox);
            Stretch          = ViewBox.Stretch;
            StretchDirection = ViewBox.StretchDirection;
            Logger           = new GenericMediaLogger <MediaElement>(this);
            Commands         = new MediaCommandManager(this);

            if (Utils.IsInDesignTime)
            {
                // Shows an FFmpeg image if we are in design-time
                var bitmap       = Properties.Resources.FFmpegMediaElementBackground;
                var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(
                    bitmap.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
                var controlBitmap = new WriteableBitmap(bitmapSource);
                ViewBox.Source = controlBitmap;
            }
            else
            {
                // The UI Property update timer is responsible for timely updates to properties outside of the worker threads
                // We use the loaded priority because it is the priority right below the Render one.
                UIPropertyUpdateTimer = new DispatcherTimer(DispatcherPriority.Loaded)
                {
                    Interval  = Constants.UIPropertyUpdateInterval,
                    IsEnabled = true
                };

                // The tick callback performs the updates
                UIPropertyUpdateTimer.Tick += (s, e) =>
                {
                    UpdatePosition(IsOpen ? Clock?.Position ?? TimeSpan.Zero : TimeSpan.Zero);

                    if (HasMediaEnded == false && CanReadMorePackets && (IsOpening || IsOpen))
                    {
                        var bufferedLength = Container?.Components?.PacketBufferLength ?? 0d;
                        BufferingProgress = Math.Min(1d, bufferedLength / BufferCacheLength);
                        var oldIsBugffering = IsBuffering;
                        var newIsBuffering  = bufferedLength < BufferCacheLength;

                        if (oldIsBugffering == false && newIsBuffering == true)
                        {
                            RaiseBufferingStartedEvent();
                        }
                        else if (oldIsBugffering == true && newIsBuffering == false)
                        {
                            RaiseBufferingEndedEvent();
                        }

                        IsBuffering = HasMediaEnded == false && newIsBuffering;
                    }
                    else
                    {
                        BufferingProgress = 0;
                        IsBuffering       = false;
                    }

                    var downloadProgress = Math.Min(1d, Math.Round((Container?.Components.PacketBufferLength ?? 0d) / DownloadCacheLength, 3));
                    if (double.IsNaN(downloadProgress))
                    {
                        downloadProgress = 0;
                    }
                    DownloadProgress = downloadProgress;
                };

                // Go ahead and fire up the continuous updates
                UIPropertyUpdateTimer.Start();
            }

            m_MetadataBase = new ObservableCollection <KeyValuePair <string, string> >();
            m_Metadata     = CollectionViewSource.GetDefaultView(m_MetadataBase) as ICollectionView;
        }
예제 #11
0
 public pgContenir()
 {
     InitializeComponent();
     _listeContenir          = CollectionViewSource.GetDefaultView(_bdd.Contenir);
     grpContenir.DataContext = _listeContenir;
 }
예제 #12
0
        public void SetScData(List <Achievements> ListAchievements, bool withContener = false, bool EnableRaretyIndicator = true)
        {
            _withContener = withContener;

            List <ListBoxAchievements> ListBoxAchievements = new List <ListBoxAchievements>();

            for (int i = 0; i < ListAchievements.Count; i++)
            {
                DateTime?   dateUnlock = null;
                BitmapImage iconImage  = new BitmapImage();

                bool IsGray = false;

                string urlImg = string.Empty;
                try
                {
                    if (ListAchievements[i].DateUnlocked == default(DateTime) || ListAchievements[i].DateUnlocked == null)
                    {
                        if (ListAchievements[i].UrlLocked == string.Empty || ListAchievements[i].UrlLocked == ListAchievements[i].UrlUnlocked)
                        {
                            urlImg = ListAchievements[i].ImageUnlocked;
                            IsGray = true;
                        }
                        else
                        {
                            urlImg = ListAchievements[i].ImageLocked;
                        }
                    }
                    else
                    {
                        urlImg     = ListAchievements[i].ImageUnlocked;
                        dateUnlock = ListAchievements[i].DateUnlocked;
                    }
                }
                catch (Exception ex)
                {
                    Common.LogError(ex, "SuccessStory", "Error on convert bitmap");
                }

                string NameAchievement = ListAchievements[i].Name;

                // Achievement without unlocktime but achieved = 1
                if (dateUnlock == new DateTime(1982, 12, 15, 0, 0, 0, 0))
                {
                    dateUnlock = null;
                }

                ListBoxAchievements.Add(new ListBoxAchievements()
                {
                    Name                  = NameAchievement,
                    DateUnlock            = dateUnlock,
                    EnableRaretyIndicator = EnableRaretyIndicator,
                    Icon                  = urlImg,
                    IconImage             = urlImg,
                    IsGray                = IsGray,
                    Description           = ListAchievements[i].Description,
                    Percent               = ListAchievements[i].Percent
                });

                iconImage = null;
            }


            // Sorting default.
            lbAchievements.ItemsSource = ListBoxAchievements;
            CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lbAchievements.ItemsSource);

            view.SortDescriptions.Add(new SortDescription("DateUnlock", ListSortDirection.Descending));
        }
예제 #13
0
 private void CreateSorting()
 {
     _productCollectionView = (CollectionView)CollectionViewSource.GetDefaultView(productsListView.ItemsSource);
     _productCollectionView.SortDescriptions.Add(new SortDescription("Warehouse", ListSortDirection.Ascending));
     _productCollectionView.SortDescriptions.Add(new SortDescription("ItemCount", ListSortDirection.Ascending));
 }
예제 #14
0
 /// <summary>
 /// Refresh Recipe Ingredients Listbox. ItemsSource must be changed for this to be effective
 /// </summary>
 private void RefreshRecipeIngredients()
 {
     CollectionViewSource.GetDefaultView(LvRecipeIngredients.ItemsSource).Refresh();
 }
 public Foo()
 {
     _payees                = GetPayees();
     _filteredPayees        = CollectionViewSource.GetDefaultView(_payees);
     _filteredPayees.Filter = FilterPayees;
 }
예제 #16
0
        public async Task LoadMods()
        {
            var versionLoadSuccess = await MainWindow.Instance.VersionLoadStatus.Task;

            if (versionLoadSuccess == false)
            {
                return;
            }

            await _modsLoadSem.WaitAsync();

            try
            {
                MainWindow.Instance.InstallButton.IsEnabled   = false;
                MainWindow.Instance.GameVersionsBox.IsEnabled = false;
                MainWindow.Instance.InfoButton.IsEnabled      = false;

                if (ModsList != null)
                {
                    Array.Clear(ModsList, 0, ModsList.Length);
                }

                if (AllModsList != null)
                {
                    Array.Clear(AllModsList, 0, AllModsList.Length);
                }

                InstalledMods = new List <Mod>();
                CategoryNames = new List <string>();
                ModList       = new List <ModListItem>();

                ModsListView.Visibility = Visibility.Hidden;

                if (App.CheckInstalledMods)
                {
                    MainWindow.Instance.MainText = $"{FindResource("Mods:CheckingInstalledMods")}...";
                    await Task.Run(async() => await CheckInstalledMods());

                    InstalledColumn.Width   = double.NaN;
                    UninstallColumn.Width   = 70;
                    DescriptionColumn.Width = 750;
                }
                else
                {
                    InstalledColumn.Width   = 0;
                    UninstallColumn.Width   = 0;
                    DescriptionColumn.Width = 800;
                }

                MainWindow.Instance.MainText = $"{FindResource("Mods:LoadingMods")}...";
                await Task.Run(async() => await PopulateModsList());

                ModsListView.ItemsSource = ModList;

                view = (CollectionView)CollectionViewSource.GetDefaultView(ModsListView.ItemsSource);
                PropertyGroupDescription groupDescription = new PropertyGroupDescription("Category");
                view.GroupDescriptions.Add(groupDescription);

                this.DataContext = this;

                RefreshModsList();
                ModsListView.Visibility      = Visibility.Visible;
                MainWindow.Instance.MainText = $"{FindResource("Mods:FinishedLoadingMods")}.";

                MainWindow.Instance.InstallButton.IsEnabled   = true;
                MainWindow.Instance.GameVersionsBox.IsEnabled = true;
            }
            finally
            {
                _modsLoadSem.Release();
            }
        }
예제 #17
0
 private void ItemFilter_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
 {
     CollectionViewSource.GetDefaultView(ItemNameView.ItemsSource).Refresh();
 }
예제 #18
0
 private void HandleClick(object sender, RoutedEventArgs e)
 {
     _disposable.Disposable = Observable.Return(new GriColumnAndDirection(AssociatedObject.GetDataGrid(), AssociatedObject.GetColumn(), Direction))
                              .Select(x => new ColumnCollectionViewAndDirection(x.Column, CollectionViewSource.GetDefaultView(x.Grid.ItemsSource), x.Direction))
                              .Where(x => x.HasSortDescriptions)
                              .ActivateGestures()
                              .Subscribe(x =>
     {
         x.Column.SortDirection = x.Direction;
         x.View.SortDescriptions.Clear();
         x.View.SortDescriptions.Add(new SortDescription(x.Column.SortMemberPath, x.Direction));
     });
 }
        public DependencyModuleList()
        {
            InitializeComponent();

            ModulesItemsView = CollectionViewSource.GetDefaultView(this.ModulesList.Items.SourceCollection);
        }
        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            ICollectionView navigationView = CollectionViewSource.GetDefaultView(phoneNumbersDataSet.PhoneNumbers);

            navigationView.MoveCurrentToNext();
        }
예제 #21
0
        //----------------------------------------------------------
        public static void parameter_symbol(Document doc, ElementType type, ListView thong_tin_kich_thuoc, ObservableCollection <data_parameters> my_parameters, string unit_length)
        {
            try
            {
                foreach (Parameter para in type.Parameters)
                {
                    if (para.Definition.ParameterGroup == BuiltInParameterGroup.PG_GEOMETRY && para.IsReadOnly == false)
                    {
                        my_parameters.Add(new data_parameters()
                        {
                            ten_parameter     = para.Definition.Name,
                            gia_tri_parameter = get_value(para, unit_length),
                            group_parameter   = "Dimensions",
                            parameter         = para
                        });
                    }
                    else if (para.Definition.ParameterGroup == BuiltInParameterGroup.PG_DATA && para.IsReadOnly == false)
                    {
                        my_parameters.Add(new data_parameters()
                        {
                            ten_parameter     = para.Definition.Name,
                            gia_tri_parameter = get_value(para, unit_length),
                            group_parameter   = "Data",
                            parameter         = para
                        });
                    }
                    else if (para.Definition.ParameterGroup == BuiltInParameterGroup.PG_VISIBILITY && para.IsReadOnly == false)
                    {
                        string value = "0";
                        if (para.StorageType == StorageType.Integer)
                        {
                            if (ParameterType.YesNo == para.Definition.ParameterType)
                            {
                                if (para.AsInteger() == 0)
                                {
                                    value = "False";
                                }
                                else
                                {
                                    value = "True";
                                }
                            }
                            else
                            {
                                value = para.AsInteger().ToString();
                            }
                        }
                        my_parameters.Add(new data_parameters()
                        {
                            ten_parameter     = para.Definition.Name,
                            gia_tri_parameter = value,
                            group_parameter   = "Visibility (Example: True or False)",
                            parameter         = para,
                        });
                    }
                }

                thong_tin_kich_thuoc.ItemsSource = my_parameters;

                ListCollectionView       view = CollectionViewSource.GetDefaultView(thong_tin_kich_thuoc.ItemsSource) as ListCollectionView;
                PropertyGroupDescription groupDescription1 = new PropertyGroupDescription("group_parameter");
                view.GroupDescriptions.Add(groupDescription1);
                view.CustomSort = new sort_data_parameters();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #22
0
 private void textBox_search_TextChanged(object sender, TextChangedEventArgs e)
 {
     CollectionViewSource.GetDefaultView(listView_iconList.ItemsSource).Refresh();
     ButtonEnableCheck();
 }
        public MainWindow()
        {
            InitializeComponent();

            _collectionView = CollectionViewSource.GetDefaultView(DataContext);
        }
예제 #24
0
 public View_DSKhamBenh_ViewModel(ObservableCollection <BENHNHAN> ds_KhamBenh, DateTime pickedDate)
 {
     DS_KhamBenh = ds_KhamBenh;
     DatePicked  = pickedDate;
     ViewSource  = (CollectionView)CollectionViewSource.GetDefaultView(DS_KhamBenh);
 }
예제 #25
0
 private void cbbMaa_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     CollectionViewSource.GetDefaultView(lvUsers.ItemsSource).Refresh();
 }
예제 #26
0
        public MainViewModel()
        {
            var schools = new ObservableCollection <SchoolViewModel>
            {
                new SchoolViewModel
                {
                    Name   = "Bloomfield School",
                    Pupils = new ObservableCollection <PupilViewModel>
                    {
                        new PupilViewModel {
                            FullName = "Adam James"
                        },
                        new PupilViewModel {
                            FullName = "Sophie Johnston"
                        },
                        new PupilViewModel {
                            FullName = "Kevin Sandler"
                        },
                        new PupilViewModel {
                            FullName = "Oscar Peterson"
                        }
                    }
                },
                new SchoolViewModel
                {
                    Name   = "Redacre School",
                    Pupils = new ObservableCollection <PupilViewModel>
                    {
                        new PupilViewModel {
                            FullName = "Tom Jefferson"
                        },
                        new PupilViewModel {
                            FullName = "Tony Potts"
                        }
                    }
                },
                new SchoolViewModel
                {
                    Name   = "Top Valley School",
                    Pupils = new ObservableCollection <PupilViewModel>
                    {
                        new PupilViewModel {
                            FullName = "Alex Thompson"
                        },
                        new PupilViewModel {
                            FullName = "Tabitha Smith"
                        },
                        new PupilViewModel {
                            FullName = "Carl Pederson"
                        },
                        new PupilViewModel {
                            FullName = "Sarah Jones"
                        },
                        new PupilViewModel {
                            FullName = "Paul Lowcroft"
                        }
                    }
                }
            };


            Schools = CollectionViewSource.GetDefaultView(schools);

            Pupils = new ObservableCollection <PupilViewModel>
            {
                new PupilViewModel {
                    FullName = "TestPupil1"
                },
                new PupilViewModel {
                    FullName = "TestPupil2"
                },
                new PupilViewModel {
                    FullName = "TestPupil3"
                },
                new PupilViewModel {
                    FullName = "TestPupil4"
                },
                new PupilViewModel {
                    FullName = "TestPupil5"
                }
            };
        }
예제 #27
0
        private void FillList(string table, int index)
        {
            // SET THE DATABASE CONNECTION VARS
            string file             = vari.DefaultDirectory + "Lists.accdb";
            string ConnectionString = "Provider = Microsoft.ACE.OLEDB.12.0;Data Source =" + file + ";";

            // Attempt to connect to the database
            using (var connection1 = new OleDbConnection(ConnectionString))
            {
                OleDbCommand OComm = new OleDbCommand();
                OComm.Connection = connection1;
                try
                {
                    connection1.Open();
                    // Query the database to find all entries without a FINISH TIME
                    OleDbDataAdapter DA = new OleDbDataAdapter("SELECT * FROM " + table + ";", connection1);
                    var DataSet         = new DataSet();
                    DA.Fill(DataSet, "*");
                    // Set the dataset from OleDBAdapter to the item source of the data grid object


                    //SWITCH VISIBILITY OF THE LISTBOX FOR THE SELECTED DEPARTMENT
                    switch (index)
                    {
                    case 1:
                        LBVisib();
                        lb = lbBH;
                        lbBH.Visibility = Visibility.Visible;
                        break;

                    case 2:
                        LBVisib();
                        lb = lbSH;
                        lbCB.Visibility = Visibility.Visible;
                        break;

                    case 3:
                        LBVisib();
                        lb = lbCB;
                        lbCB.Visibility = Visibility.Visible;
                        break;

                    case 4:
                        LBVisib();
                        lb = lbC;
                        lbCB.Visibility = Visibility.Visible;
                        break;

                    case 5:
                        LBVisib();
                        lb = lbCS;
                        lbCB.Visibility = Visibility.Visible;
                        break;

                    case 6:
                        LBVisib();
                        lb = lbMisc;
                        lbCB.Visibility = Visibility.Visible;
                        break;
                    }

                    lb.DataContext = DataSet.Tables[0];
                    lb.ItemsSource = DataSet.Tables[0].DefaultView;

                    ICollectionView dataView = CollectionViewSource.GetDefaultView(lb.ItemsSource);
                    dataView.SortDescriptions.Clear();
                    dataView.SortDescriptions.Add(new SortDescription("file", ListSortDirection.Ascending));
                    dataView.Refresh();
                }
                catch (Exception ex)
                { MessageBox.Show(ex.Message); }
                finally
                { connection1.Close(); }
            }
        }
예제 #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TargetPlatformWindow"/>.
        /// </summary>
        public TargetPlatformWindow()
        {
            InitializeComponent();

            Title = TypeHelper.ApplicationNameWithVersion;

            var app = (BaseApplication)Application.Current;

            var features = new[]
            {
                new TargetPlatformFeature("Quik", Languages.Russian),
                new TargetPlatformFeature("SmartCOM", Languages.Russian),
                new TargetPlatformFeature("Plaza2", Languages.Russian),
                new TargetPlatformFeature("Transaq", Languages.Russian),
                new TargetPlatformFeature("Micex", Languages.Russian),
                new TargetPlatformFeature("Alfa Direct", Languages.Russian, Platforms.x86),
                new TargetPlatformFeature("OpenECry"),
                new TargetPlatformFeature("Interactive Brokers"),
                new TargetPlatformFeature("E*Trade"),
                new TargetPlatformFeature("Blackwood/Fusion"),
                new TargetPlatformFeature("LMAX"),
                new TargetPlatformFeature("IQFeed"),
                new TargetPlatformFeature("BarChart"),
                new TargetPlatformFeature("OANDA"),
                new TargetPlatformFeature("Rithmic"),
                new TargetPlatformFeature("FIX/FAST"),
                new TargetPlatformFeature("ITCH"),
                new TargetPlatformFeature("BTCE"),
                new TargetPlatformFeature("BitStamp"),
                new TargetPlatformFeature("RSS")
            };

            _features.AddRange(features);
            _features.AddRange(app.ExtendedFeatures);

            _featuresView            = (ListCollectionView)CollectionViewSource.GetDefaultView(_features);
            _featuresView.CustomSort = new LanguageSorter(SelectedLanguage);

            AppIcon = app.AppIcon;

            if (!Environment.Is64BitOperatingSystem)
            {
                PlatformCheckBox.IsEnabled = false;
                PlatformCheckBox.IsChecked = false;
            }
            else
            {
                SelectedPlatform = Platforms.x64;
                UpdatePlatformCheckBox();
            }

            SelectedLanguage = LocalizedStrings.ActiveLanguage;
            UpdateLangButtons();

            var configFile = BaseApplication.PlatformConfigurationFile;

            if (configFile.IsEmptyOrWhiteSpace() || !File.Exists(configFile))
            {
                return;
            }

            var settings = new XmlSerializer <AppStartSettings>().Deserialize(configFile);

            SelectedPlatform = PlatformCheckBox.IsEnabled ? settings.Platform : Platforms.x86;
            AutoStart        = settings.AutoStart;
            LocalizedStrings.ActiveLanguage = SelectedLanguage = settings.Language;

            UpdateLangButtons();
            UpdatePlatformCheckBox();
        }
예제 #29
0
 private void PrepareFiltering()
 {
     this._iconsCollectionView        = CollectionViewSource.GetDefaultView(this.Icons);
     this._iconsCollectionView.Filter = o => this.FilterIconsPredicate(this.FilterText, (IIconViewModel)o);
 }
예제 #30
0
 void Changing()
 {
     try
     {
         BindingListCollectionView view = CollectionViewSource.GetDefaultView(dgMain.ItemsSource) as BindingListCollectionView;
         if (view != null)
         {
             view.CustomFilter = "";
             view.CustomFilter = string.Format("[رمز العائلة] like '%{0}%'", txtFamilyCodeOrphan.Text);
             if (!string.IsNullOrEmpty(txtOrphanName.Text))
             {
                 view.CustomFilter += string.Format(" and [اسم اليتيم] like '%{0}%'", txtOrphanName.Text);
             }
             if (cmboGender.SelectedIndex > 0)
             {
                 view.CustomFilter += string.Format(" and [الجنس] like '{0}'", (cmboGender.Items[cmboGender.SelectedIndex] as ComboBoxItem).Content);
             }
             if (dtpDOB1.SelectedDate != null)
             {
                 view.CustomFilter += string.Format(" and [تاريخ الولادة] >= #{0}#", ((DateTime)dtpDOB1.SelectedDate).ToString("MM/dd/yyyy"));
             }
             if (dtpDOB2.SelectedDate != null)
             {
                 view.CustomFilter += string.Format(" and [تاريخ الولادة] <= #{0}#", ((DateTime)dtpDOB2.SelectedDate).ToString("MM/dd/yyyy"));
             }
             if (dtpCancelDate1.SelectedDate != null)
             {
                 view.CustomFilter += string.Format(" and [تاريخ الإلغاء] >= #{0}#", ((DateTime)dtpCancelDate1.SelectedDate).ToString("MM/dd/yyyy"));
             }
             if (dtpCancelDate2.SelectedDate != null)
             {
                 view.CustomFilter += string.Format(" and [تاريخ الإلغاء] <= #{0}#", ((DateTime)dtpCancelDate2.SelectedDate).ToString("MM/dd/yyyy"));
             }
             if (nudAge.Value != null)
             {
                 view.CustomFilter += string.Format(" and [العمر] = {0}", ((int)nudAge.Value));
             }
             if (nudFeetSize.Value != null)
             {
                 view.CustomFilter += string.Format(" and [نمرة الرجل] = {0}", ((int)nudFeetSize.Value));
             }
             if (nudTall.Value != null)
             {
                 view.CustomFilter += string.Format(" and [الطول] = {0}", ((int)nudTall.Value));
             }
             if (nudWasteSize.Value != null)
             {
                 view.CustomFilter += string.Format(" and [قياس الخصر] = {0}", ((int)nudWasteSize.Value));
             }
             if (cmboTeachingStage.SelectedIndex > 0)
             {
                 view.CustomFilter += string.Format(" and [آخر مرحلة تعليمية] like '%{0}%'", (cmboTeachingStage.Items[cmboTeachingStage.SelectedIndex] as ComboBoxItem).Content);
             }
             if (cmboImpeding.SelectedIndex > 0)
             {
                 view.CustomFilter += string.Format(" and [الإعاقات] like '%{0}%'", cmboImpeding.SelectedItem);
             }
             if (cmboHealth.SelectedIndex > 0)
             {
                 view.CustomFilter += string.Format(" and [الحالات الصحية] like '%{0}%'", cmboHealth.SelectedItem);
             }
             FieldCount = view.Count;
         }
     }
     catch { }
 }