public ucExperienceDetailView(string mode, int experienceid = 0, Experience exp = null)
 {
     this.DataContext = this;
     InitializeComponent();
     FormMode = mode;
     _experienceID = experienceid;
     UserExperience = exp;
 }
        private async void ExperienceDetailView_Loaded(object sender, RoutedEventArgs e)
        {

            if (UserExperience != null && FormMode == FormModes.New)
                return;
            if (FormMode == FormModes.Edit)
            {
                await Task.Run(() =>
                {
                    UserExperience = ExperienceRepo.FindByID(_experienceID);
                });
            }
        }
 private void OpenExperienceDetailWindow(string mode, string title)
 {
     var win = (Experience)gvStaffExpListView.SelectedItem;
     if (win == null && mode != FormModes.New)
     {
         Message(MessageTypes.Error, "Please Select to edit");
         return;
     }
     ucExperienceDetailView view;
     if (win != null && win.ExperienceID == 0)
     {
         view = new ucExperienceDetailView(FormModes.New, win.ExperienceID, win);
     }
     else
     {
         if (win == null)
         {
             win = new Experience();
         }
         view = new ucExperienceDetailView(FormModes.New, win.ExperienceID);
     }
     view.ParentContainer = this;
     OpenPopUp(view, title, 500, 260);
 }
        internal void UpdateExperienceList(Experience exp)
        {
            List<Experience> expList = new List<Experience>();
            foreach (Experience e in ExperienceList)
            {
                if (e.ExperienceID == exp.ExperienceID)
                {
                    expList.Add(exp);
                }
                else
                {
                    expList.Add(e);
                }
            }
            ExperienceList = expList as IEnumerable<Experience>;

        }
 internal void AddToExperienceList(Experience exp)
 {
     ExperienceList = ExperienceList.Add(exp);
 }