Esempio n. 1
0
        /// <summary>
        /// Adds a new bug to the system and reflects the addition
        /// in the table of bugs.
        /// </summary>
        /// <param name="bug">The bug view model to add to system.</param>
        private void AddBug(BugViewModel bug)
        {
            // Performs validation before bug is saved
            if (BugIsValidated())
            {
                try
                {
                    bug.CreatedBy = new UserViewModel(_Service.GetMyUser());
                    bug.Project   = _ActiveProject.ToProjectModel();

                    // Convert bug view model to bug model service can accept
                    Bug savedBug = _Service.AddBug(bug.ToBugModel());

                    _Notifier.AddNotification(new Notification {
                        ImageUrl = Notification.ICON_ADD,
                        Title    = "Added Bug",
                        Message  = "The bug " + bug.Name + " has been added to the project"
                    });

                    // Notify listeners that bug has been saved
                    _Messenger.NotifyColleagues(Messages.AddPanelSavedBug, new BugViewModel(savedBug));

                    InitialiseBugViewModel();

                    // Close the add panel
                    IsVisible = false;
                }
                catch (FaultException e)
                {
                    MessageBox.Show(e.Message);
                }
            }
        }
        /// <summary>
        /// Adds a new bug to the system and reflects the addition
        /// in the table of bugs.
        /// </summary>
        /// <param name="bug">The bug view model to add to system.</param>
        private void AddBug(BugViewModel bug)
        {
            // Performs validation before bug is saved
            if (BugIsValidated())
            {
                try
                {
                    bug.CreatedBy = new UserViewModel(_Service.GetMyUser());
                    bug.Project   = _ActiveProject.ToProjectModel();

                    // Convert bug view model to bug model service can accept
                    Bug savedBug = _Service.AddBug(bug.ToBugModel());

                    _Notifier.AddNotification(new Notification {
                        ImageUrl = Notification.ICON_ADD,
                        Title = "Added Bug",
                        Message = "The bug " + bug.Name + " has been added to the project" });

                    // Notify listeners that bug has been saved
                    _Messenger.NotifyColleagues(Messages.AddPanelSavedBug, new BugViewModel(savedBug));

                    InitialiseBugViewModel();

                    // Close the add panel
                    IsVisible = false;
                }
                catch (FaultException e)
                {
                    MessageBox.Show(e.Message);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Saves a bug which has been editied.
        /// </summary>
        /// <param name="bug">The object which has been edited.</param>
        private void SaveBug(BugViewModel bug)
        {
            if (BugIsValidated())
            {
                try
                {
                    Bug savedBug = _Service.SaveBug(bug.ToBugModel());

                    _Messenger.NotifyColleagues(Messages.SelectedBugSaved, new BugViewModel(savedBug));

                    EditedBug = new BugViewModel(savedBug);

                    _Notifier.AddNotification(new Notification {
                        ImageUrl = Notification.ICON_EDIT,
                        Title    = "Bug Saved",
                        Message  = "The bug " + savedBug.Name + " has been saved."
                    });

                    IsVisible = false;
                }
                catch (FaultException e)
                {
                    MessageBox.Show(e.Message);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a new bug view model and presets the default
        /// priority and status values which reflect on the user
        /// interface.
        /// </summary>
        private void InitialiseBugViewModel()
        {
            EditedBug = new BugViewModel();

            EditedBug.Priority = PriorityList[1];
            EditedBug.Status   = StatusList[1];
        }
Esempio n. 5
0
        /// <summary>
        /// Removes a bug object from the table and closes the
        /// south view panel if it is open.
        /// </summary>
        /// <param name="bug">The bug to remove from the table.</param>
        private void RemoveBugFromTable(BugViewModel bug)
        {
            if (SouthViewPanel != null && SouthViewPanel.IsVisible)
            {
                SouthViewPanel.IsVisible = false;
            }

            UpdateTableData();
        }
Esempio n. 6
0
        public BugPanelViewModel CreateBugViewPanel(ProjectViewModel project, BugViewModel bug)
        {
            ParameterOverrides parameters = new ParameterOverrides()
            {
                { "activeProj",  project },
                { "selectedBug", bug     }
            };

            return _Container.Resolve<BugPanelViewModel>("ViewPanel",  parameters);
        }
        /// <summary>
        /// Initialises the bug view panel and de-references the selected bug to
        /// ensure updates to the edited bug do not reflect in the bug table.
        /// Also initialises a message listener to monitor changes in selected bug.
        /// </summary>
        /// <param name="comm">The mediator object for communication between view models.</param>
        /// <param name="svc">The bug tracker web service.</param>
        /// <param name="activeProj">The currently active project.</param>
        /// <param name="selectedBug">The currently selected bug</param>
        public BugViewPanelViewModel(IMessenger comm, ITrackerService svc, ProjectViewModel activeProj, BugViewModel selectedBug, IGrowlNotifiactions notifier)
            : base(comm, svc, activeProj)
        {
            if (selectedBug == null)
                throw new ArgumentNullException("The selected bug cannot be null.");

            _Notifier = notifier;

            UpdateBugView(selectedBug);

            ListenForMessages();
        }
Esempio n. 8
0
        private void UpdateBugView(BugViewModel bug)
        {
            if (bug != null)
            {
                EditedBug = bug.Clone();

                if (EditedBug.AssignedUser != null)
                {
                    AssignedUser = UsersInActiveProject.Where(p => p.Id == EditedBug.AssignedUser.Id).SingleOrDefault();
                }
                else
                {
                    AssignedUser = UsersInActiveProject.Where(p => p.Id == 0).SingleOrDefault();
                }
            }
        }
        /// <summary>
        /// Creates a new bug view model and presets the default
        /// priority and status values which reflect on the user
        /// interface.
        /// </summary>
        private void InitialiseBugViewModel()
        {
            EditedBug = new BugViewModel();

            EditedBug.Priority = PriorityList[1];
            EditedBug.Status = StatusList[1];
        }
Esempio n. 10
0
        /// <summary>
        /// Initialises the bug view panel and de-references the selected bug to
        /// ensure updates to the edited bug do not reflect in the bug table.
        /// Also initialises a message listener to monitor changes in selected bug.
        /// </summary>
        /// <param name="comm">The mediator object for communication between view models.</param>
        /// <param name="svc">The bug tracker web service.</param>
        /// <param name="activeProj">The currently active project.</param>
        /// <param name="selectedBug">The currently selected bug</param>
        public BugViewPanelViewModel(IMessenger comm, ITrackerService svc, ProjectViewModel activeProj, BugViewModel selectedBug, IGrowlNotifiactions notifier)
            : base(comm, svc, activeProj)
        {
            if (selectedBug == null)
            {
                throw new ArgumentNullException("The selected bug cannot be null.");
            }

            _Notifier = notifier;

            UpdateBugView(selectedBug);

            ListenForMessages();
        }
        /// <summary>
        /// Saves a bug which has been editied.
        /// </summary>
        /// <param name="bug">The object which has been edited.</param>
        private void SaveBug(BugViewModel bug)
        {
            if (BugIsValidated())
            {
                try
                {
                    Bug savedBug = _Service.SaveBug(bug.ToBugModel());

                    _Messenger.NotifyColleagues(Messages.SelectedBugSaved, new BugViewModel(savedBug));

                    EditedBug = new BugViewModel(savedBug);

                    _Notifier.AddNotification(new Notification {
                        ImageUrl = Notification.ICON_EDIT,
                        Title = "Bug Saved",
                        Message = "The bug " + savedBug.Name + " has been saved." });

                    IsVisible = false;
                }
                catch (FaultException e)
                {
                    MessageBox.Show(e.Message);
                }
            }
        }
        private void UpdateBugView(BugViewModel bug)
        {
            if (bug != null)
            {
                EditedBug = bug.Clone();

                if (EditedBug.AssignedUser != null)
                    AssignedUser = UsersInActiveProject.Where(p => p.Id == EditedBug.AssignedUser.Id).SingleOrDefault();
                else
                    AssignedUser = UsersInActiveProject.Where(p => p.Id == 0).SingleOrDefault();
            }
        }
 /// <summary>
 /// Subscribes to incoming messages concerned with data in this object.
 /// </summary>
 private void ListenForMessages()
 {
     _Messenger.Register <BugViewModel>(Messages.SelectedBugChanged, p => _SelectedBug         = p);
     _Messenger.Register <ProjectViewModel>(Messages.ActiveProjectChanged, p => _ActiveProject = p);
     _Messenger.Register <bool>(Messages.BugTableDisplaying, p => _IsBugTableDisplaying        = p);
 }
 /// <summary>
 /// Subscribes to incoming messages concerned with data in this object.
 /// </summary>
 private void ListenForMessages()
 {
     _Messenger.Register<BugViewModel>(Messages.SelectedBugChanged, p => _SelectedBug = p);
     _Messenger.Register<ProjectViewModel>(Messages.ActiveProjectChanged, p => _ActiveProject = p);
     _Messenger.Register<bool>(Messages.BugTableDisplaying, p => _IsBugTableDisplaying = p);
 }