public EditSprint(ScrumrContext context, Sprint sprint = null, PropertyBag properties = null) : base(context, sprint) { var projectId = properties.GetValue <Guid>("projectId") ?? sprint.ProjectId; LoadProjectsList(projectId); }
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"); }
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(); }
public EditFeature(ScrumrContext context, Feature entity = null, PropertyBag properties = null) : base(context, entity) { var sprintId = properties.GetValue <Guid>("sprintId") ?? entity.SprintId; LoadSprintsList(sprintId); }
internal async static Task <ScrumrContext> CreateTestDatabase(DisposableTestWorkspace _testFiles) { var testFile = _testFiles.Create(); await FileSystem.CreateNew(testFile, 0, false); return(await ScrumrContext.Load(testFile, 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()); }
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()); }
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(); }
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(); }
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()); }
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(); }
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(); }
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; }
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(); }
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); } }
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; }
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"); } }
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); }
public EditProject(ScrumrContext context, Project entity = null, PropertyBag properties = null) : base(context, entity) { }
public TestEntity(ScrumrContext context) : base(context) { }
public TestForeignEntity(ScrumrContext context) : base(context) { }