예제 #1
0
        /// <summary>
        /// Builds collectionSource DetailDescriptions.ItemProperties and collection of detail columns.
        /// </summary>
        /// <param name="collectionSource"></param>
        /// <param name="xceedControl"></param>
        /// <param name="detail"></param>
        public void  BuildDetailStructure(DataGridCollectionViewSource collectionSource, DataGridControl xceedGrid,
                                          DetailConfiguration detail)
        {
            Debug.Assert(null != collectionSource.DetailDescriptions);
            Debug.Assert(1 == collectionSource.DetailDescriptions.Count);

            _BuildCollectionSource(collectionSource.DetailDescriptions[0].ItemProperties);
            _BuildColumnsCollection(detail.Columns);

            // Add stops as detail of route.
            xceedGrid.DetailConfigurations.Clear();
            xceedGrid.DetailConfigurations.Add(detail);

            // NOTE: Set this property so that columns with custom order properties from default
            // settings were not added to grid automatically.
            xceedGrid.DetailConfigurations[0].AutoCreateColumns = false;

            // Collapse all detail and reexpand it.
            List <DataGridContext> dataGridContexts = new List <DataGridContext>(xceedGrid.GetChildContexts());

            foreach (DataGridContext dataGridContext in dataGridContexts)
            {
                dataGridContext.ParentDataGridContext.CollapseDetails(dataGridContext.ParentItem);
                dataGridContext.ParentDataGridContext.ExpandDetails(dataGridContext.ParentItem);
            }
        }
예제 #2
0
        /// <summary>
        /// Method inits Grids layout, loads grids structure for all types of Breaks.
        /// </summary>
        private void _InitDataGridLayout()
        {
            string gridStructure = null;
            string gridSettingsRepositoryName = null;
            DataGridCollectionViewSource gridCollectionViewSource = null;

            // Init TimeWindowGrid.
            gridStructure = GridSettingsProvider.TimeWindowBrakesGridStructure;
            gridSettingsRepositoryName = GridSettingsProvider.TimeWindowBreaksSettingsRepositoryName;
            gridCollectionViewSource   =
                (DataGridCollectionViewSource)LayoutRoot.FindResource(TIMEWINDOW_COLLECTION_SOURCE_KEY);
            _InitGridStructure(gridStructure, gridSettingsRepositoryName, TimeWindowGrid,
                               gridCollectionViewSource);

            // Init DriveTimeGrid.
            gridStructure = GridSettingsProvider.TimeIntervalBrakesGridStructure;
            gridSettingsRepositoryName = GridSettingsProvider.DriveTimeBreaksSettingsRepositoryName;
            gridCollectionViewSource   =
                (DataGridCollectionViewSource)LayoutRoot.FindResource(DRIVETIME_COLLECTION_SOURCE_KEY);
            _InitGridStructure(gridStructure, gridSettingsRepositoryName, DriveTimeGrid,
                               gridCollectionViewSource);

            // Init WorkTimeGrid.
            gridStructure = GridSettingsProvider.TimeIntervalBrakesGridStructure;
            gridSettingsRepositoryName = GridSettingsProvider.WorkTimeBreaksSettingsRepositoryName;
            gridCollectionViewSource   =
                (DataGridCollectionViewSource)LayoutRoot.FindResource(WORKTIME_COLLECTION_SOURCE_KEY);
            _InitGridStructure(gridStructure, gridSettingsRepositoryName, WorkTimeGrid,
                               gridCollectionViewSource);
        }
