Esempio n. 1
0
        public DreamCategoriesPage()
        {
            InitializeComponent();

            this.datalayer      = DependencyContainer.GetSingleton <IDatalayer>();
            this.BindingContext = viewModel = new DreamCategoriesViewModel(this.datalayer);
        }
Esempio n. 2
0
        public LogEntriesPage()
        {
            this.InitializeComponent();

            this.datalayer      = DependencyContainer.GetSingleton <IDatalayer>();
            this.BindingContext = viewModel = new DreamLogEntriesViewModel(this.datalayer);

            this.filterOptions = new[]
            {
                new FilterOptionViewModel()
                {
                    Icon = MaterialDesignIcons.SortDescending, Title = "By Date from recent to old", TapCommand = this.viewModel.SortEntriesCommand, TapCommandParameter = new FilterOptionCommandParameter("Date", ListSortDirection.Descending)
                },
                new FilterOptionViewModel()
                {
                    Icon = MaterialDesignIcons.SortAscending, Title = "By Date from old to recent", TapCommand = this.viewModel.SortEntriesCommand, TapCommandParameter = new FilterOptionCommandParameter("Date", ListSortDirection.Ascending)
                },
                new FilterOptionViewModel()
                {
                    Icon = MaterialDesignIcons.SortAscending, Title = "By Title from A to Z", TapCommand = this.viewModel.SortEntriesCommand, TapCommandParameter = new FilterOptionCommandParameter("Title", ListSortDirection.Ascending)
                },
                new FilterOptionViewModel()
                {
                    Icon = MaterialDesignIcons.SortDescending, Title = "By Title from Z to A", TapCommand = this.viewModel.SortEntriesCommand, TapCommandParameter = new FilterOptionCommandParameter("Title", ListSortDirection.Descending)
                },
                new FilterOptionViewModel()
                {
                    Icon = MaterialDesignIcons.SortAscending, Title = "By Category-Id ascending", TapCommand = this.viewModel.SortEntriesCommand, TapCommandParameter = new FilterOptionCommandParameter("Category", ListSortDirection.Ascending)
                },
                new FilterOptionViewModel()
                {
                    Icon = MaterialDesignIcons.SortDescending, Title = "By Category-Id descending", TapCommand = this.viewModel.SortEntriesCommand, TapCommandParameter = new FilterOptionCommandParameter("Category", ListSortDirection.Descending)
                }
            };
        }
Esempio n. 3
0
 private void InitiallyPopulateDatalayer(IDatalayer datalayer)
 {
     if (datalayer.DreamLogCollections.Count() == 0)
     {
         datalayer.AddDreamLog(new DreamLogCollection()
         {
             Name = "My dream collection"
         });
     }
 }
Esempio n. 4
0
        public DreamCategoriesViewModel(IDatalayer datalayer)
        {
            this.datalayer = datalayer;

            this.Title = "Categories";
            this.Items = new ObservableCollection <DreamCategoryViewModel>();
            this.LoadCategoriesCommand = new Command(async() => await ExecuteLoadCategoriesCommand());

            MessagingCenter.Subscribe <CreateEditDreamCategoryPage, DreamCategoryEditorViewModel>(this, MessagingCenterMessages.AddCategory, this.OnDreamCategoryCreated);
            MessagingCenter.Subscribe <CreateEditDreamCategoryPage, DreamCategoryEditorViewModel>(this, MessagingCenterMessages.EditCategory, this.OnDreamCategoryEdited);
        }
Esempio n. 5
0
        public DreamLogEntriesViewModel(IDatalayer datalayer)
        {
            this.datalayer = datalayer;

            this.Title = "Browse dreams";
            this.Items = new ObservableCollection <DreamLogEntryViewModel>();
            this.LoadEntriesCommand = new Command(async() => await this.ExecuteLoadEntriesCommand());
            this.SortEntriesCommand = new Command(async _param => await this.ExecuteSortEntriesCommand(_param), _param => this.Items.Count > 0);

            MessagingCenter.Subscribe <CreateEditLogEntryPage, DreamLogEntryViewModel>(this, MessagingCenterMessages.AddLogEntry, this.OnLogEntryCreated);
            MessagingCenter.Subscribe <CreateEditLogEntryPage, DreamLogEntryViewModel>(this, MessagingCenterMessages.EditLogEntry, this.OnLogEntryEdited);
        }
Esempio n. 6
0
        private DreamLogEntryViewModel GetDreamLogEntryViewModel(IDatalayer datalayer, DreamLogEntry entry)
        {
            DreamLogEntryViewModel model = new DreamLogEntryViewModel();

            model.Update(entry);
            if (model.FK_CategoryId.HasValue)
            {
                model.Category = datalayer.GetDreamCategory(entry.FK_CategoryId.Value);
            }
            model.Log = datalayer.DreamLogCollections.First();
            return(model);
        }
Esempio n. 7
0
 /// <summary>
 /// Returns whether the sql-database could be read by EF-Core
 /// </summary>
 private bool DatalayerIsValid(IDatalayer datalayer)
 {
     try
     {
         datalayer.DreamLogCollections.Count();
         datalayer.DreamCategories.Count();
         datalayer.DreamLogEntries.Count();
         return(true);
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex);
         return(false);
     }
 }
Esempio n. 8
0
        public AboutPage()
        {
            InitializeComponent();

            IDatalayer datalayer = DependencyContainer.GetSingleton <IDatalayer>();

            this.BindingContext = new AboutViewModel()
            {
                Version       = $"v.{String.Join(".", Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.').Take(3))}",
                Author        = "Dosenhering",
                Description   = "This app allows you to log your dreams and assign them to different categories",
                CategoryCount = datalayer.DreamCategories.Count(),
                DreamCount    = datalayer.DreamLogEntries.Count()
            };
        }
Esempio n. 9
0
 public Logica()
 {
     this.datalaag = new Datalayer.Datalayer();
 }
Esempio n. 10
0
 public SizeController(Func <ConnType, IDatalayer> dataLayerFactory)
 {
     _datalayer = dataLayerFactory(ConnType.Mssql);
 }
 public SizeController(Func <ConnType, IDatalayer> dataLayerFactory)
 {
     //What ever combination you choose
     _dataLayerFactory = dataLayerFactory;
     _datalayer        = dataLayerFactory(ConnType.Mssql);
 }