Inheritance: MonoKit.Domain.Data.SQLite.SqlDomainContext
Exemple #1
0
        public FireController(MinionContext context)
            : base()
        {
            this.context = context;
            this.Title = "fire minions";

            this.AddController(new AllMinionsViewController(this.context, "all minions", true), 0);
            this.PreviewSize = 0;
        }
Exemple #2
0
        public HomeController()
            : base()
        {
            this.context = this.InitializeContext();

            this.Title = "my minions";
            this.AddController(new AllMinionsViewController(this.context, "all minions", false), 0);
            this.PreviewSize = 0;
        }
        public AllMinionsViewController(MinionContext context, string title, bool allowDelete)
            : base(allowDelete ? UITableViewStyle.Grouped : UITableViewStyle.Plain, new SettingsSource())
        {
            this.context = context;
            this.lifetime = new CompositeDisposable();

            this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done);
            this.NavigationItem.RightBarButtonItem.Clicked += DoneClicked;

            this.allowDelete = allowDelete;
            this.Title = title;
            var s = new TableViewSection(this.Source);
        }
        public MinionEditController(MinionContext context, MinionContract minion)
            : base(UITableViewStyle.Grouped)
        {
            this.lifetime = new CompositeDisposable();

            this.NavigationItem.Title = minion != null ? "Edit Details" : "Hire Minion";
            this.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel);
            this.NavigationItem.LeftBarButtonItem.Clicked += CancelClicked;
            this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done);
            this.NavigationItem.RightBarButtonItem.Clicked += DoneClicked;

            this.context = context;
            //this.commandExecutor = commandExecutor;
            this.Load(minion);
        }
Exemple #5
0
        public MinionController(MinionContext context, MinionContract minion)
            : base()
        {
            this.context = context;
            this.minion = minion;
            this.lifetime = new CompositeDisposable();

            this.Load(minion);

            this.AddController(new TodayDeedsViewController(), 0);

            // todo: have an event to show navigated to in order to hook this up later to improve animation speed
            this.AddController(new MinionCashController(), 0);
            this.AddController(new MinionDeedsController(), 0);
        }
Exemple #6
0
        private MinionContext InitializeContext()
        {
            // lazy static constructor for the DB will not get executed until this point, out of the FinishedLoading
            // allowing the application to respond as quick as it can.
            var minionContext = new MinionContext(DB.Main, new ObservableDomainEventBus());

            var minionRepo = new SqlRepository<MinionContract>(DB.Main);
            var allMinions = minionRepo.GetAll();

            if (!allMinions.Any())
            {
                // bootstrap us some
                var cmd = minionContext.NewCommandExecutor<MinionAggregate>();
                cmd.Execute(new ChangeNameCommand {AggregateId = MinionId.NewId(), Name = "Minion 1" });
                cmd.Execute(new ChangeNameCommand {AggregateId = MinionId.NewId(), Name = "Minion 2" });
                cmd.Execute(new ChangeNameCommand {AggregateId = MinionId.NewId(), Name = "Minion 3" });
            }

            return minionContext;
        }
        public ScheduledDeedsController(MinionContext context, IUniqueIdentity minionId)
            : base(UITableViewStyle.Grouped)
        {
            this.lifetime = new CompositeDisposable();

            this.NavigationItem.Title = "Scheduled Deeds";
            this.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Add);
            this.NavigationItem.RightBarButtonItem.Clicked += AddClicked;

            this.context = context;
            this.minionId = minionId;
        }