예제 #3
0
        /// <summary>
        /// Builds collection of item properties.
        /// </summary>
        /// <param name="parametersCount">Parameters count.</param>
        /// <param name="itemPorpertiesCollection">Item properties collection.</param>
        /// <param name="collectionSource">Collection source.</param>
        private void _BuildCollectionSource(int parametersCount,
                                            ArrayList itemPorpertiesCollection,
                                            DataGridCollectionViewSource collectionSource)
        {
            Debug.Assert(null != itemPorpertiesCollection);
            Debug.Assert(null != collectionSource);

            collectionSource.ItemProperties.Clear();
            foreach (DataGridItemProperty property in itemPorpertiesCollection)
            {
                if (!property.Name.Equals(DYNAMIC_FIELDS_ALIAS))
                {
                    collectionSource.ItemProperties.Add(property);
                }
                else
                {
                    for (int index = 0; index < parametersCount; ++index)
                    {
                        string valuePath =
                            property.ValuePath + string.Format(DYNAMIC_VALUE_NAME_FORMAT, index);
                        string valueName =
                            _GetDynamicFieldName(index);

                        var newProperty =
                            new DataGridItemProperty(valueName, valuePath, typeof(string));
                        collectionSource.ItemProperties.Add(newProperty);
                    }
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Method loads layout of Custom order properties data grid.
        /// </summary>
        private void _InitDataGridLayout()
        {
            // Get Data grid collection view source.
            DataGridCollectionViewSource gridCollectionViewSource =
                (DataGridCollectionViewSource)LayoutRoot.FindResource(CUSTOM_ORDER_PROPERTIES_COLLECTION_SOURCE_KEY);

            // Bind collection of custom order properties to Xceed DataGrid.
            gridCollectionViewSource.Source = _customOrderProperties;

            //Grid structure file name.
            string gridStructureFileName = GridSettingsProvider.CustomOrderPropertiesGridStructure;

            // Grid structure initializer.
            GridStructureInitializer gridStructureInitializer =
                new GridStructureInitializer(gridStructureFileName);

            // Build structure of Xceed DataGrid.
            gridStructureInitializer.BuildGridStructure(gridCollectionViewSource, _customOrderPropertiesXceedGrid);

            // Grid settings repository name.
            string gridSettingsRepositoryName =
                GridSettingsProvider.CustomOrderPropertiesSettingsRepositoryName;

            // Grid layout loader.
            GridLayoutLoader gridLayoutLoader =
                new GridLayoutLoader(gridSettingsRepositoryName, gridCollectionViewSource.ItemProperties);

            // Load grid layout.
            gridLayoutLoader.LoadLayout(_customOrderPropertiesXceedGrid);
        }
예제 #5
0
        /// <summary>
        /// Inits collecton of grid items
        /// </summary>
        protected override void _InitDataGridCollection()
        {
            DataGridCollectionViewSource                  vehicleCollectionSource            = (DataGridCollectionViewSource)base.LayoutRoot.FindResource(COLLECTION_SOURCE_KEY);
            IDataObjectCollection <VehicleSpecialty>      vehiclesSpecialtiesCollection      = (IDataObjectCollection <VehicleSpecialty>)App.Current.Project.VehicleSpecialties;
            SortedDataObjectCollection <VehicleSpecialty> sortedVehicleSpecialtiesCollection = new SortedDataObjectCollection <VehicleSpecialty>(vehiclesSpecialtiesCollection, new CreationTimeComparer <VehicleSpecialty>());

            vehicleCollectionSource.Source = sortedVehicleSpecialtiesCollection;
        }
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Loads grid layout.
        /// </summary>
        private void _InitDataGridLayout()
        {
            xceedGrid.OnItemSourceChanged += new EventHandler(xceedGrid_OnItemSourceChanged);

            DataGridCollectionViewSource collectionSource     = (DataGridCollectionViewSource)layoutRoot.FindResource(COLLECTION_SOURCE_KEY);
            GridStructureInitializer     structureInitializer = new GridStructureInitializer(GridSettingsProvider.FleetRoutesGridStructure);

            structureInitializer.BuildGridStructure(collectionSource, xceedGrid);
        }
예제 #7
0
        public void Dispose()
        {
            if (PopupFilterSelected != null)
            {
                var popupChild = PopupFilterSelected.Child as IDisposable;
                if (popupChild != null)
                {
                    popupChild.Dispose();
                }
                PopupFilterSelected.Child = null;
            }

            if (_popupValidate != null)
            {
                _popupValidate.Child   = null;
                _popupValidate.Opened -= _popupValidate_Opened;
                _popupValidate.Closed -= _popupValidate_Opened;
            }

            if (_view != null)
            {
                _view.Filter -= MeterNumbersPredicateDelegate;
            }

            if (worker != null)
            {
                worker.CancelAsync();

                worker.DoWork             -= WorkerDoWork;
                worker.RunWorkerCompleted -= WorkerCompleted;
            }

            if (_selectedDateChangedDescriptor != null)
            {
                _selectedDateChangedDescriptor.RemoveValueChanged(dateStart, OnSelectedDateChanged);
                _selectedDateChangedDescriptor.RemoveValueChanged(dateEnd, OnSelectedDateChanged);
            }

            if (_grid != null)
            {
                _grid.ClearItems();

                if (_grid.DetailConfigurations != null)
                {
                    _grid.DetailConfigurations.Clear();
                }
            }

            listLevelsForMonitoring.ClearItems();

            layoutGrid.Children.Clear();

            _grid       = null;
            _view       = null;
            DataContext = null;
        }
        /// <summary>
        /// Inits collection of route.
        /// </summary>
        private void _InitDataGridCollection()
        {
            var routes = DataKeeper.Routes;

            // init source collection
            var sortedRoutesCollection = new AppData.SortedDataObjectCollection <Route>(routes, new RoutesComparer());

            DataGridCollectionViewSource collectionSource =
                (DataGridCollectionViewSource)layoutRoot.FindResource(COLLECTION_SOURCE_KEY);

            collectionSource.Source = sortedRoutesCollection;
        }
예제 #9
0
        /// <summary>
        /// Init grid structure for Grid.
        /// </summary>
        /// <param name="gridStructure">Structure of the grid.</param>
        /// <param name="gridSettingsRepositoryName">Repository with grid settings.</param>
        /// <param name="grid">Grid.</param>
        /// <param name="collectionSource">Grid's collection source.</param>
        private void _InitGridStructure(string gridStructure, string gridSettingsRepositoryName,
                                        DataGridControlEx grid, DataGridCollectionViewSource collectionSource)
        {
            // Initializing gridstructure and gridlayout.
            GridStructureInitializer structureInitializer = new GridStructureInitializer
                                                                (gridStructure);

            structureInitializer.BuildGridStructure(collectionSource, grid);
            GridLayoutLoader layoutLoader = new GridLayoutLoader(gridSettingsRepositoryName,
                                                                 collectionSource.ItemProperties);

            layoutLoader.LoadLayout(grid);
        }
예제 #10
0
        private void _InitDataGridLayout()
        {
            DataGridCollectionViewSource fuelsCollection      = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY);
            GridStructureInitializer     structureInitializer = new GridStructureInitializer(GridSettingsProvider.FuelTypesGridStructure);

            structureInitializer.BuildGridStructure(fuelsCollection, XceedGrid);

            // load grid layout
            GridLayoutLoader layoutLoader = new GridLayoutLoader(GridSettingsProvider.FuelTypesSettingsRepositoryName, fuelsCollection.ItemProperties);

            layoutLoader.LoadLayout(XceedGrid);

            _isDataGridLayoutLoaded = true;
        }
예제 #11
0
        protected void _InitDataGridLayout()
        {
            DataGridCollectionViewSource collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY);

            GridStructureInitializer structureInitializer = new GridStructureInitializer(GridSettingsProvider.DriversGridStructure);

            structureInitializer.BuildGridStructure(collectionSource, XceedGrid);

            // load grid layout
            GridLayoutLoader layoutLoader = new GridLayoutLoader(GridSettingsProvider.DriversSettingsRepositoryName, collectionSource.ItemProperties);

            layoutLoader.LoadLayout(XceedGrid);

            _isDataGridLayoutLoaded = true;
        }
예제 #12
0
        /// <summary>
        /// Inits data grid layout
        /// </summary>
        protected void _InitDataGridLayout()
        {
            DataGridCollectionViewSource collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY);

            Debug.Assert(!string.IsNullOrEmpty(GridStructureName));
            GridStructureInitializer gridStructureInitializer = new GridStructureInitializer(GridStructureName);

            gridStructureInitializer.BuildGridStructure(collectionSource, XceedGrid);

            // load grid layout
            Debug.Assert(!string.IsNullOrEmpty(SettingsRepositoryName));
            GridLayoutLoader vehicleLayoutLoader = new GridLayoutLoader(SettingsRepositoryName, collectionSource.ItemProperties);

            vehicleLayoutLoader.LoadLayout(XceedGrid);
            _isDataGridLayoutLoaded = true;
        }
