public ReportCreationDialogViewModel(IDataService <LabDbEntities> labDbData,
                                             IEventAggregator aggregator,
                                             IReportService reportService) : base()
        {
            _labDbData          = labDbData;
            _eventAggregator    = aggregator;
            _reportService      = reportService;
            _creationMode       = CreationModes.Report;
            _isCreatingFromTask = false;

            _number  = _reportService.GetNextReportNumber();
            TechList = _labDbData.RunQuery(new PeopleQuery()
            {
                Role = PeopleQuery.PersonRoles.MaterialTestingTech
            })
                       .ToList();
            _author           = TechList.First(prs => prs.ID == (Thread.CurrentPrincipal as DBPrincipal).CurrentPerson.ID);
            _requirementList  = new List <ISelectableRequirement>();
            SpecificationList = _labDbData.RunQuery(new SpecificationsQuery()).ToList();

            ConfirmCommand = new DelegateCommand <Window>(
                parent =>
            {
                // Checks if DoNotTest flag is enabled and asks for user confirmation if it is

                if (_selectedBatch.DoNotTest)
                {
                    string confirmationMessage          = "Nel batch " + _selectedBatch.Number + " è impostato il flag \"Non effettuare test su questo batch\".\nContinuando il flag verrà rimosso, continuare?";
                    MessageBoxResult confirmationResult = System.Windows.MessageBox.Show(confirmationMessage,
                                                                                         "Conferma",
                                                                                         MessageBoxButton.YesNo);

                    if (confirmationResult != MessageBoxResult.Yes)
                    {
                        return;
                    }

                    _selectedBatch.DoNotTest = false;
                    _selectedBatch.Update();
                }
                parent.DialogResult = true;
            },
                parent => !HasErrors);

            CancelCommand = new DelegateCommand <Window>(
                parent =>
            {
                parent.DialogResult = false;
            });

            SelectedSpecification = null;
            BatchNumber           = "";
        }
Esempio n. 2
0
        /// <summary>
        /// Connects layers in a feed-forward fashion, creating weights that connect them.
        /// </summary>
        /// <param name="randomizeWeights">If set to true, the weights will be given small random values</param>
        public void Initialize(CreationModes mode)
        {
            AssertCanInitialize();
            ConnectLayersForward();

            if (mode == CreationModes.RandomizeWeights)
            {
                RandomizeWeights();
            }
            else if (mode == CreationModes.SetWeightToHalf)
            {
                SetWeights(0.5);
            }

            IsInitialized = true;
        }
Esempio n. 3
0
 public void Initialize(CreationModes mode)
 {
     hiddenLayer.RandomizeWeights();
     outputLayer.RandomizeWeights();
     IsInitialized = true;
 }