Exemple #1
0
    public ProjectEdit(ProjectTracker.Library.ProjectEdit project)
    {
      InitializeComponent();

      // store object reference
      _project = project;
    }
Exemple #2
0
        public ProjectEdit(ProjectTracker.Library.ProjectEdit project)
        {
            InitializeComponent();

            // store object reference
            _project = project;
        }
Exemple #3
0
        private void RebindUI(bool saveObject, bool rebind)
        {
            // disable events
            this.projectBindingSource.RaiseListChangedEvents   = false;
            this.resourcesBindingSource.RaiseListChangedEvents = false;
            try
            {
                // unbind the UI
                UnbindBindingSource(this.resourcesBindingSource, saveObject, false);
                UnbindBindingSource(this.projectBindingSource, saveObject, true);
                this.resourcesBindingSource.DataSource = this.projectBindingSource;

                // save or cancel changes
                if (saveObject)
                {
                    _project.ApplyEdit();
                    try
                    {
                        _project = _project.Save();
                    }
                    catch (Csla.DataPortalException ex)
                    {
                        MessageBox.Show(ex.BusinessException.ToString(),
                                        "Error saving", MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(),
                                        "Error Saving", MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    _project.CancelEdit();
                }
            }
            finally
            {
                // rebind UI if requested
                if (rebind)
                {
                    BindUI();
                }

                // restore events
                this.projectBindingSource.RaiseListChangedEvents   = true;
                this.resourcesBindingSource.RaiseListChangedEvents = true;

                if (rebind)
                {
                    // refresh the UI if rebinding
                    this.projectBindingSource.ResetBindings(false);
                    this.resourcesBindingSource.ResetBindings(false);
                }
            }
        }
 public ProjectResourceEdit(ProjectTracker.Library.ProjectEdit parent)
 {
     ManageObjectLifetime = true;
     EditMode             = false;
     ParentProject        = parent;
     ProjectTracker.Library.ResourceList.GetResourceList((o, e) =>
     {
         if (e.Error != null)
         {
             Bxf.Shell.Instance.ShowError("Error retrieving resource list", "Data Error");
         }
         else
         {
             Resources = e.Object;
         }
     });
 }
Exemple #5
0
    private void RebindUI(bool saveObject, bool rebind)
    {
      // disable events
      this.projectBindingSource.RaiseListChangedEvents = false;
      this.resourcesBindingSource.RaiseListChangedEvents = false;
      try
      {
        // unbind the UI
        UnbindBindingSource(this.resourcesBindingSource, saveObject, false);
        UnbindBindingSource(this.projectBindingSource, saveObject, true);
        this.resourcesBindingSource.DataSource = this.projectBindingSource;

        // save or cancel changes
        if (saveObject)
        {
          _project.ApplyEdit();
          try
          {
            _project = _project.Save();
          }
          catch (Csla.DataPortalException ex)
          {
            MessageBox.Show(ex.BusinessException.ToString(),
              "Error saving", MessageBoxButtons.OK,
              MessageBoxIcon.Exclamation);
          }
          catch (Exception ex)
          {
            MessageBox.Show(ex.ToString(),
              "Error Saving", MessageBoxButtons.OK,
              MessageBoxIcon.Exclamation);
          }
        }
        else
          _project.CancelEdit();
      }
      finally
      {
        // rebind UI if requested
        if (rebind)
          BindUI();

        // restore events
        this.projectBindingSource.RaiseListChangedEvents = true;
        this.resourcesBindingSource.RaiseListChangedEvents = true;

        if (rebind)
        {
          // refresh the UI if rebinding
          this.projectBindingSource.ResetBindings(false);
          this.resourcesBindingSource.ResetBindings(false);
        }
      }
    }
Exemple #6
0
 internal void UpdateInfo(ProjectTracker.Library.ProjectEdit projectEdit)
 {
     Model.SetName(projectEdit);
 }