예제 #13
0
        protected void _InitDataGridCollection()
        {
            try
            {
                DataGridCollectionViewSource          fuelsCollection = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY);
                IDataObjectCollection <FuelType>      fuelTypes       = App.Current.Project.FuelTypes;
                SortedDataObjectCollection <FuelType> sortedFuelTypes = new SortedDataObjectCollection <FuelType>(fuelTypes, new CreationTimeComparer <FuelType>());
                fuelsCollection.Source = sortedFuelTypes;

                fuelsCollection.View.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(View_CollectionChanged);

                _isDataGridCollectionInited = true;
            }
            catch (Exception ex)
            {
                _isDataGridCollectionInited = false;
                Logger.Info(ex);
            }
        }
예제 #14
0
        /// <summary>
        /// Method inits collection of drivers.
        /// </summary>
        protected void _InitDataGridCollection()
        {
            try
            {
                DataGridCollectionViewSource collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY);


                IDataObjectCollection <Driver>      collection = (IDataObjectCollection <Driver>)App.Current.Project.Drivers;
                SortedDataObjectCollection <Driver> sortedDriversCollection = new SortedDataObjectCollection <Driver>(collection, new CreationTimeComparer <Driver>());
                collectionSource.Source = sortedDriversCollection;

                _isDataGridCollectionInited = true;
            }
            catch (Exception ex)
            {
                _isDataGridCollectionInited = false;
                Logger.Info(ex);
            }
        }
