public HomeWindowVM() { userName = Application.Current.Properties["LoggedInUserNameHome"].ToString(); var version = ConfigurationManager.AppSettings["CurrentApplicationVersion"].ToString(); AppVersion = string.Format("Diversified {0}", version); char[] objRolesSplit = new char[] { ',' }; var objRoles = Application.Current.Properties["LoggedInUserRole"].ToString().Split(objRolesSplit); NavigationNode portStorageNode = null; if (objRoles.Contains(UserRoles.Administrator.GetUserRoleToCompare())) { NavigationNode adminNode = rootNavigationNode.AddChild("Admin"); adminNode.Icon = ""; adminNode.AddChild("Add New User", typeof(AddAdminUser)).Icon = ""; adminNode.AddChild("Customer Admin", typeof(View.UserControls.CustomerAdmin.CustomerAdmin)).Icon = ""; adminNode.AddChild("Code Admin", typeof(CodesTableAdmin)).Icon = ""; adminNode.AddChild("Billing Period Admin", typeof(BillingPeriodAdmin)).Icon = ""; adminNode.AddChild("System Settings Admin", typeof(SystemSettings)).Icon = ""; adminNode.AddChild("Company Information", typeof(CompanyInformation)).Icon = ""; //adminNode.AddChild("Add/Edit Billing Records", typeof(AddEditBillingRecords)).Icon = ""; } if (objRoles.Contains(UserRoles.PortStorage.GetUserRoleToCompare()) || objRoles.Contains(UserRoles.Administrator.GetUserRoleToCompare()) || objRoles.Contains(UserRoles.Security.GetUserRoleToCompare())) { portStorageNode = rootNavigationNode.AddChild("Port Storage"); portStorageNode.Icon = ""; if (objRoles.Contains(UserRoles.PortStorage.GetUserRoleToCompare()) || objRoles.Contains(UserRoles.Administrator.GetUserRoleToCompare())) { portStorageNode.AddChild("Add-Edit PS Records", typeof(PortStorageVehicalLocator)).Icon = ""; portStorageNode.AddChild("Request Processing", typeof(PostStorageRequestProcessing)).Icon = ""; portStorageNode.AddChild("Date Out Processing", typeof(PostStorageDateOutProcessing)).Icon = ""; portStorageNode.AddChild("Storage Vehicle Outgate", typeof(StorageVehicleOutgate)).Icon = ""; } if (objRoles.Contains(UserRoles.Security.GetUserRoleToCompare())) { var existingOutgateNode = portStorageNode.Children.Where(x => x.Name.Equals("Storage Vehicle Outgate", StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (existingOutgateNode == null) { portStorageNode.AddChild("Storage Vehicle Outgate", typeof(StorageVehicleOutgate)).Icon = ""; } } if (objRoles.Contains(UserRoles.PortStorage.GetUserRoleToCompare()) || objRoles.Contains(UserRoles.Administrator.GetUserRoleToCompare())) { portStorageNode.AddChild("Port Storage Reports", typeof(View.Reports.Report)).Icon = ""; //portStorageNode.AddChild("Import/Export", typeof(PortStorageImportExport)).Icon = ""; portStorageNode.AddChild("Vehicle Import YMS", typeof(PortStorageVehicleImportYMSWindow)).Icon = ""; portStorageNode.AddChild("Location Import YMS", typeof(AppWorks.UI.View.PortStorageImportExport.PortStorageLocationImportYMSWindow)).Icon = ""; portStorageNode.AddChild("Customer Web Portal", typeof(WebPortalAdministration)).Icon = ""; portStorageNode.AddChild("Port Storage Inventory", typeof(PortStorageVehicleInventoryDetails)).Icon = ""; } } if (objRoles.Contains(UserRoles.Administrator.GetUserRoleToCompare())) { NavigationNode billingNode = rootNavigationNode.AddChild("Billing"); billingNode.Icon = ""; billingNode.AddChild("Generate Invoices", typeof(GeneratePortStorageInvoices)).Icon = ""; billingNode.AddChild("Add-Edit Invoice Records", typeof(AddEditInvoiceRecords)).Icon = ""; billingNode.AddChild("Billing Record Export", typeof(BillingRecordExport)).Icon = ""; } Nodes = new ObservableCollection <NavigationNode>(rootNavigationNode.Children); //select default node var addEditRecords = portStorageNode.Children.SingleOrDefault(c => c.Name == "Add-Edit PS Records"); if (addEditRecords == null) { addEditRecords = portStorageNode.Children.FirstOrDefault(); } if (addEditRecords != null && portStorageNode != null) { portStorageNode.IsExpanded = true; addEditRecords.IsSelected = true; addEditRecords.IsFirstTimeLoaded = true; } if (!objRoles.Contains(UserRoles.Security.GetUserRoleToCompare())) { AutoLogOffHelper.MakeAutoLogOffEvent += new AutoLogOffHelper.MakeAutoLogOff(LoginoutUser); AutoLogOffHelper.StartAutoLogoffOption(); } NavigateTo(addEditRecords); }