Exemple #1
0
        public EditSprint(ScrumrContext context, Sprint sprint = null, PropertyBag properties = null)
            : base(context, sprint)
        {
            var projectId = properties.GetValue <Guid>("projectId") ?? sprint.ProjectId;

            LoadProjectsList(projectId);
        }
Exemple #2
0
        public static PropertyView Create(PropertyItem propertyItem, ScrumrContext context)
        {
            if (propertyItem.IsRenderingIgnored)
            {
                return(null);
            }

            if (propertyItem.IsEntityType)
            {
                return(new DataListPropertyView(propertyItem, context));
            }

            if (propertyItem.IsEnumType)
            {
                return(new EnumPropertyView(propertyItem));
            }

            if (propertyItem.IsType <bool>())
            {
                return(new CheckPropertyView(propertyItem));
            }

            if (propertyItem.IsType <string>())
            {
                return(new TextPropertyView(propertyItem, propertyItem.IsLargeText));
            }

            if (propertyItem.IsNumericType)
            {
                return(new NumericPropertyView(propertyItem));
            }

            throw new NotSupportedException("Unknown property view");
        }
Exemple #3
0
        public static async Task RemoveEntity <T>(T entity, ScrumrContext context) where T : Entity
        {
            if (await(App.Current.MainWindow as MainWindow).ShowMessageAsync("Scrumr", "Are you sure you wish to delete this " + entity.GetType().Name + "?", MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Negative)
            {
                return;
            }

            if (typeof(T) == typeof(Sprint))
            {
                context.Sprints.Remove(entity as Sprint);
            }
            else if (typeof(T) == typeof(Feature))
            {
                context.Features.Remove(entity as Feature);
            }
            else if (typeof(T) == typeof(Ticket))
            {
                context.Tickets.Remove(entity as Ticket);
            }
            else
            {
                throw new NotSupportedException("Unexpected entity being removed. Operation failed.");
            }

            await context.SaveChangesAsync();
        }
Exemple #4
0
        public EditFeature(ScrumrContext context, Feature entity = null, PropertyBag properties = null)
            : base(context, entity)
        {
            var sprintId = properties.GetValue <Guid>("sprintId") ?? entity.SprintId;

            LoadSprintsList(sprintId);
        }
Exemple #5
0
        internal async static Task <ScrumrContext> CreateTestDatabase(DisposableTestWorkspace _testFiles)
        {
            var testFile = _testFiles.Create();

            await FileSystem.CreateNew(testFile, 0, false);

            return(await ScrumrContext.Load(testFile, 0));
        }
Exemple #6
0
        public static T AddEntity <T>(ScrumrContext context, Guid?projectId = null) where T : Entity
        {
            var properties = new PropertyBag();

            properties.Add("projectId", projectId);

            var editor = EditEntityBase <T> .Create(context, null, properties);

            return((T)editor.GetResult());
        }
Exemple #7
0
        public static Feature AddFeature(ScrumrContext context, Guid?sprintId = null)
        {
            var properties = new PropertyBag();

            properties.Add("sprintId", sprintId);

            var editor = EditEntityBase <Feature> .Create(context, null, properties);

            return(editor.GetResult());
        }
Exemple #8
0
        public static void EditEntity <T>(T entity, ScrumrContext context, Guid?projectId = null) where T : Entity
        {
            var properties = new PropertyBag();

            properties.Add("projectId", projectId);

            var editor = EditEntityBase <T> .Create(context, entity, properties);

            editor.Show();
        }
Exemple #9
0
        public static void EditTicket(Ticket ticket, ScrumrContext context)
        {
            var properties = new PropertyBag();

            properties.Add("projectId", ticket.ProjectId);
            properties.Add("featureId", ticket.FeatureId);

            var editor = EditEntityBase <Ticket> .Create(context, ticket, properties);

            editor.Show();
        }
Exemple #10
0
        public static Ticket AddTicket(ScrumrContext context, Guid?projectId = null, Guid?sprintId = null, Guid?featureId = null)
        {
            var properties = new PropertyBag();

            properties.Add("projectId", projectId);
            properties.Add("sprintId", sprintId);
            properties.Add("featureId", featureId);

            var editor = EditEntityBase <Ticket> .Create(context, null, properties);

            return((Ticket)editor.GetResult());
        }
Exemple #11
0
        public EditTicket(ScrumrContext context, Ticket entity = null, PropertyBag properties = null)
            : base(context, entity)
        {
            _featureId = properties.GetValue <Guid>("featureId");

            _projectId = properties.GetValue <Guid>("projectId")
                         ?? (entity as Ticket)
                         .IfNotNull(x => x.Sprint)
                         .IfNotNull(x => (Guid?)x.ProjectId);

            LoadViews();
            LoadSources();
            SetSelections();
        }
Exemple #12
0
        public EditEntityBase(ScrumrContext context, TEntity entity = null)
        {
            _view = new EditView(typeof(TEntity), context, (Entity)entity);

            _view.PostUpdated += async(e) => await PostUpdated(e);

            _view.PostCreated += async(e) => await PostCreated(e);

            _view.PreDeleting += async(r) => await PreDeleting(r);

            _view.PreRendering += (r) => PreRendering(r);

            _view.Render();
        }
Exemple #13
0
        private async Task SetupContext()
        {
            _context = await ContextTestHelper.CreateTestDatabase(_workspace);

            var project = new Project("Project X", _context);
            await _context.AddNewProject(project);

            var feature = new Feature("Feature 1", project.Backlog);

            _context.Features.Insert(feature);

            _ticket = ContextTestHelper.CreateTestTicket("Ticket A", feature);
            await _context.AddNewTicket(_ticket);
        }
        public DataListPropertyView(PropertyItem propertyItem, ScrumrContext context)
            : base(propertyItem)
        {
            var defaultSource = Enumerable.Empty <Entity>();

            var selected = propertyItem.IsNew
                ? null
                : defaultSource.Get((propertyItem.Value as Entity).ID);

            View = new ComboBox
            {
                DisplayMemberPath = "Name",
                SelectedItem      = selected,
            };

            Source = defaultSource;
        }
Exemple #15
0
        public void Load(ScrumrContext context)
        {
            Context = context;

            AddTicket.Click  += (s, e) => RequestNewTicket();
            AddSprint.Click  += (s, e) => RequestNewSprint();
            AddFeature.Click += (s, e) => RequestNewFeature();
            AddProject.Click += (s, e) => RequestNewProject();

            EditProject.Click += (s, e) => RequestEditProject();

            LoadDatabase.Click += (s, e) => RequestChooseFile();
            NewDatabase.Click  += (s, e) => RequestCreateFile();

            ShowHideClosedTickets.Click += (s, e) => RequestShowHideClosedTickets();
            ShowHideEmptyFeatures.Click += (s, e) => RequestShowHideEmptyFeatures();
        }
Exemple #16
0
        public ProjectPanel(ScrumrContext context)
            : this()
        {
            Context = context;

            foreach (var project in context.Projects)
            {
                var projectTile = new ProjectTile(project);

                projectTile.RequestEdit   += p => EditProject(p);
                projectTile.RequestRemove += async p => await RemoveEntity(p);

                projectTile.RequestOpenProject += p => RequestOpenProject(p);

                LayoutRoot.Children.Add(projectTile);
            }
        }
Exemple #17
0
        public EditView(Type type, ScrumrContext context, Entity entity = null)
            : this()
        {
            if (entity == null)
            {
                Mode = Modes.Creating;
                DeleteButton.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                Mode = Modes.Updating;
                DeleteButton.Visibility = System.Windows.Visibility.Visible;
            }

            EntityType = type;
            Context    = context;
            Entity     = entity;
        }
Exemple #18
0
 public static EditEntityBase <TEntity> Create(ScrumrContext context, Entity entity = null, PropertyBag properties = null)
 {
     if (typeof(TEntity) == typeof(Feature))
     {
         return(new EditFeature(context, (Feature)entity, properties) as EditEntityBase <TEntity>);
     }
     else if (typeof(TEntity) == typeof(Sprint))
     {
         return(new EditSprint(context, (Sprint)entity, properties) as EditEntityBase <TEntity>);
     }
     else if (typeof(TEntity) == typeof(Project))
     {
         return(new EditProject(context, (Project)entity, properties) as EditEntityBase <TEntity>);
     }
     else if (typeof(TEntity) == typeof(Ticket))
     {
         return(new EditTicket(context, (Ticket)entity, properties) as EditEntityBase <TEntity>);
     }
     else
     {
         throw new NotSupportedException("EditEntityBase<TEntity>.Create does not support this type");
     }
 }
Exemple #19
0
        public FeatureTicketsPanel(ScrumrContext context, Feature feature, Sprint sprint, bool showClosedTickets)
            : this()
        {
            Context = context;
            Feature = feature;
            Sprint  = sprint;

            var orderedTickets = Feature.Tickets
                                 .OrderByDescending(x => x.State)
                                 .ThenBy(x => x.Created);

            IsEmpty = !orderedTickets.Any();

            foreach (var ticket in orderedTickets)
            {
                if (!showClosedTickets && ticket.State == TicketState.Closed)
                {
                    continue;
                }

                var ticketView = new TicketTile(ticket);

                ticketView.RequestClose  += (t) => CloseTicket(t as Ticket);
                ticketView.RequestReopen += (t) => OpenTicket(t as Ticket);
                ticketView.RequestEdit   += (t) => EditTicket(t as Ticket);
                ticketView.RequestRemove += async(t) => await RemoveEntity(t as Ticket);

                ticketView.RequestMakeSubfeature += async(t) => await MakeSubfeature(t as Ticket);

                LayoutRoot.Children.Add(ticketView);
            }

            var addTile = new AddTicketTile(Feature);

            addTile.Added += AddedTicket;
            LayoutRoot.Children.Add(addTile);
        }
Exemple #20
0
 public EditProject(ScrumrContext context, Project entity = null, PropertyBag properties = null)
     : base(context, entity)
 {
 }
Exemple #21
0
 public TestEntity(ScrumrContext context)
     : base(context)
 {
 }
Exemple #22
0
 public TestForeignEntity(ScrumrContext context)
     : base(context)
 {
 }