예제 #15
0
        /// <summary>
        /// Method loads grid layout
        /// </summary>
        private void _InitCategoriesDataGridLayout()
        {
            DataGridCollectionViewSource collectionSource =
                (DataGridCollectionViewSource)LayoutRoot.FindResource("categoryCollection");

            collectionSource.Source = SymbologyManager.OrderCategories;

            GridStructureInitializer structureInitializer =
                new GridStructureInitializer("ESRI.ArcLogistics.App.GridHelpers.CategorySymbologyGridStructure.xaml");

            structureInitializer.BuildGridStructure(collectionSource, CategoryXceedGrid);

            // load grid layout
            GridLayoutLoader layoutLoader = new GridLayoutLoader("CategoriesGridSettings", collectionSource.ItemProperties);

            layoutLoader.LoadLayout(CategoryXceedGrid);

            CategoryValidationRule valueValidationRule = new CategoryValidationRule();

            CategoryXceedGrid.Columns[VALUE_COLUMN_INDEX].CellValidationRules.Add(valueValidationRule);
        }
        /// <summary>
        /// Inits collection of items
        /// </summary>
        protected void _InitDataGridCollection()
        {
            Project project = App.Current.Project;

            if (project == null)
            {
                _isDataGridCollectionInited = false;
            }
            else
            {
                DataGridCollectionViewSource collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY);

                IDataObjectCollection <Vehicle>      collection = (IDataObjectCollection <Vehicle>)project.Vehicles;
                SortedDataObjectCollection <Vehicle> sortedVehiclesCollection = new SortedDataObjectCollection <Vehicle>(collection, new CreationTimeComparer <Vehicle>());
                collectionSource.Source = sortedVehiclesCollection;

                ((INotifyCollectionChanged)XceedGrid.Items).CollectionChanged += new NotifyCollectionChangedEventHandler(VehiclesPage_CollectionChanged);

                _isDataGridCollectionInited = true;
            }
        }
예제 #17
0
        /// <summary>
        /// Method inits collection of locations.
        /// </summary>
        protected void _IniDataGridCollection()
        {
            Project project = App.Current.Project;

            if (project != null)
            {
                DataGridCollectionViewSource collectionSource = (DataGridCollectionViewSource)LayoutRoot.FindResource(COLLECTION_SOURCE_KEY);

                IDataObjectCollection <Location>      collection = (IDataObjectCollection <Location>)project.Locations;
                SortedDataObjectCollection <Location> sortedLocationsCollection = new SortedDataObjectCollection <Location>(collection, new CreationTimeComparer <Location>());
                collectionSource.Source = sortedLocationsCollection;

                ((INotifyCollectionChanged)XceedGrid.Items).CollectionChanged += new NotifyCollectionChangedEventHandler(LocationsPage_CollectionChanged);

                _isDataGridCollectionInited = true;
                XceedGrid.SelectedItems.Clear();
            }
            else
            {
                _isDataGridCollectionInited = false;
            }
        }
예제 #18
0
        /// <summary>
        /// Loads grid structure (ItemPorperties and Columns) from xaml.
        /// </summary>
        /// <param name="key">Resource key.</param>
        /// <param name="parametersCount">Parameters count.</param>
        /// <param name="collectionSource">Collection source.</param>
        /// <param name="xceedGrid">Xceed grid control.</param>
        private void _CreateStructureFromXAML(string key,
                                              int parametersCount,
                                              DataGridCollectionViewSource collectionSource,
                                              DataGridControl xceedGrid)
        {
            Debug.Assert(!string.IsNullOrEmpty(key));
            Debug.Assert(null != collectionSource);
            Debug.Assert(null != xceedGrid);

            try
            {
                // load structure from XAML
                ArrayList itemPorpertiesCollection = null;
                ArrayList columns = null;
                using (Stream stream = this.GetType().Assembly.GetManifestResourceStream(key))
                {
                    string template = new StreamReader(stream).ReadToEnd();
                    using (StringReader stringReader = new StringReader(template))
                    {
                        using (XmlTextReader xmlReader = new XmlTextReader(stringReader))
                        {
                            var resource = XamlReader.Load(xmlReader) as ResourceDictionary;
                            itemPorpertiesCollection =
                                resource[ITEM_PROPERTIES_RESOURCE_NAME] as ArrayList;

                            columns = resource[COLUMNS_RESOURCE_NAME] as ArrayList;
                        }
                    }
                }

                _BuildCollectionSource(parametersCount, itemPorpertiesCollection, collectionSource);
                _BuildColumnsCollection(parametersCount, columns, xceedGrid.Columns);
            }
            catch (Exception ex)
            {
                Logger.Info(ex.Message);
            }
        }
