public IssueFilesViewModel(Issue issue) { CompositionInitializer.SatisfyImports(this); mIssue = issue; var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetAttachmentTypesCompleted += (s, e) => { mAttachmentTypes = e.Result; cmsWebServiceClient.GetIssueFilesCompleted += (s1, e1) => { mIssue.IssueFiles.Clear(); foreach (IssueFile attachment in e1.Result) { attachment.Issue = mIssue;//this brings i the distribution list we need to set padlock. attachment.AttachmentTypes = mAttachmentTypes; mIssue.IssueFiles.Add(attachment); } if (DataLoaded != null) { DataLoaded(); } RaisePropertyChanged("Attachments"); }; cmsWebServiceClient.GetIssueFilesAsync(mIssue.Id); }; cmsWebServiceClient.GetAttachmentTypesAsync(); AddButton = new DelegateCommand<object>(AddButtonHandler, CanAddHandler); DeleteButton = new DelegateCommand<object>(DeleteButtonHandler, CanDeleteHandler); ExportButton = new DelegateCommand<object>(ExportButtonHandler, x => true); }
public PipeAttachmentsViewModel(Pipe pipe) { CompositionInitializer.SatisfyImports(this); mPipe = pipe; CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetAttachmentTypesCompleted += cmsWebServiceClient_GetAttachmentTypesCompleted; cmsWebServiceClient.GetAttachmentTypesAsync(); AddButtonClick = new DelegateCommand<object>(AddButtonHandler, CanAddHandler); DeleteButtonClick = new DelegateCommand<object>(DeleteButtonHandler, CanDeleteHandler); ExportButton = new DelegateCommand<object>(ExportButtonHandler, x => true); }
public InstrumentAttachmentsViewModel(Instrument instrumentEquipment) { AddAttachmentCommand = new DelegateCommand<object>(AddFileHandler, CanAdd); RemoveAttachmentCommand = new DelegateCommand<object>(DeleteButtonHandler, CanDelete); ExportButton = new DelegateCommand<object>(ExportButtonHandler, x => true); CompositionInitializer.SatisfyImports(this); mInstrument = instrumentEquipment; Attachments = new ObservableCollection<InstrumentAttachment>(); CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetAttachmentTypesCompleted += cmsWebServiceClient_GetAttachmentTypesCompleted; cmsWebServiceClient.GetAttachmentTypesAsync(); }
public ElectricalEquipmentAttachmentsViewModel(ElectricalEquipment electricalEquipment, ElectricalAttachmentsControl view) { CompositionInitializer.SatisfyImports(this); View = view; AddAttachmentCommand = new DelegateCommand<object>(AddFileHandler, CanAdd); RemoveAttachmentCommand = new DelegateCommand<object>(DeleteButtonHandler, CanDelete); ExportButton = new DelegateCommand<object>(ExportButtonHandler, x => true); mElectricalEquipment = electricalEquipment; Attachments = new ObservableCollection<ElectricalEquipmentAttachment>(); CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetAttachmentTypesCompleted += cmsWebServiceClient_GetAttachmentTypesCompleted; cmsWebServiceClient.GetAttachmentTypesAsync(); }
public ExportAttachmentsModel(CommonUtils.AttachmentObject attachmentObject) { CompositionInitializer.SatisfyImports(this); mAttachmentObject = attachmentObject; var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetEquipmentAttachmentsCompleted += (s, e) => { Attachments = new CmsObservableCollection<BaseEquipmentAttachment>(e.Result); var uploaderIds = (from x in Attachments select x.UploadedById).Distinct().ToList(); var act = (from x in CMS.Cache.Users orderby x.LastName where x.ActiveUser select x).ToList(); var inact = (from x in CMS.Cache.Users orderby x.LastName where !x.ActiveUser select x).ToList(); Uploaders = new List<QuickUser>(act); Uploaders.AddRange(inact); var presentUploaders = (from x in Uploaders where uploaderIds.Contains(x.Id) select x).ToList(); presentUploaders.Insert(0, new QuickUser { FirstName = ALL, Id = -1, ActiveUser = true }); Uploaders = new List<QuickUser>(presentUploaders); SelectedUploader = Uploaders[0]; mAttachmentsLoaded = true; OnRaiseLoaded(); }; cmsWebServiceClient.GetEquipmentAttachmentsAsync(attachmentObject); cmsWebServiceClient.GetAttachmentTypesCompleted += (s, e) => { AttachmentTypes = new List<AttachmentType>(e.Result); AttachmentTypes.Insert(0, new AttachmentType { Name = ALL, Id = -1 }); SelectedAttachmentType = AttachmentTypes[0]; mAttachmenttypesLoaded = true; OnRaiseLoaded(); }; cmsWebServiceClient.GetAttachmentTypesAsync(); OkCommand = new DelegateCommand<object>(OkHandler, CanExecuteOkButton); CancelCommand = new DelegateCommand<object>(CancelHandler); }