Esempio n. 1
0
 /// <summary>
 /// Danner ViewModel for en adressekonto.
 /// </summary>
 /// <param name="regnskabViewModel">ViewModel for regnskabet, som adressekontoen skal være tilknyttet.</param>
 /// <param name="adressekontoModel">Model for adressekontoen.</param>
 /// <param name="displayName">Navn for ViewModel, som kan benyttes til visning i brugergrænsefladen.</param>
 /// <param name="image">Billede, der illustrerer en adressekontoen.</param>
 /// <param name="finansstyringRepository">Implementering af repository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for en exceptionhandler.</param>
 public AdressekontoViewModel(IRegnskabViewModel regnskabViewModel, IAdressekontoModel adressekontoModel, string displayName, byte[] image, IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
 {
     if (regnskabViewModel == null)
     {
         throw new ArgumentNullException("regnskabViewModel");
     }
     if (adressekontoModel == null)
     {
         throw new ArgumentNullException("adressekontoModel");
     }
     if (string.IsNullOrEmpty(displayName))
     {
         throw new ArgumentNullException("displayName");
     }
     if (image == null)
     {
         throw new ArgumentNullException("image");
     }
     if (finansstyringRepository == null)
     {
         throw new ArgumentNullException("finansstyringRepository");
     }
     if (exceptionHandlerViewModel == null)
     {
         throw new ArgumentNullException("exceptionHandlerViewModel");
     }
     _regnskabViewModel = regnskabViewModel;
     _adressekontoModel = adressekontoModel;
     _adressekontoModel.PropertyChanged += PropertyChangedOnAdressekontoModelEventHandler;
     _displayName               = displayName;
     _image                     = image;
     _finansstyringRepository   = finansstyringRepository;
     _exceptionHandlerViewModel = exceptionHandlerViewModel;
 }
 /// <summary>
 /// Danner en kommando, der kan tilføje en bogføringslinje til et regnskab.
 /// </summary>
 /// <param name="finansstyringRepository">Implementering af repository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel til exceptionhandleren.</param>
 public BogføringAddCommand(IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(exceptionHandlerViewModel)
 {
     if (finansstyringRepository == null)
     {
         throw new ArgumentNullException("finansstyringRepository");
     }
     _finansstyringRepository = finansstyringRepository;
 }
Esempio n. 3
0
 /// <summary>
 /// Danner basisfunktionalitet til en kommando, der skal udføres på en ViewModel.
 /// </summary>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel til en exceptionhandler.</param>
 protected ViewModelCommandBase(IExceptionHandlerViewModel exceptionHandlerViewModel)
 {
     if (exceptionHandlerViewModel == null)
     {
         throw new ArgumentNullException("exceptionHandlerViewModel");
     }
     _exceptionHandlerViewModel = exceptionHandlerViewModel;
     _synchronizationContext    = SynchronizationContext.Current;
 }
 /// <summary>
 /// Danner en kommando, der på et regnskab kan initerer en ny ViewModel til bogføring.
 /// </summary>
 /// <param name="finansstyringRepository">Implementering af repository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel til exceptionhandleren.</param>
 /// <param name="runRefreshTasks">Angivelse af, om de Tasks, der udfører refresh, skal køres ved initiering af ViewModel, hvorfra der kan bogføres.</param>
 public BogføringSetCommand(IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel, bool runRefreshTasks)
     : base(exceptionHandlerViewModel)
 {
     if (finansstyringRepository == null)
     {
         throw new ArgumentNullException("finansstyringRepository");
     }
     _finansstyringRepository = finansstyringRepository;
     _runRefreshTasks         = runRefreshTasks;
 }
Esempio n. 5
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="args">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs args)
        {
            var rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                // Associate the frame with a SuspensionManager key
                SuspensionManager.RegisterFrame(rootFrame, "FinansstyringAppRootFrame");

                _mainViewModel = (IMainViewModel)Resources["MainViewModel"];
                _mainViewModel.ApplyConfiguration(ConfigurationProvider.Instance.Settings);

                _exceptionHandlerViewModel = _mainViewModel.ExceptionHandler;

                Current.UnhandledException            += UnhandledExceptionEventHandler;
                TaskScheduler.UnobservedTaskException += UnobservedTaskExceptionEventHandler;

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // Restore the saved session state only when appropritate
                    try
                    {
                        await SuspensionManager.RestoreAsync();
                    }
                    catch (SuspensionManagerException)
                    {
                        //Something went wrong restoring state.
                        //Assume there is no state and continue
                    }
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
 /// <summary>
 /// Danner en ViewModel indeholdende konfiguration til finansstyring.
 /// </summary>
 /// <param name="finansstyringKonfigurationRepository">Implementering af konfigurationsrepository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewMdoel til en exceptionhandler.</param>
 public FinansstyringKonfigurationViewModel(IFinansstyringKonfigurationRepository finansstyringKonfigurationRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
 {
     if (finansstyringKonfigurationRepository == null)
     {
         throw new ArgumentNullException("finansstyringKonfigurationRepository");
     }
     if (exceptionHandlerViewModel == null)
     {
         throw new ArgumentNullException("exceptionHandlerViewModel");
     }
     _finansstyringKonfigurationRepository = finansstyringKonfigurationRepository;
     _exceptionHandlerViewModel            = exceptionHandlerViewModel;
 }
Esempio n. 7
0
 /// <summary>
 /// Danner en ViewModel, der indeholder grundlæggende tabeloplysninger, såsom typer, grupper m.m.
 /// </summary>
 /// <param name="tabelModel">Modellen, der indeholder grundlæggende tabeloplysninger, såsom typer, grupper m.m.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for en exceptionhandler.</param>
 protected TabelViewModelBase(TTabelModel tabelModel, IExceptionHandlerViewModel exceptionHandlerViewModel)
 {
     if (Equals(tabelModel, null))
     {
         throw new ArgumentNullException("tabelModel");
     }
     if (exceptionHandlerViewModel == null)
     {
         throw new ArgumentNullException("exceptionHandlerViewModel");
     }
     _tabelModel = tabelModel;
     _tabelModel.PropertyChanged += PropertyChangedOnTabelModelEventHandler;
     _exceptionHandlerViewModel   = exceptionHandlerViewModel;
 }
Esempio n. 8
0
 /// <summary>
 /// Danner ViewModel for en liste indeholdende regnskaber.
 /// </summary>
 /// <param name="finansstyringRepository">Implementering af repository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for en exceptionhandler.</param>
 public RegnskabslisteViewModel(IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
 {
     if (finansstyringRepository == null)
     {
         throw new ArgumentNullException("finansstyringRepository");
     }
     if (exceptionHandlerViewModel == null)
     {
         throw new ArgumentNullException("exceptionHandlerViewModel");
     }
     _finansstyringRepository       = finansstyringRepository;
     _exceptionHandlerViewModel     = exceptionHandlerViewModel;
     _regnskaber.CollectionChanged += RegnskaberCollectionChangedEventHandler;
 }
Esempio n. 9
0
 /// <summary>
 /// Danner en ViewModel indeholdende grundlæggende kontooplysninger.
 /// </summary>
 /// <param name="regnskabViewModel">ViewModel for regnskabet, som kontoen er tilknyttet.</param>
 /// <param name="kontoModel">Model indeholdende grundlæggende kontooplysninger.</param>
 /// <param name="kontogruppeViewModel">ViewModel for kontogruppen.</param>
 /// <param name="displayName">Navn for ViewModel, som kan benyttes til visning i brugergrænsefladen.</param>
 /// <param name="image">Billede, der illustrerer en kontoen.</param>
 /// <param name="finansstyringRepository">Implementering af repositoryet til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for exceptionhandleren.</param>
 protected KontoViewModelBase(IRegnskabViewModel regnskabViewModel, TKontoModel kontoModel, TKontogruppeViewModel kontogruppeViewModel, string displayName, byte[] image, IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
 {
     if (regnskabViewModel == null)
     {
         throw new ArgumentNullException("regnskabViewModel");
     }
     if (Equals(kontoModel, null))
     {
         throw new ArgumentNullException("kontoModel");
     }
     if (Equals(kontogruppeViewModel, null))
     {
         throw new ArgumentNullException("kontogruppeViewModel");
     }
     if (string.IsNullOrEmpty(displayName))
     {
         throw new ArgumentNullException("displayName");
     }
     if (image == null)
     {
         throw new ArgumentNullException("image");
     }
     if (finansstyringRepository == null)
     {
         throw new ArgumentNullException("finansstyringRepository");
     }
     if (exceptionHandlerViewModel == null)
     {
         throw new ArgumentNullException("exceptionHandlerViewModel");
     }
     _regnskabViewModel           = regnskabViewModel;
     _kontoModel                  = kontoModel;
     _kontoModel.PropertyChanged += PropertyChangedOnKontoModelEventHandler;
     _kontogruppeViewModel        = kontogruppeViewModel;
     _displayName                 = displayName;
     _image                     = image;
     _erRegistreret             = false;
     _finansstyringRepository   = finansstyringRepository;
     _exceptionHandlerViewModel = exceptionHandlerViewModel;
 }
Esempio n. 10
0
 /// <summary>
 /// Danner egen klasse til test af basisfunktionalitet til en kommando, der skal udføres på en ViewModel.
 /// </summary>
 /// <param name="exceptionHandlerViewModel">Implementering af en ViewModel til en exceptionhandler.</param>
 public MyViewModelCommand(IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(exceptionHandlerViewModel)
 {
 }
 /// <summary>
 /// Danner egen klasse til test af ViewModel, der indeholder de grundlæggende oplysninger for en kontogruppe.
 /// </summary>
 /// <param name="kontogruppeModel">Modellen, der indeholder de grundlæggende oplysninger for en kontogruppe.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for en exceptionhandler.</param>
 public MyKontogruppeViewModel(IKontogruppeModelBase kontogruppeModel, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(kontogruppeModel, exceptionHandlerViewModel)
 {
 }
 /// <summary>
 /// Danner en ViewModel til en kontogruppe for budgetkonti.
 /// </summary>
 /// <param name="budgetkontogruppeModel">Modellen for kontogruppen til budgetkonti.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for en exceptionhandler.</param>
 public BudgetkontogruppeViewModel(IBudgetkontogruppeModel budgetkontogruppeModel, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(budgetkontogruppeModel, exceptionHandlerViewModel)
 {
 }
Esempio n. 13
0
 /// <summary>
 /// Danner en kommando, der kan hente og opdatere en kontoen.
 /// </summary>
 /// <param name="dependencyCommand">Implementering af kommando, som denne kommando er afhængig af.</param>
 /// <param name="finansstyringRepository">Implementering af repository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel til en exceptionhandler.</param>
 public KontoGetCommand(ITaskableCommand dependencyCommand, IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(exceptionHandlerViewModel)
 {
     if (dependencyCommand == null)
     {
         throw new ArgumentNullException("dependencyCommand");
     }
     if (finansstyringRepository == null)
     {
         throw new ArgumentNullException("finansstyringRepository");
     }
     _dependencyCommand       = dependencyCommand;
     _finansstyringRepository = finansstyringRepository;
 }
 /// <summary>
 /// Danner egen klasse til test af ViewModel, der indeholder grundlæggende tabeloplysninger, såsom typer, grupper m.m.
 /// </summary>
 /// <param name="tabelModel">Modellen, der indeholder grundlæggende tabeloplysninger, såsom typer, grupper m.m.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for en exceptionhandler.</param>
 public MyTabelViewModel(ITabelModelBase tabelModel, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(tabelModel, exceptionHandlerViewModel)
 {
 }
 /// <summary>
 /// Danner en kommando, der kan hente kontogrupper for budgetkonti til et regnskab.
 /// </summary>
 /// <param name="finansstyringRepository">Implementering af repository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel til en exceptionhandler.</param>
 public BudgetkontogrupperGetCommand(IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(exceptionHandlerViewModel)
 {
     if (finansstyringRepository == null)
     {
         throw new ArgumentNullException("finansstyringRepository");
     }
     _finansstyringRepository = finansstyringRepository;
 }
Esempio n. 16
0
 /// <summary>
 /// Danner en ViewModel til en budgetkonto.
 /// </summary>
 /// <param name="regnskabViewModel">ViewModel for regnskabet, som budgetkontoen er tilknyttet.</param>
 /// <param name="budgetkontoModel">Model for budgetkontoen.</param>
 /// <param name="budgetkontogruppeViewModel">ViewModel for kontogruppen til budgetkontoen.</param>
 /// <param name="finansstyringRepository">Implementering af repositoryet til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for exceptionhandleren.</param>
 public BudgetkontoViewModel(IRegnskabViewModel regnskabViewModel, IBudgetkontoModel budgetkontoModel, IBudgetkontogruppeViewModel budgetkontogruppeViewModel, IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(regnskabViewModel, budgetkontoModel, budgetkontogruppeViewModel, Resource.GetText(Text.BudgetAccount), Resource.GetEmbeddedResource("Images.Budgetkonto.png"), finansstyringRepository, exceptionHandlerViewModel)
 {
 }
Esempio n. 17
0
 /// <summary>
 /// Danner kommando til genindlæsning af regnskabslisten.
 /// </summary>
 /// <param name="finansstyringRepository">Implementering af repository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af en ViewModel til en exceptionhandler.</param>
 public RegnskabslisteRefreshCommand(IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : this(finansstyringRepository, exceptionHandlerViewModel, null)
 {
 }
Esempio n. 18
0
 /// <summary>
 /// Danner kommando til genindlæsning af regnskabslisten.
 /// </summary>
 /// <param name="finansstyringRepository">Implementering af repository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af en ViewModel til en exceptionhandler.</param>
 /// <param name="onFinish">Callbackmetode, der udføres, når kommandoen er udført fejlfrit.</param>
 public RegnskabslisteRefreshCommand(IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel, Action <IRegnskabslisteViewModel> onFinish)
     : base(exceptionHandlerViewModel)
 {
     if (finansstyringRepository == null)
     {
         throw new ArgumentNullException("finansstyringRepository");
     }
     _finansstyringRepository = finansstyringRepository;
     _onFinish = onFinish;
 }
Esempio n. 19
0
 /// <summary>
 /// Danner en ViewModel til en linje i opgørelsen.
 /// </summary>
 /// <param name="regnskabViewModel">ViewModel for regnskabet, som opgørelseslinjen er tilknyttet.</param>
 /// <param name="budgetkontogruppeModel">Model for gruppen af budgetkonti, som opgørelseslinjen baserer sig på.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for exceptionhandleren.</param>
 public OpgørelseViewModel(IRegnskabViewModel regnskabViewModel, IBudgetkontogruppeModel budgetkontogruppeModel, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(budgetkontogruppeModel, exceptionHandlerViewModel)
 {
     if (regnskabViewModel == null)
     {
         throw new ArgumentNullException("regnskabViewModel");
     }
     _regnskabViewModel = regnskabViewModel;
     _regnskabViewModel.PropertyChanged += PropertyChangedOnRegnskabViewModelEventHandler;
 }
 /// <summary>
 /// Danner en ViewModel, der indeholder de grundlæggende oplysninger for en kontogruppe.
 /// </summary>
 /// <param name="kontogruppeModel">Modellen, der indeholder de grundlæggende oplysninger for en kontogruppe.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel for en exceptionhandler.</param>
 protected KontogruppeViewModelBase(TKontogruppeModel kontogruppeModel, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : base(kontogruppeModel, exceptionHandlerViewModel)
 {
 }
 /// <summary>
 /// Danner en kommando, der på et regnskab kan initerer en ny ViewModel til bogføring.
 /// </summary>
 /// <param name="finansstyringRepository">Implementering af repository til finansstyring.</param>
 /// <param name="exceptionHandlerViewModel">Implementering af ViewModel til exceptionhandleren.</param>
 public BogføringSetCommand(IFinansstyringRepository finansstyringRepository, IExceptionHandlerViewModel exceptionHandlerViewModel)
     : this(finansstyringRepository, exceptionHandlerViewModel, false)
 {
 }