public ControlSystemAlarmPropertiesViewModel(ControlSystemComponent controlSystemComponent, AlarmLists lists) { CompositionInitializer.SatisfyImports(this); mAlarmLists = lists; mControlSystemComponent = controlSystemComponent; AlarmPropertyValues = new CmsObservableCollection<ControlSystemAlarmPropertiesWrapViewModel>(); mLevel = GetControlSystemComponentAlarmLevel(); LoadData(); }
public ExportDocumentFilesModel() { if (DesignerProperties.IsInDesignTool){return;} DatabaseLoader.GetQuickDocuments(new DocumentsFilterObject()).ContinueWith((x) => { CMS.UiFactory.StartNew(() => { //TODO: This can be optimised as per document navigation panel, will not display Document Type :( mDocuments = new CmsObservableCollection<QuickDocument>(x.Result); CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetDocumentsAndRelatedObjectsCompleted += cmsWebServiceClient_GetDocumentsAndRelatedObjectsCompleted; cmsWebServiceClient.GetDocumentsAndRelatedObjectsAsync(); cmsWebServiceClient.GetDocumentDisciplinesCompleted += (s, e) => { var disciplines = e.Result; disciplines.Insert(0, new DocumentDiscipline {Id = -1, Name = "All"}); mDisciplines = disciplines; mSelectedDiscipline = disciplines[0]; mDisciplinesLoaded = true; RaiseLoaded(); }; cmsWebServiceClient.GetDocumentDisciplinesAsync(); cmsWebServiceClient.GetDocumentPurchaseOrdersCompleted += (s, e) => { var purchaseOrders = e.Result; purchaseOrders.Insert(0, new DocumentPurchaseOrder {Id = -1, Name = "All"}); mPurchaseOrders = purchaseOrders; mSelectedPurchaseOrder = purchaseOrders[0]; mPurchaseOrdersLoaded = true; RaiseLoaded(); }; cmsWebServiceClient.GetDocumentPurchaseOrdersAsync(); }); }); mDocumentVersions = new List<DocumentVersion>(); mDocumentVersionExports = new ObservableCollection<DocumentVersionExport>(); OkButtonCommand = new DelegateCommand<object>(OkButtonHander, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHander); AddVersionButtonCommand = new DelegateCommand<object>(AddVersionButtonHander, CanExecuteOkButtonHandler); DeleteButtonCommand = new DelegateCommand<object>(DeleteButtonHander, CanExecuteOkButtonHandler); }
public DocumentsSummaryListViewModel(List<int> ids) { DatabaseLoader.GetLightDocuments(ids).ContinueWith(getLightDocumentsTask => { CMS.UiFactory.StartNew(() => { Documents = new CmsObservableCollection<LightDocument>(getLightDocumentsTask.Result); }); }); CompositionInitializer.SatisfyImports(this); GoToDocumentLink = new DelegateCommand<object>(GoToDocumentLinkLinkHandler, CanModifyHandler); }
public PromptCategoryPickerModel() { CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); { cmsWebServiceClient.GetPromptsCompleted += (s1, e1) => { mPrompts = new CmsObservableCollection<Prompt>(e1.Result); PromptGroups = (from x in mPrompts select x.PromptGroup).Distinct().OrderBy(x => x.Ordinal).ToList(); View.DataContext = this; LoadTabs(); //FilterPrompts(); }; cmsWebServiceClient.GetPromptsAsync(); } }
public AreaPickerViewModel(List<Area> selectedAreas) { if (DesignerProperties.IsInDesignTool) { return; } mSelectedAreas = selectedAreas; //Areas mAreas = new CmsObservableCollection<Area>(CMS.Cache.Areas.Where(x => x.SiteId == CMS.AppSetting.DefaultSiteId && x.IsActive)); foreach (var area in mAreas) { area.Checked = (from x in mSelectedAreas where x.Id == area.Id select x).FirstOrDefault() != null; } OkButtonCommand = new DelegateCommand<object>(OkButtonHandler, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CanelButtonHandler, CanExecuteOkButtonHandler); }
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); }
public LocationPickerViewModel() { if (DesignerProperties.IsInDesignTool) { return; } CmsWebServiceClient cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); { cmsWebServiceClient.GetDocumentLocationsCompleted += (s, e) => { mLocations = new CmsObservableCollection<DocumentLocation>(e.Result.Where(x => x.IsActive)); RaisePropertyChanged("Locations"); }; cmsWebServiceClient.GetDocumentLocationsAsync(); } OkButtonCommand = new DelegateCommand<object>(OkButtonHandler, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CanelButtonHandler, CanExecuteOkButtonHandler); }
public RolePickerViewModel(List<Role> selectedRoles, bool showOnlyKeyStakeholders = false) { if (DesignerProperties.IsInDesignTool) { return; } mSelectedRoles = selectedRoles; //Roles if (showOnlyKeyStakeholders) { mRoles = new CmsObservableCollection<Role>(CMS.Cache.Roles.Where(x=>x.IsKeyStakeholder)); } else { mRoles = new CmsObservableCollection<Role>(CMS.Cache.Roles); } foreach (var role in mRoles) { role.Checked = (from x in mSelectedRoles where x.Id == role.Id select x).FirstOrDefault() != null; } OkButtonCommand = new DelegateCommand<object>(OkButtonHandler, CanExecuteOkButtonHandler); CancelButtonCommand = new DelegateCommand<object>(CancelButtonHandler, CanExecuteOkButtonHandler); }
private CmsObservableCollection<Area> FilterAreas() { IEnumerable<Area> filteredAreas = new CmsObservableCollection<Area>(mAreas); //Keyword string keyword = Keyword; if (!string.IsNullOrEmpty(keyword)) { string[] textArray = keyword.Split(' '); //Add custom entered search text filters foreach (var searchText in textArray) { if (!string.IsNullOrEmpty(searchText)) { string text = searchText.ToLower(); filteredAreas = filteredAreas.Where( x => x.Name.ToLower().Contains(text) || x.Description.ToLower().Contains(text)); } } } return new CmsObservableCollection<Area>(filteredAreas); }
private CmsObservableCollection<Prompt> FilterPrompts() { IEnumerable<Prompt> filteredPrompts = new CmsObservableCollection<Prompt>(mPrompts); if (PromptGroup != null && PromptGroup.Name != "All") { filteredPrompts = filteredPrompts.Where( x => x.PromptGroupId == PromptGroup.Id); } return new CmsObservableCollection<Prompt>(filteredPrompts); }
public void PublishRemove(IList<LightDocument> quickDocuments, CommonUtils.FavouriteType favouriteType) { List<FavouritePayload> list = new List<FavouritePayload>(); foreach (LightDocument quickDocument in quickDocuments) { FavouritePayload payload = new FavouritePayload { Entity = quickDocument, FavouriteType = favouriteType }; list.Add(payload); LightDocument document = (from x in mDocuments where x.Id == quickDocument.Id select x).FirstOrDefault(); if (document != null) { //seems to be null if it's just been added... mDocuments.Remove(document); Documents = new CmsObservableCollection<LightDocument>(mDocuments); } } EventAggregator.GetEvent<PrismEvents.RemoveFavouritePrismEvent>().Publish(list);//does the db remove on MainPage & remove from cache if (FavouriteRemoved != null) { FavouriteRemoved(); } }
private void InitialiseLists() { var cmsWebServiceClient = new CmsWebServiceClient(Utils.WcfBinding, Utils.WcfEndPoint); cmsWebServiceClient.GetTabSearchFiltersCompleted += (s, e) => { List<SearchFilterList> searchFilterLists = e.Result; SearchFilterLists = new CmsObservableCollection<SearchFilterList>(searchFilterLists); RaisePropertyChanged("SearchFilterLists"); SetSelectedSearchFilterList(); OnDataLoaded(SelectedSearchFilterList); }; cmsWebServiceClient.GetTabSearchFiltersAsync((int)mTabId, mUserId); }