예제 #19
0
        private void CloseGroupByItem(object sender, ExecutedRoutedEventArgs e)
        {
            if (e.OriginalSource is FrameworkElement)
            {
                FrameworkElement element = e.OriginalSource as FrameworkElement;

                if ((element.TemplatedParent != null) && (element.TemplatedParent is GroupByItem))
                {
                    GroupByItem groupByItem = element.TemplatedParent as GroupByItem;

                    if (groupByItem.Content is GroupLevelDescription)
                    {
                        GroupLevelDescription closedGroupDescription = groupByItem.Content as GroupLevelDescription;

                        if (sender is DataGridControl)
                        {
                            DataGridControl grid = sender as DataGridControl;

                            ICollectionView collectionView = DataGridCollectionViewSource.GetDefaultView(grid.ItemsSource);

                            if (collectionView != null)
                            {
                                IEnumerable <DataGridGroupDescription> descriptions = from DataGridGroupDescription groupDescription in collectionView.GroupDescriptions
                                                                                      where groupDescription.PropertyName == closedGroupDescription.FieldName
                                                                                      select groupDescription;

                                if ((descriptions != null) && (descriptions.Count() > 0))
                                {
                                    collectionView.GroupDescriptions.Remove(descriptions.First());
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #20
0
        private void FilterAdvandedStart_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                AcynsUser1 TexTo = new AcynsUser1();
                Dictionary <string, dynamic> mapEx = new Dictionary <string, dynamic>();
                string        path1                 = appPath + @"\LuuFile" + strfile + "]ex.tex";
                List <string> listend               = new List <string>();
                List <SortId> listcodeId            = new List <SortId>();
                DataGridCollectionViewSource source = GridTotal.FindResource("cvsDataGrid") as DataGridCollectionViewSource;
                foreach (var item in DataGrid.Items)
                {
                    DataGrid.CurrentItem = item;
                    Xceed.Wpf.DataGrid.DataRow row = DataGrid.GetContainerFromItem(DataGrid.CurrentItem) as Xceed.Wpf.DataGrid.DataRow;
                    if (row != null)
                    {
                        int    numberExerciseselect = 0;
                        string codeId = row.Cells[0].Content.ToString();
                        var    itit   = row.Cells[3].Content;
                        if (row.Cells[2].Content != null)
                        {
                            numberExerciseselect = (int)row.Cells[3].Content;
                        }
                        int numberExercise = (int)row.Cells[2].Content;
                        if (numberExerciseselect > numberExercise)
                        {
                            listend = null;
                            break;
                        }
                        else
                        {
                            bool isCheck = (bool)row.Cells[4].Content;
                            if (isCheck == true && numberExerciseselect > 0)
                            {
                                List <string> list      = new List <string>();
                                List <string> listItem  = Dic[codeId];
                                int           itemCount = listItem.Count;
                                Random        random    = new Random();
                                if (sortoder.IsChecked == false)
                                {
                                    for (int i = 0; i < numberExerciseselect; i++)
                                    {
                                        list.Add(listItem[random.Next(0, itemCount)]);
                                    }
                                    listend.AddRange(list);
                                }
                                else
                                {
                                    for (int i = 0; i < numberExerciseselect; i++)
                                    {
                                        list.Add(listItem[random.Next(0, itemCount)]);
                                    }
                                    mapEx.Add(codeId, list);
                                }
                            }
                        }
                    }
                }

                if (sortoder.IsChecked == true)
                {
                    List <SortId> listsort = Dic["listid"];
                    if (Sort1.IsChecked == true)
                    {
                        listsort = listsort.OrderBy(m => m.ClassId).ThenBy(m => m.ObjectId).ThenBy(m => m.CharterId).ThenBy(m => m.SectionId).ThenBy(m => m.LevelId).ToList <SortId>();
                    }
                    if (Sort2.IsChecked == true)
                    {
                        listsort = listsort.OrderBy(m => m.ObjectId).ThenBy(m => m.ClassId).ThenBy(m => m.CharterId).ThenBy(m => m.SectionId).ThenBy(m => m.LevelId).ToList <SortId>();
                    }
                    if (Sort3.IsChecked == true)
                    {
                        listsort = listsort.OrderBy(m => m.ClassId).ThenBy(m => m.ObjectId).ThenBy(m => m.CharterId).ThenBy(m => m.LevelId).ThenBy(m => m.SectionId).ToList <SortId>();
                    }
                    if (Sort4.IsChecked == true)
                    {
                        listsort = listsort.OrderBy(m => m.LevelId).ThenBy(m => m.ClassId).ThenBy(m => m.ObjectId).ThenBy(m => m.CharterId).ThenBy(m => m.SectionId).ToList <SortId>();
                    }
                    foreach (SortId item in listsort)
                    {
                        string codeId = item.CodeId;
                        if (mapEx.ContainsKey(codeId))
                        {
                            List <string> list = mapEx[codeId];
                            listend.AddRange(list);
                            listcodeId.Add(item);
                        }
                    }
                }
                mapEx.Add("listid", listcodeId);
                string strHeader = "";
                string strFooter = "";
                if (Form.IsChecked == true)
                {
                    strHeader = File.ReadAllText(fileForm.Text);
                    string FooterPath = app + @"\MauFile\Footer.tex";
                    strFooter = File.ReadAllText(FooterPath);
                }
                if (listend != null && listend.Count > 0 && DevideFile.IsChecked == true)
                {
                    TexTo.DevideFile2("ex", mapEx, appPath, strHeader, strFooter, Boxbt.IsChecked, AutoWord.IsChecked, Devide1.IsChecked, Devide2.IsChecked, Devide3.IsChecked, Devide4.IsChecked);
                }
                if (listend != null && listend.Count > 0)
                {
                    if (commentorder.IsChecked == true)
                    {
                        User1Before classBefore = new User1Before();
                        listend = classBefore.CommentOrder(listend);
                    }
                    if (Boxex.IsChecked == true)
                    {
                        string pathnew = appPath + @"\LuuFile[" + strfile + "]ex.tex";
                        classlist.newFileTex(listend, pathnew, strHeader, strFooter);
                        FileTexEx.Text = path1;
                        NumberEx.Text  = listend.Count.ToString();
                        if (AutoWord.IsChecked == true)
                        {
                            List <string> listExNew = new List <string>();
                            foreach (string item in listend)
                            {
                                string itemnew = "e" + item.Remove(item.Length - 8, 8).Remove(0, 11);
                                listExNew.Add(itemnew);
                            }
                            string path2nem = appPath + @"\LuuFile[" + strfile + "]ex";
                            if (DevideFile.IsChecked == false)
                            {
                                TexTo.startListTexToWord1(listExNew, path2nem);
                            }
                        }
                    }
                    System.Windows.Forms.MessageBoxEx.Show("Các chức năng BankEx sẽ ko sử dụng khi lọc nâng cao,chức năng tách file, tex to word sẽ chạy bất đồng bộ, các file sẽ được lưu trong folder lọc file hoặc folder LuuFile,sẽ có thông báo khi thành công", 4000);
                }
                else
                {
                    System.Windows.MessageBox.Show("Tạo file không thành công", "Thoát");
                }
            }
            catch (Exception a)
            {
                System.Windows.MessageBox.Show(a.Message, "Thoát");
            }
        }
예제 #21
0
        private void FilterAdvandedEx_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (System.Windows.MessageBox.Show("Tiến hành lọc Id", "Xác nhận lọc Id", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    Dic = new Dictionary <string, dynamic>();
                    List <dynamic> listMapEx = new List <dynamic>();
                    string         str       = "";
                    string         type      = "ex";
                    List <string>  listex    = new List <string>();
                    List <string>  listbt    = new List <string>();
                    List <string>  listregex = CreatRegex();
                    str     = listregex[0];
                    strfile = listregex[1];
                    Regex rx = new Regex(str);
                    listMapEx = classlist.mapNewFile(rx, type, listPath);
                    if ((listMapEx == null || listMapEx.Count == 0))
                    {
                        System.Windows.MessageBox.Show("Không có câu hỏi nào trắc nghiệm được lọc ra", "Thoát");
                    }
                    List <string> listLabel = new List <string>();
                    List <SortId> listsort  = new List <SortId>();
                    Dic = new Dictionary <string, dynamic>();
                    var listDataGrid = new List <DataGrid1>();
                    foreach (var item in listMapEx)
                    {
                        string stringId   = item["codeId"];
                        string stringEcer = item["exersice"];
                        if (listLabel.Contains(stringId))
                        {
                            Dic[stringId].Add(stringEcer);
                        }
                        else
                        {
                            List <string> listEcer = new List <string>();
                            listEcer.Add(stringEcer);
                            Dic.Add(stringId, listEcer);
                            listLabel.Add(stringId);
                            SortId sort = new SortId();
                            sort.ClassId = int.Parse(stringId[0].ToString());
                            if (stringId[1] == 'D')
                            {
                                sort.ObjectId = 1;
                            }
                            else
                            {
                                sort.ObjectId = 2;
                            }
                            sort.CharterId = int.Parse(stringId[2].ToString());
                            switch (stringId[3])
                            {
                            case 'Y':
                                sort.LevelId = 1;
                                break;

                            case 'B':
                                sort.LevelId = 2;
                                break;

                            case 'K':
                                sort.LevelId = 3;
                                break;

                            case 'G':
                                sort.LevelId = 5;
                                break;

                            case 'T':
                                sort.LevelId = 4;
                                break;
                            }
                            sort.SectionId = int.Parse(stringId[4].ToString());
                            sort.CodeId    = stringId;
                            listsort.Add(sort);
                        }
                    }
                    Dic.Add("listid", listsort);
                    Dic.Add("listCodeId", listLabel);
                    foreach (var item in listLabel)
                    {
                        DataGrid1 getDataGrid1 = new DataGrid1();
                        int       classId      = Int32.Parse(item[0].ToString());
                        if (classId > 3)
                        {
                            getDataGrid1.ClassName = "Lớp " + classId;
                        }
                        if (classId <= 3)
                        {
                            getDataGrid1.ClassName = "Lớp 1" + classId;
                        }
                        char strChapterName1 = item[1];
                        char strChapterName2 = item[2];
                        if (strChapterName1 == 'H')
                        {
                            getDataGrid1.ChapterName = "Hình  chương " + strChapterName2;
                        }
                        if (strChapterName1 == 'D')
                        {
                            getDataGrid1.ChapterName = "Đại  chương " + strChapterName2;
                        }
                        char strSectionName = item[4];
                        getDataGrid1.SectionName = "Bài " + strSectionName;
                        char levelName = item[3];
                        if (levelName == 'Y')
                        {
                            getDataGrid1.LevelId = "Yếu";
                        }
                        if (levelName == 'B')
                        {
                            getDataGrid1.LevelId = "Trung bình";
                        }
                        if (levelName == 'K')
                        {
                            getDataGrid1.LevelId = "Khá";
                        }
                        if (levelName == 'G')
                        {
                            getDataGrid1.LevelId = "Giỏi";
                        }
                        getDataGrid1.CodeId               = item;
                        getDataGrid1.NumberExersice       = Dic[item].Count;
                        getDataGrid1.NumberExersiceSelect = 0;
                        getDataGrid1.IsSelected           = false;
                        listDataGrid.Add(getDataGrid1);
                    }
                    DataGridCollectionViewSource source = GridTotal.FindResource("cvsDataGrid") as DataGridCollectionViewSource;
                    source.Source = listDataGrid;
                }
            }
            catch (Exception a)
            {
                System.Windows.MessageBox.Show(a.Message, "Thoát");
            }
        }
예제 #22
0
        /// <summary>
        /// Inits grid source.
        /// </summary>
        /// <param name="maxParametersCount">Maximum number of attribute parameters.</param>
        /// <param name="collectionSource">Data grid collection source.</param>
        private void _InitGridSource(int maxParametersCount,
                                     DataGridCollectionViewSource collectionSource)
        {
            IVrpSolver                solver             = App.Current.Solver;
            SolverSettings            solverSettings     = solver.SolverSettings;
            NetworkDescription        networkDescription = solver.NetworkDescription;
            ICollection <Restriction> restrictions       = solverSettings.Restrictions;

            var restrictionWrappers = new List <RestrictionDataWrapper>();

            var networkAttributes = networkDescription.NetworkAttributes;

            foreach (NetworkAttribute attribute in networkAttributes)
            {
                if (attribute.UsageType == NetworkAttributeUsageType.Restriction)
                {
                    Restriction restriction = _FindRestriction(attribute.Name, restrictions);
                    if (restriction.IsEditable)
                    {
                        Debug.Assert(null != attribute.Parameters);

                        // Create collection of all non "restriction usage" attribute parameters.
                        IList <NetworkAttributeParameter> attrParams;
                        if (attribute.RestrictionUsageParameter != null)
                        {
                            attrParams = attribute.Parameters.Where(
                                param => param.Name != attribute.RestrictionUsageParameter.Name).ToList();
                        }
                        else
                        {
                            attrParams = attribute.Parameters.ToList();
                        }

                        var parameters = new Parameters(maxParametersCount);
                        for (int index = 0; index < maxParametersCount; ++index)
                        {
                            string value = null;
                            if (index < attrParams.Count())
                            {
                                NetworkAttributeParameter param = attrParams.ElementAt(index);
                                value             = _GetParameterValue(attribute.Name, param.Name, solverSettings);
                                parameters[index] = new Parameter(param.Name, value);
                            }
                            else
                            {
                                parameters[index] = new Parameter();
                            }
                        }

                        // Create wrapper for restriction.
                        var wrapper = new RestrictionDataWrapper(restriction.IsEnabled,
                                                                 restriction.NetworkAttributeName,
                                                                 restriction.Description, parameters);

                        // If attribute has restriction usage parameter - add this parameter
                        // to wrapper.
                        if (attribute.RestrictionUsageParameter != null)
                        {
                            var restrictionUsageParameterValue = _GetParameterValue(attribute.Name,
                                                                                    attribute.RestrictionUsageParameter.Name, solverSettings);
                            var restrictionParameter = new Parameter(attribute.RestrictionUsageParameter.Name,
                                                                     restrictionUsageParameterValue);
                            wrapper.RestrictionUsageParameter = restrictionParameter;
                        }

                        restrictionWrappers.Add(wrapper);
                    }
                }
            }

            collectionSource.Source = restrictionWrappers;
        }
예제 #23
0
 /// <summary>
 /// Builds collectionSource ItemPorperties collection and collection of xceedGrid columns.
 /// </summary>
 /// <param name="collectionSource"></param>
 /// <param name="xceedControl"></param>
 public void BuildGridStructure(DataGridCollectionViewSource collectionSource, DataGridControl xceedGrid)
 {
     _BuildCollectionSource(collectionSource.ItemProperties);
     _BuildColumnsCollection(xceedGrid.Columns);
     _InitPrintConfiguration(xceedGrid);
 }
예제 #24
0
        protected override void _ClearDataGridCollection()
        {
            DataGridCollectionViewSource vehicleCollectionSource = (DataGridCollectionViewSource)base.LayoutRoot.FindResource(COLLECTION_SOURCE_KEY);

            vehicleCollectionSource.Source = null;
        }
예제 #25
0
        public bool Init()
        {
#if DEBUG
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
#endif
            Manager.UI.RunUILocked((() =>
            {
                progress.Visibility = System.Windows.Visibility.Collapsed;

                if (_типМодуля == Common.ModuleType.MonitoringAutoSbor)
                {
                    _grid = (this.Resources["gridAutoSbor"] as DataTemplate).LoadContent() as DataGridControl;
                    _view = this.Resources["viewSourceAutoSbor"] as DataGridCollectionViewSource;
                    //cfg = Manager.Config.DataMonitAutosborShortcut;
                }
                else
                {
                    _grid = (this.Resources["grid61968"] as DataTemplate).LoadContent() as DataGridControl;
                    _view = this.Resources["viewSource61968"] as DataGridCollectionViewSource;
                    //cfg = Manager.Config.DataMonit61968Shortcut;
                }

                try
                {
                    _levelsForMonitoringSource =
                        GlobalEnumsDictionary.GroupingLevelsForMonitoringDictionary
                        .Select(g => new TSimpleChecked()
                    {
                        Id = (int)g.Key,
                        Text = g.Value,
                        IsChecked = true,
                    })
                        .ToList();
                }
                catch (Exception)
                {
                }
                _view.Source = _viewSource;
                //Подписываем на предикат фильтра отображения объектов без ПУ
                _view.Filter += MeterNumbersPredicateDelegate;
                layoutGrid.Children.Add(_grid);

                listLevelsForMonitoring.ItemsSource = _levelsForMonitoringSource;
                if (_levelsForMonitoringSource != null && _levelsForMonitoringSource.Count > 0)
                {
                    listLevelsForMonitoring.SelectedIndex = 0;
                }

                progress.Visibility = System.Windows.Visibility.Visible;
            }));

            //-----Событие на смену начальной даты, в конечной дате день ставим из начальной даты
            _selectedDateChangedDescriptor = DependencyPropertyDescriptor.FromProperty(Xceed.Wpf.Controls.DatePicker.SelectedDateProperty,
                                                                                       typeof(Xceed.Wpf.Controls.DatePicker));
            _selectedDateChangedDescriptor.AddValueChanged(dateStart, new EventHandler(OnSelectedDateChanged));
            _selectedDateChangedDescriptor.AddValueChanged(dateEnd, new EventHandler(OnSelectedDateChanged));

#if DEBUG
            sw.Stop();
            Console.WriteLine("Инициализация {0} млс", sw.ElapsedMilliseconds);
#endif
            return(true);
        }