public ReleaseNoteNewEditXtraForm(Guid id) { this.id = id; InitializeComponent(); viewModel = (ReleaseNoteViewModel)Program.Kernel.Get <ReleaseNoteViewModel>(new ConstructorArgument("id", id)); viewModel.ModifiableView = this; viewModel.validatableView = this; viewModel.PropertyChanged += (s, e) => IsModified = true; releaseNoteDate.Properties.NullDate = DateTime.MinValue; releaseNoteDate.Properties.NullText = string.Empty; this.releaseNoteDate.SetRequiredText(); this.releaseNoteNumber.SetRequiredText(); SetControlsTextLength(); this.certificateNumber.SetAsIdentifier(); this.pipeNumberLookUp.SetAsIdentifier(); this.releaseNoteNumber.SetAsIdentifier(); this.railcarNumber.SetAsIdentifier(); SetAlwaysReadOnly(textEditReleaseNoteStatus); IsEditMode = true; //do not remove until IsEditMode logic is changed IsEditMode = ctx.HasAccess(global::Domain.Entity.Security.Privileges.EditReleaseNote); attachmentsButton.Enabled = true; CannotOpenForViewing = id == Guid.Empty; }
public ShipReleaseNoteCommand(ReleaseNoteViewModel viewModel, IReleaseNoteRepositories repo, IUserNotify notify, ISecurityContext ctx) { this.viewModel = viewModel; this.repos = repo; this.notify = notify; this.ctx = ctx; }
private void RailcarNewEditXtraForm_FormClosed(object sender, FormClosedEventArgs e) { commandManager.Dispose(); viewModel.Dispose(); viewModel = null; }