Esempio n. 1
0
        private void SetAutoFillMode(AutoFillMode mode)
        {
            mnuAutoFillNone.IsChecked = mode == AutoFillMode.NoAutoFill;
            mnuAutoFillCopyCurrent.IsChecked = mode == AutoFillMode.CopyCurrentData;
            mnuAutoFillTemplate.IsChecked = mode == AutoFillMode.TemplateData;

            _autoFillMode = mode;

            Config.SetUser(User, ConfigAutofillMode, mode);
        }
Esempio n. 2
0
        void RapidDataEntryLoaded(object sender, RoutedEventArgs evt)
        {
            // Load templates, if any...
            int siteTemplateId = Config.GetProfile(User, ConfigSiteTemplateId, -1);
            if (siteTemplateId >= 0) {
                LoadSiteTemplate(siteTemplateId);
            }

            int siteVisitTemplateId = Config.GetProfile(User, ConfigSitevisitTemplateId, -1);
            if (siteVisitTemplateId >= 0) {
                LoadSiteVisitTemplate(siteVisitTemplateId);
            }

            int materialTemplateId = Config.GetProfile(User, ConfigMaterialTemplateId, -1);
            if (materialTemplateId >= 0) {
                LoadMaterialTemplate(materialTemplateId);
            }

            _startLockMode = Config.GetUser(User, ConfigLockingMode, true);
            SetStartingLockMode(_startLockMode);

            _autoFillMode = Config.GetUser(User, ConfigAutofillMode, AutoFillMode.NoAutoFill);
            SetAutoFillMode(_autoFillMode);

            _autoNumber = Config.GetUser(User, ConfigAutoNumber, false);
            SetAutoNumber(_autoNumber);

            var root = BuildModel(_objectId, _objectType);

            if (root != null) {
                var siteModel = new ObservableCollection<ViewModelBase> {root};

                grpSites.DataContextChanged += (s, e) => {
                    var site = e.NewValue as RDESiteViewModel;
                    if (site != null) {
                        grpSiteVisits.Items = site.SiteVisits;
                    }
                };

                grpSiteVisits.DataContextChanged += (s, e) => {
                    var siteVisit = e.NewValue as RDESiteVisitViewModel;
                    if (siteVisit != null) {
                        grpMaterial.Items = siteVisit.Material;
                    }
                };

                grpSites.Items = siteModel;

            }

            grpSites.Content = new SiteRDEControl(User);
            grpSiteVisits.Content = new SiteVisitRDEControl(User);
            grpMaterial.Content = new MaterialRDEControl(User);

            var latLongMode = Config.GetUser(User, ConfigLatLongFormat, LatLongMode.DegreesMinutesSeconds);
            SetLatLongFormat(latLongMode);

            // Command Bindings...
            this.FindParentWindow().CommandBindings.Add(new CommandBinding(AddNewSiteCmd, ExecutedAddNewSite, CanExecuteAddNewSite));
            this.FindParentWindow().CommandBindings.Add(new CommandBinding(AddNewSiteVisitCmd, ExecutedAddNewSiteVisit, CanExecuteAddNewSiteVisit));
            this.FindParentWindow().CommandBindings.Add(new CommandBinding(AddNewMaterialCmd, ExecutedAddNewMaterial, CanExecuteAddNewMaterial));
            this.FindParentWindow().CommandBindings.Add(new CommandBinding(MoveNextCmd, ExecutedMoveNext, CanExecuteMoveNext));
            this.FindParentWindow().CommandBindings.Add(new CommandBinding(MovePreviousCmd, ExecutedMovePrevious, CanExecuteMovePrevious));
            this.FindParentWindow().CommandBindings.Add(new CommandBinding(UnlockAllCmd, ExecutedUnlockAll, CanExecuteUnlockAll));
        }