Exemple #1
0
        private static void OnClearSettingsCommandExecute(HeaderCommandParameter parameter)
        {
            Argument.IsNotNull(() => parameter);

            var grid = parameter.Grid;

            if (grid.FieldLayouts.FirstOrDefault() != null)
            {
                var fields = grid.FieldLayouts.First().Fields;

                foreach (var field in fields)
                {
                    field.Visibility = Visibility.Visible;
                    field.Width      = FieldLength.Auto;
                    field.CellValuePresenterStyle = null;
                }
            }

            grid.SetValue(Control.FontSizeProperty, Convert.ToDouble(GridViewFontSizeDefault));
            grid.SetValue(Control.FontFamilyProperty, new FontFamily(GridViewFontFamilyDefault));
            grid.SetValue(Control.FontStyleProperty, GridCustomizationHelpers.GetFontStyleFomString(GridViewFontStyleDefault));

            grid.FieldSettings.CellHeight = GridRowSizeHelper.GetRowHeightFromFontSize(grid.FontSize);

            foreach (var fieldlayout in parameter.Grid.FieldLayouts)
            {
                fieldlayout.RecordFilters.Clear();
            }

            RemoveColumnDescriptor(parameter);
        }
Exemple #2
0
 private static void RemoveColumnDescriptor(HeaderCommandParameter parameter)
 {
     if (parameter.Grid.FieldLayouts[0].SortedFields.FirstOrDefault(x => x.Field.Name == parameter.Column) != null)
     {
         parameter.Grid.FieldLayouts[0].SortedFields.Remove(parameter.Grid.FieldLayouts[0].SortedFields.FirstOrDefault(x => x.Field.Name == parameter.Column));
     }
 }
Exemple #3
0
        private static void OnDeleteFiltersExecute(HeaderCommandParameter parameter)
        {
            Argument.IsNotNull(() => parameter);

            foreach (var fieldlayout in parameter.Grid.FieldLayouts)
            {
                fieldlayout.RecordFilters.Clear();
            }
        }
Exemple #4
0
        private static void OnGroupByExecute(HeaderCommandParameter parameter)
        {
            Argument.IsNotNull(() => parameter);

            parameter.Grid.FieldLayouts[0].SortedFields.Add(new FieldSortDescription
            {
                Direction = System.ComponentModel.ListSortDirection.Ascending,
                FieldName = parameter.Column,
                IsGroupBy = true
            });
        }
Exemple #5
0
        private static Task OnPropertiesCommandExecute(HeaderCommandParameter parameter)
        {
            var managePropertiesModel = new ManagePropertiesModel();

            managePropertiesModel.Grid = parameter.Grid;

            managePropertiesModel.SelectedColumn = parameter.Column;// parameter.Grid.Selection != null ? parameter.Grid.Columns[parameter.ColumnClicked].Header : null;

            var viewModel = ViewModelFactory.CreateViewModel <ManagePropertiesViewModel>(managePropertiesModel, null);

            return(UIVisualizerService.ShowAsync(viewModel, OnPropertiesCommandCompleted));
        }
Exemple #6
0
        private static Task OnChangeColorCommandExecute(HeaderCommandParameter parameter)
        {
            var manageColorModel = new ManageColorModel
            {
                Grid           = parameter.Grid,
                SelectedColumn = parameter.Column
            };

            var modello = ViewModelFactory.CreateViewModel <ManageColorViewModel>(manageColorModel);

            return(UIVisualizerService.ShowDialogAsync(modello, OnChangeColorCompleted));
        }
Exemple #7
0
        private static Task OnChangeFontCommandExecute(HeaderCommandParameter parameter)
        {
            Argument.IsNotNull(() => parameter);

            var manageFontModel = new ManageFontModel {
                Grid = parameter.Grid
            };

            var viewModel = ViewModelFactory.CreateViewModel <ManageFontViewModel>(manageFontModel);

            return(UIVisualizerService.ShowDialogAsync(viewModel, OnManageFontCompleted));
        }
Exemple #8
0
        private static void OnSaveSettingsCommandExecute(HeaderCommandParameter parameter)
        {
            //Argument.IsNotNull(() => parameter);

            //var param = parameter.Grid;

            //SaveFileService.Filter = GridViewSettingFile;
            //if (SaveFileService.DetermineFile())
            //{
            //    // User selected a file
            //    using (var fs = File.OpenWrite(SaveFileService.FileName))
            //    {
            //        GridViewPersistenceHelper.SaveLayout(param, fs);
            //    }
            //}
        }
Exemple #9
0
        private static void OnSetDefaultCommandExecute(HeaderCommandParameter parameter)
        {
            //Argument.IsNotNull(() => parameter);

            //using (var ms = new MemoryStream())
            //{
            //    GridViewPersistenceHelper.SaveLayout(parameter.Grid, ms);

            //    ms.Seek(0, SeekOrigin.Begin);

            //    var content = ms.GetString(Encoding.UTF8);

            //    var encoded = StringBase64Helper.Base64Encode(content);

            //    StorageService.PushEntry(parameter.ViewModel, encoded, IsolatedStorageHelper.ViewModels);
            //}
        }
Exemple #10
0
        private static void OnLoadSettingsCommandExecute(HeaderCommandParameter parameter)
        {
            //Argument.IsNotNull(() => parameter);

            //var param = (parameter).Grid;

            //OpenFileService.Filter = GridViewSettingFile;
            //if (OpenFileService.DetermineFile())
            //{
            //    // User selected a file
            //    using (var fs = File.OpenRead(OpenFileService.FileName))
            //    {
            //        GridViewPersistenceHelper.LoadLayout(param, fs);
            //    }

            //    param.Rebind();
            //}
        }
Exemple #11
0
        private static void OnSortClearingExecute(HeaderCommandParameter parameter)
        {
            Argument.IsNotNull(() => parameter);

            RemoveColumnDescriptor(parameter);
        }
Exemple #12
0
        private static bool CanClearSettingsCommandExecute(HeaderCommandParameter parameter)
        {
            Argument.IsNotNull(() => parameter);

            return(parameter?.Grid != null);
        }
Exemple #13
0
 private static bool CanSaveSettingsCommandExecute(HeaderCommandParameter parameter)
 {
     return(parameter?.Grid != null);
 }