Beispiel #1
0
        private void MenuListSaleBill_Click(object sender, RoutedEventArgs e)
        {
            //If found  tab was ListSaleBill, selected for Tabcontrol
            var index = TabControlManagement.GetIndexByTitle(MainTabControl, UsecaseStringContants.listSaleBill);

            if (index >= 0)
            {
                MainTabControl.SelectedIndex = index;
            }
            //If not found tab was ListSaleBill, add and selected
            else
            {
                ListSaleBillUserControl listSaleBillUserControl = new ListSaleBillUserControl();
                listSaleBillUserControl.SetUpForAdmin();
                CustomTabItem customTabItem = new CustomTabItem()
                {
                    Title   = UsecaseStringContants.listSaleBill,
                    Content = listSaleBillUserControl
                };
                MainTabControl.Items.Add(customTabItem);
                MainTabControl.SelectedItem = customTabItem;
            }
            CurrenTabTitle.Content = UsecaseStringContants.listSaleBill;
            this.Title             = UsecaseStringContants.listSaleBill;
        }
        private void MenuAddSaleBill_Click(object sender, RoutedEventArgs e)
        {
            var numberItem = TabControl_AddSaleBills.Items.Count;

            if (numberItem >= maxAddSaleBillTab)
            {
                MessageBox.Show("Số tab tạo hóa đơn tối đa là !" + maxAddSaleBillTab, "Add more", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }
            ////reset the list of tab titles
            for (int i = 0; i < numberItem; i++)
            {
                CustomTabItem currentTab = (CustomTabItem)TabControl_AddSaleBills.Items[i];
                currentTab.Title = GenerateTabTitle(i + 1);
            }
            //Add new tab
            AddSaleBillUserControl addSaleBillUserControl = new AddSaleBillUserControl();
            CustomTabItem          customTabItem          = new CustomTabItem()
            {
                Title = GenerateTabTitle(numberItem + 1), Content = addSaleBillUserControl
            };

            TabControl_AddSaleBills.Items.Add(customTabItem);
            TabControl_AddSaleBills.SelectedItem = customTabItem;
        }
Beispiel #3
0
        // method to test, need remove when done this project
        private void MenuEditSupplier_Click(object sender, RoutedEventArgs e)
        {
            //If found a ListSuplier, selected for Tabcontrol
            var index = TabControlManagement.GetIndexByTitle(MainTabControl, UsecaseStringContants.editSupplier);

            if (index >= 0)
            {
                MainTabControl.SelectedIndex = index;
            }
            //If not found tab was ListSuplier, add and selected
            else
            {
                SupplierBusiness supplierBusiness = new SupplierBusiness();
                var supplier = supplierBusiness.GetAll()[0];
                SupplierViewModel supplierViewModel = new SupplierViewModel()
                {
                    SupplierId   = supplier.SupplierId,
                    SupplierName = supplier.SupplierName,
                    Description  = supplier.Description
                };
                EditSupplierUserControl editSupplierUserControl = new EditSupplierUserControl(supplierViewModel);
                CustomTabItem           customTabItem           = new CustomTabItem()
                {
                    Title   = UsecaseStringContants.editSupplier,
                    Content = editSupplierUserControl
                };
                MainTabControl.Items.Add(customTabItem);
                MainTabControl.SelectedItem = customTabItem;
            }
            CurrenTabTitle.Content = UsecaseStringContants.editSupplier;
            this.Title             = UsecaseStringContants.editSupplier;
        }
Beispiel #4
0
        private void MenuEndOfShift_Click(object sender, RoutedEventArgs e)
        {
            //If found  tab was EndOfShift, selected for Tabcontrol
            var index = TabControlManagement.GetIndexByTitle(MainTabControl, UsecaseStringContants.listEndOfShift);

            if (index >= 0)
            {
                MainTabControl.SelectedIndex = index;
            }
            //If not found tab was EndOfShift, add and selected
            else
            {
                ListEndOfShiftUserControl listEndOfShiftUserControl = new ListEndOfShiftUserControl()
                {
                    CanAprrove = true
                };
                listEndOfShiftUserControl.SetupButton();
                CustomTabItem customTabItem = new CustomTabItem()
                {
                    Title   = UsecaseStringContants.listEndOfShift,
                    Content = listEndOfShiftUserControl
                };
                MainTabControl.Items.Add(customTabItem);
                MainTabControl.SelectedItem = customTabItem;
            }
            CurrenTabTitle.Content = UsecaseStringContants.listEndOfShift;
            this.Title             = UsecaseStringContants.listEndOfShift;
        }
        private void LoadMainTabControl()
        {
            AddSaleBillUserControl addSaleBillUserControl = new AddSaleBillUserControl();
            CustomTabItem          customTabItem          = new CustomTabItem()
            {
                Title = GenerateTabTitle(1), Content = addSaleBillUserControl
            };

            TabControl_AddSaleBills.Items.Clear();
            TabControl_AddSaleBills.Items.Add(customTabItem);
            TabControl_AddSaleBills.SelectedItem = customTabItem;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentTabViewModel"/> class.
        /// </summary>
        public DocumentTabViewModel()
        {
            this._listTabItems = new ObservableCollection<CustomTabItem>();

            CustomTabItem tabItemAdd = new CustomTabItem();

            // Create Tab '+' 
            tabItemAdd.Style = (Style)Application.Current.FindResource("TabItemAddStyle");
            tabItemAdd.Header = "+";
            tabItemAdd.MouseDown += this.TabOnMouseDown;
            this._listTabItems.Add(tabItemAdd);
        }
Beispiel #7
0
            public MainWindowViewModel(MainWindow window)
            {
                this._window = window;
                InitChat();

                this._broadcastTab = new CustomTabItem
                {
                    // Broadcast tab
                    TabHeader = "All"
                };
                ObservableCollection <CustomTabItem> observableCollection = new ObservableCollection <CustomTabItem>
                {
                    this._broadcastTab
                };

                this.Tabs = observableCollection;
                this._window.TabControlChatWindows.SelectedIndex = 0;
            }
Beispiel #8
0
        public void OpenTab(object typeParam)
        {
            //Open the tab on the main thread
            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                var type = typeParam as Type;

                if (type == null)
                {
                    return;
                }

                var header = new CustomTabItem();

                var instance = (TabControlBase)Activator.CreateInstance(type);

                OpenTab(header, instance);
            });
        }
Beispiel #9
0
            private void SignalRControllerOnNewMessageHandler(string content, User user)
            {
                // Do we have a tab with a sender open?
                string        tabContent = $"{DateTime.Now.ToShortTimeString()} - {user.Username}: {content} {Environment.NewLine}";
                CustomTabItem currentTab = this.Tabs.FirstOrDefault(item => item.UserGuid == user.Guid);

                if (currentTab == null)
                {
                    currentTab = new CustomTabItem()
                    {
                        TabContent = tabContent,
                        TabHeader  = user.Username,
                        UserGuid   = user.Guid
                    };
                    InvokeOnUiThread(() => this.Tabs.Add(currentTab));
                }
                else
                {
                    currentTab.TabContent += tabContent;
                }
            }
Beispiel #10
0
        private void MenuStatistics_Click(object sender, RoutedEventArgs e)
        {
            //If found  tab was Statistics, selected for Tabcontrol
            var index = TabControlManagement.GetIndexByTitle(MainTabControl, UsecaseStringContants.statistics);

            if (index >= 0)
            {
                MainTabControl.SelectedIndex = index;
            }
            //If not found tab was Statistics, add and selected
            else
            {
                StatisticsUserControl statisticsUserControl = new StatisticsUserControl();
                CustomTabItem         customTabItem         = new CustomTabItem()
                {
                    Title   = UsecaseStringContants.statistics,
                    Content = statisticsUserControl
                };
                MainTabControl.Items.Add(customTabItem);
                MainTabControl.SelectedItem = customTabItem;
            }
            CurrenTabTitle.Content = UsecaseStringContants.statistics;
            this.Title             = UsecaseStringContants.statistics;
        }
Beispiel #11
0
        private void MenuManageSuplier(object sender, RoutedEventArgs e)
        {
            //If found a ListSuplier, selected for Tabcontrol
            var index = TabControlManagement.GetIndexByTitle(MainTabControl, UsecaseStringContants.listSupplier);

            if (index >= 0)
            {
                MainTabControl.SelectedIndex = index;
            }
            //If not found tab was ListSuplier, add and selected
            else
            {
                ManageSupplierUserControl manageSupplierUserControl = new ManageSupplierUserControl();
                CustomTabItem             customTabItem             = new CustomTabItem()
                {
                    Title   = UsecaseStringContants.listSupplier,
                    Content = manageSupplierUserControl
                };
                MainTabControl.Items.Add(customTabItem);
                MainTabControl.SelectedItem = customTabItem;
            }
            CurrenTabTitle.Content = UsecaseStringContants.listSupplier;
            this.Title             = UsecaseStringContants.listSupplier;
        }
Beispiel #12
0
        private void MenuAddPurchaseBill(object sender, RoutedEventArgs e)
        {
            //If found a AddPurchaseBill tabitem, selected for Tabcontrol
            var index = TabControlManagement.GetIndexByTitle(MainTabControl, UsecaseStringContants.addPurchaseBill);

            if (index >= 0)
            {
                MainTabControl.SelectedIndex = index;
            }
            //If not found tab was AddPurchaseBill tabitem, add and selected
            else
            {
                AddPurchaseBillUserControl addPurchaseBillUserControl = new AddPurchaseBillUserControl();
                CustomTabItem customTabItem = new CustomTabItem()
                {
                    Title   = UsecaseStringContants.addPurchaseBill,
                    Content = addPurchaseBillUserControl
                };
                MainTabControl.Items.Add(customTabItem);
                MainTabControl.SelectedItem = customTabItem;
            }
            CurrenTabTitle.Content = UsecaseStringContants.addPurchaseBill;
            this.Title             = UsecaseStringContants.addPurchaseBill;
        }
        /// <summary>
        /// The validate content is editing or not.
        /// </summary>
        /// <param name="tabItem">
        /// The tab item.
        /// </param>
        /// <returns>
        /// The <see cref="int"/>.
        /// </returns>
        public int ValidateContentClose(CustomTabItem tabItem)
        {
            bool isContentEditing = false;

            bool isChecked = false;

            if (tabItem.ItemvalidateTabContent != null)
            {
                foreach (var tabContentEdit in tabItem.ItemvalidateTabContent)
                {
                    if (!isChecked)
                    {
                        if (tabContentEdit.CheckContentEdit != null)
                        {
                            isContentEditing = tabContentEdit.CheckContentEdit().Result;
                            if (isContentEditing)
                            {
                                isChecked = true;
                            }
                        }
                    }
                }

                // Show ConfirmationWindow when content is editing
                if (isContentEditing)
                {
                    ConfirmationWindowView confirm = new ConfirmationWindowView();
                    ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel();
                    confirmViewModel.Content = "Changes have not been saved. Click OK to proceed without saving changes.";
                    confirmViewModel.Title = "Confirm Save - " + tabItem.Header;
                    confirm.DataContext = confirmViewModel;

                    confirm.ShowDialog();
                    if (confirm.DialogResult == false)
                    {
                        return 0;
                    }

                    return 1;
                }
            }
            
            return 2;
        }
        /// <summary>
        /// The change content selected tab.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="formContent">
        /// The form content.
        /// </param>
        /// <returns>
        /// The <see cref="CustomTabItem"/>.
        /// </returns>
        public CustomTabItem ChangeContentSelectedTab(string name, CustomTabItem formContent)
        {
            if (name.Equals("CollectionSettings") || name.Equals("SecuritySetting") || name.Equals("ColletionQueues") || name.Equals("ConfigurationMenu")
                || name.Equals("AssetClasses") || name.Equals("AssetCollateralClasses") || name.Equals("AssetFeatures") || name.Equals("AssetSetting")||name.Equals("AssetRegister"))
            {
                name = "Configuration";
            }
            foreach (var tabItem in this._listTabItems)
            {
                if (tabItem.IsSelected)
                {
                    int canProceed = this.ValidateContentClose(tabItem);

                    if (canProceed == 1 || canProceed == 2)
                    {
                        foreach (var itemValidate in tabItem.ItemvalidateTabContent)
                        {
                            if (itemValidate.DoUnLockAsync != null)
                            {
                                itemValidate.DoUnLockAsync();
                            }
                        }

                        tabItem.ItemvalidateTabContent.Clear();
                        int count = this._listTabItems.Count;

                        //tabItem.Name = string.Format(name + "{0}", count);
                        tabItem.Header = name;
                        tabItem.Content = formContent.Content;
                    }

                    // Change style MainMenu Button
                    if (TabSelectionChanged != null)
                    {
                        this.TabSelectionChanged(tabItem.Header);
                    }
                    return tabItem;
                }
            }
            return null;
        }
        /// <summary>
        /// The add tab item with content.
        /// </summary>
        /// <param name="name">
        /// The name.
        /// </param>
        /// <param name="tabItem">
        /// The tab Item.
        /// </param>
        /// <returns>
        /// The <see cref="CustomTabItem"/>.
        /// </returns>
        public CustomTabItem AddTabItemWithContent(string name, CustomTabItem tabItem)
        {
            if (name.Equals("+"))
            {
                name = "Home";
            }
            else
            {
                // Check if tab Configuration exist or not
                foreach (var customTabItem in _listTabItems)
                {
                    if (customTabItem.Header.Equals("Configuration"))
                    {
                        if (customTabItem.IsSelected)
                        {
                            // Change content when Configuration tab is selected.
                            this.ChangeContentSelectedTab(name, tabItem);
                        }
                        else
                        {
                            // Select Configuration tab if don't focus.
                            customTabItem.IsSelected = true;

                            // Change style MainMenu Button
                            if (TabSelectionChanged != null)
                            {
                                this.TabSelectionChanged(tabItem.Header);
                            }
                        }
                        return null;
                    }

                }
            }

            int count = this._listTabItems.Count;

            tabItem.Name = string.Format(name + "{0}", count);
            tabItem.Header = name;
            tabItem.Style = (Style)Application.Current.FindResource("TabItemStyle");
            tabItem.MouseDown += TabOnMouseDown;
            tabItem.IsSelected = true;

            this._listTabItems.Insert(count - 1, tabItem);
            this.OnPropertyChanged(() => ListTabItems);

            // Change style MainMenu Button
            if (TabSelectionChanged != null)
            {
                this.TabSelectionChanged(tabItem.Header);
            }
            return tabItem;
        }
Beispiel #16
0
        private void OpenTab(CustomTabItem header, TabControlBase instance)
        {
            if (!CanOpenNew(instance))
            {
                return;
            }

            if (!IsFeatureEnabled(instance.GetType()))
            {
                var notAvailableHeader = new CustomTabItem {
                    Label = { Content = "Strona niedostępna" }
                };

                var functionNotAvailable = new FunctionNotAvailable(GetFeatureName(instance.GetType()));
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    var item = new TabItem
                    {
                        Header  = notAvailableHeader,
                        Content = functionNotAvailable
                    };

                    functionNotAvailable.TabItem = item;

                    notAvailableHeader.CloseButton.Click += CloseButton_Click;
                    functionNotAvailable.CloseRequested  += instance_CloseRequested;

                    TabCollection.Add(item);


                    item.Focus();
                });

                return;
            }

            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                var item = new TabItem
                {
                    Header  = header,
                    Content = instance
                };

                instance.TabItem = item;

                header.CloseButton.Click += CloseButton_Click;
                instance.CloseRequested  += instance_CloseRequested;

                if (instance is MainWindow)
                {
                    //  RemoveAllSaleHandlers();
                    //  header.CloseButton.Visibility = Visibility.Collapsed;
                    //
                    //  TabCollection.Insert(0, item);
                }
                else
                {
                    TabCollection.Add(item);
                }


                item.Focus();
            });
        }
Beispiel #17
0
        public void ShowTab(TabControlBase control)
        {
            var header = new CustomTabItem();

            OpenTab(header, control);
        }
Beispiel #18
0
        /// <summary>
        /// The on new main content.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        public async void OnNewMainContent(object sender)
        {
            CustomHyperlink configurationItem = sender as CustomHyperlink;

            if (configurationItem != null)
            {
                sender = configurationItem.Action;
            }

            string content;

            // Check if sender is Add tab button.
            if (sender.ToString().Equals("+"))
            {
                content = "Home";
            }
            else
            {
                content = sender.ToString();
            }

            // Check if sender is call from Configuration page.
            if (sender.ToString().Equals("ConfigurationMenu"))
            {
                content = "Configuration";
            }
            if (sender.ToString().Equals("Asset Register"))
            {
                content = "RegisteredAsset";
            }

            var newTab = new CustomTabItem();
            newTab.ItemvalidateTabContent = new List<ItemValidateContent>();
            switch (content)
            {
                case "Home":
                    var homePage = new MainWindowDetailsToggle();
                    var homepageViewModel = new MainWindowDetailsToggleViewModel("Home");

                    var homenContent = new ObservableCollection<object>();

                    var homeControl = new MainWindowDetails();

                    Binding homeBinding = new Binding("ScreenDetailViewModel");
                    homeBinding.Source = homepageViewModel;
                    homeControl.SetBinding(FrameworkElement.DataContextProperty, homeBinding);

                    homenContent.Add(homeControl);
                    homepageViewModel.ScreenDetailViewModel = new MainWindowDetailsViewModel(EnumScreen.Home);
                    homepageViewModel.MainContent = homenContent;

                    homePage.DataContext = homepageViewModel;

                    // Add content for new tab
                    newTab.Content = homePage;
                    break;

                case "Funding":
                    if (await Operations.Security.Authorisation.IsModuleInstalledAsync(Modules.Funding))
                    {
                        var fundingView = new MainWindowDetailsToggle();
                        var fundingViewModel = new MainWindowDetailsToggleViewModel("Funding");

                        var fundingContent = new ObservableCollection<object>();
                        var fundingControl = new MainWindowDetails();

                        Binding fundingBinding = new Binding("ScreenDetailViewModel");
                        fundingBinding.Source = fundingViewModel;
                        fundingControl.SetBinding(FrameworkElement.DataContextProperty, fundingBinding);

                        fundingContent.Add(fundingControl);

                        fundingViewModel.ScreenDetailViewModel =
                            new MainWindowDetailsViewModel(EnumScreen.FundingSummary);
                        (fundingViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).NavigatedToScreen =
                            NavigatedToScreen;
                        fundingViewModel.MainContent = fundingContent;
                        fundingView.DataContext = fundingViewModel;

                        // Add content for new tab
                        newTab.Content = fundingView;
                    }
                    else
                    {
                        var fundingView = new MainWindowDetailsToggle();
                        var fundingViewModel = new MainWindowDetailsToggleViewModel("Funding");

                        var fundingContent = new ObservableCollection<object>();
                        var fundingControl = new DescriptionModuleView();
                        Binding fundingBinding = new Binding("ScreenDetailViewModel");
                        fundingBinding.Source = fundingViewModel;
                        fundingControl.SetBinding(FrameworkElement.DataContextProperty, fundingBinding);

                        fundingContent.Add(fundingControl);

                        fundingViewModel.ScreenDetailViewModel =
                            new DescriptionModuleViewModel("Funding");
                        fundingViewModel.MainContent = fundingContent;
                        fundingView.DataContext = fundingViewModel;

                        // Add content for new tab
                        newTab.Content = fundingView;
                    }
                    break;

                case "Collection":
                    if (await Operations.Security.Authorisation.IsModuleInstalledAsync(Modules.Collections))
                    {
                        var collectionView = new MainWindowDetailsToggle();
                        var collectionViewModel = new MainWindowDetailsToggleViewModel("Collection");

                        var collectionContent = new ObservableCollection<object>();

                        var collectionControl = new MainWindowDetails();

                        Binding collectionBinding = new Binding("ScreenDetailViewModel");
                        collectionBinding.Source = collectionViewModel;
                        collectionControl.SetBinding(FrameworkElement.DataContextProperty, collectionBinding);

                        collectionContent.Add(collectionControl);
                        collectionViewModel.ScreenDetailViewModel =
                            new MainWindowDetailsViewModel(EnumScreen.CollectionAssignment);
                        (collectionViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).NavigatedToScreen =
                            NavigatedToScreen;
                        collectionViewModel.MainContent = collectionContent;

                        collectionView.DataContext = collectionViewModel;

                        // Add content for new tab
                        newTab.Content = collectionView;
                    }
                    else
                    {
                        var collectionView = new MainWindowDetailsToggle();
                        var collectionViewModel = new MainWindowDetailsToggleViewModel("Collection");

                        var collectionContent = new ObservableCollection<object>();

                        var collectionControl = new DescriptionModuleView();

                        Binding collectionBinding = new Binding("ScreenDetailViewModel");
                        collectionBinding.Source = collectionViewModel;
                        collectionControl.SetBinding(FrameworkElement.DataContextProperty, collectionBinding);

                        collectionContent.Add(collectionControl);
                        collectionViewModel.ScreenDetailViewModel =
                            new DescriptionModuleViewModel("Collection");

                        collectionViewModel.MainContent = collectionContent;

                        collectionView.DataContext = collectionViewModel;

                        // Add content for new tab
                        newTab.Content = collectionView;
                    }
                    break;
                case "Security":
                    var usersGroupsContent = new MainWindowDetailsToggle();
                    var usersGroupsViewModel = new MainWindowDetailsToggleViewModel("Security");
                    usersGroupsContent.DataContext = usersGroupsViewModel;
                    var content1 = new ObservableCollection<object>();

                    var tabControl = new MainWindowDetailsTabControl();

                    Binding securitybinding = new Binding("ScreenDetailViewModel");
                    securitybinding.Source = usersGroupsViewModel;
                    tabControl.SetBinding(FrameworkElement.DataContextProperty, securitybinding);

                    content1.Add(tabControl);
                    usersGroupsViewModel.ScreenDetailViewModel = new MainWindowDetailsTabControlViewModel();
                    (usersGroupsViewModel.ScreenDetailViewModel as MainWindowDetailsTabControlViewModel).NavigatedToScreen = NavigatedToScreen;
                    usersGroupsViewModel.MainContent = content1;

                    usersGroupsContent.DataContext = usersGroupsViewModel;

                    // Add content for new tab
                    newTab.Content = usersGroupsContent;

                    break;
                case "PowerOff":
                    bool canProceed = true;
                    foreach (var tabItem in this._documentTabViewModel.ListTabItems)
                    {
                        int isContent = this._documentTabViewModel.ValidateContentClose(tabItem);
                        if (isContent == 1)
                        {
                            break;
                        }
                        if (isContent == 0)
                        {
                            canProceed = false;
                            break;
                        }
                    }

                    if (canProceed)
                    {
                        foreach (var tab in _documentTabViewModel.ListTabItems)
                        {
                            if (tab.ItemvalidateTabContent != null)
                            {
                                foreach (var itemTabValidate in tab.ItemvalidateTabContent)
                                {
                                    if (itemTabValidate.DoUnLockAsync != null)
                                    {
                                        itemTabValidate.DoUnLockAsync();
                                    }
                                }
                            }
                        }
                        if (PowerOffMainWindowView != null)
                        {
                            this.PowerOffMainWindowView();
                        }
                    }
                    return;
                case "Configuration":

                    var configContent = new MainWindowDetailsToggle();
                    var configViewModel = new MainWindowDetailsToggleViewModel("Configuration");

                    var contentConfig = new ObservableCollection<object>();
                    var configuration = new MainWindowDetails();

                    Binding configurationBinding = new Binding("ScreenDetailViewModel");
                    configurationBinding.Source = configViewModel;
                    configuration.SetBinding(FrameworkElement.DataContextProperty, configurationBinding);

                    contentConfig.Add(configuration);
                    configViewModel.ScreenDetailViewModel = new MainWindowDetailsViewModel(EnumScreen.Configuration);
                    (configViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).NavigatedToScreen = NavigatedToScreen;
                    (configViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).ConfigurationItemClicked = this.OnNewMainContent;
                    configViewModel.MainContent = contentConfig;

                    configContent.DataContext = configViewModel;

                    // Add content for new tab
                    newTab.Content = configContent;
                    break;
                case "CollectionSettings":
                    if (await Operations.Security.Authorisation.IsModuleInstalledAsync(Modules.Collections))
                    {
                        var collectionSettingContent = new MainWindowDetailsToggle();
                        var collectionSettingViewModel = new MainWindowDetailsToggleViewModel("CollectionSettings");

                        var contentCollectionSetting = new ObservableCollection<object>();
                        var collectionSetting = new MainWindowDetails();

                        Binding collectionSettingBinding = new Binding("ScreenDetailViewModel");
                        collectionSettingBinding.Source = collectionSettingViewModel;
                        collectionSetting.SetBinding(FrameworkElement.DataContextProperty, collectionSettingBinding);

                        contentCollectionSetting.Add(collectionSetting);

                        collectionSettingViewModel.ScreenDetailViewModel =
                            new MainWindowDetailsViewModel(EnumScreen.CollectionSettings);
                        (collectionSettingViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel)
                            .NavigatedToScreen = NavigatedToScreen;

                        collectionSettingViewModel.MainContent = contentCollectionSetting;
                        collectionSettingViewModel.BackToConfiguration = this.OnNewMainContent;

                        collectionSettingContent.DataContext = collectionSettingViewModel;

                        // Add content for new tab
                        newTab.Content = collectionSettingContent;
                    }
                    else
                    {
                        var collectionSettingContent = new MainWindowDetailsToggle();
                        var collectionSettingViewModel = new MainWindowDetailsToggleViewModel("CollectionSettings");

                        var contentCollectionSetting = new ObservableCollection<object>();

                        var collectionSetting = new DescriptionModuleView();

                        Binding collectionBinding = new Binding("ScreenDetailViewModel");
                        collectionBinding.Source = collectionSettingViewModel;
                        collectionSetting.SetBinding(FrameworkElement.DataContextProperty, collectionBinding);

                        contentCollectionSetting.Add(collectionSetting);
                        collectionSettingViewModel.ScreenDetailViewModel = new DescriptionModuleViewModel("Collection");

                        collectionSettingViewModel.MainContent = contentCollectionSetting;
                        collectionSettingViewModel.BackToConfiguration = this.OnNewMainContent;

                        collectionSettingContent.DataContext = collectionSettingViewModel;

                        // Add content for new tab
                        newTab.Content = collectionSettingContent;
                    }
                    break;
                case "SecuritySetting":
                    var securitySettingContent = new MainWindowDetailsToggle();
                    var securitySettingViewModel = new MainWindowDetailsToggleViewModel("SecuritySetting");

                    var contentSecuritySetting = new ObservableCollection<object>();
                    var securitySetting = new MainWindowDetails();

                    Binding securitySettingBinding = new Binding("ScreenDetailViewModel");
                    securitySettingBinding.Source = securitySettingViewModel;
                    securitySetting.SetBinding(FrameworkElement.DataContextProperty, securitySettingBinding);

                    contentSecuritySetting.Add(securitySetting);

                    securitySettingViewModel.ScreenDetailViewModel = new MainWindowDetailsViewModel(EnumScreen.SecuritySetting);
                    (securitySettingViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).NavigatedToScreen = NavigatedToScreen;

                    securitySettingViewModel.MainContent = contentSecuritySetting;
                    securitySettingViewModel.BackToConfiguration = this.OnNewMainContent;

                    securitySettingContent.DataContext = securitySettingViewModel;

                    // Add content for new tab
                    newTab.Content = securitySettingContent;
                    break;
                case "ColletionQueues":
                    if (await Operations.Security.Authorisation.IsModuleInstalledAsync(Modules.Collections))
                    {
                        var colletionQueuesContent = new MainWindowDetailsToggle();
                        var colletionQueuesViewModel = new MainWindowDetailsToggleViewModel("ColletionQueues");

                        var contentColletionQueues = new ObservableCollection<object>();
                        var colletionQueues = new MainWindowDetailsTabControlCollectionQueue();

                        Binding collectionQueuesBinding = new Binding("ScreenDetailViewModel");
                        collectionQueuesBinding.Source = colletionQueuesViewModel;
                        colletionQueues.SetBinding(FrameworkElement.DataContextProperty, collectionQueuesBinding);

                        contentColletionQueues.Add(colletionQueues);

                        colletionQueuesViewModel.ScreenDetailViewModel =
                            new MainWindowDetailsTabControlCollectionQueueViewModel();
                        (colletionQueuesViewModel.ScreenDetailViewModel as
                         MainWindowDetailsTabControlCollectionQueueViewModel).NavigatedToScreen = NavigatedToScreen;

                        colletionQueuesViewModel.MainContent = contentColletionQueues;
                        colletionQueuesViewModel.BackToConfiguration = this.OnNewMainContent;

                        colletionQueuesContent.DataContext = colletionQueuesViewModel;

                        // Add content for new tab
                        newTab.Content = colletionQueuesContent;
                    }
                    else
                    {
                        var colletionQueuesContent = new MainWindowDetailsToggle();
                        var colletionQueuesViewModel = new MainWindowDetailsToggleViewModel("ColletionQueues");

                        var contentColletionQueues = new ObservableCollection<object>();

                        var colletionQueues = new DescriptionModuleView();

                        Binding collectionBinding = new Binding("ScreenDetailViewModel");
                        collectionBinding.Source = colletionQueuesViewModel;
                        colletionQueues.SetBinding(FrameworkElement.DataContextProperty, collectionBinding);

                        contentColletionQueues.Add(colletionQueues);
                        colletionQueuesViewModel.ScreenDetailViewModel = new DescriptionModuleViewModel("Collection");

                        colletionQueuesViewModel.MainContent = contentColletionQueues;
                        colletionQueuesViewModel.BackToConfiguration = this.OnNewMainContent;

                        colletionQueuesContent.DataContext = colletionQueuesViewModel;

                        // Add content for new tab
                        newTab.Content = colletionQueuesContent;
                    }
                    break;
                case "AssetClasses":
                    var assetClassesContent = new MainWindowDetailsToggle();
                    var assetClassesViewModel = new MainWindowDetailsToggleViewModel("AssetClasses");

                    var assetClasses = new ObservableCollection<object>();
                    var mainAssetClasses = new MainAssetClassesView();

                    Binding assetClassesBinding = new Binding("ScreenDetailViewModel");
                    assetClassesBinding.Source = assetClassesViewModel;
                    mainAssetClasses.SetBinding(FrameworkElement.DataContextProperty, assetClassesBinding);

                    assetClasses.Add(mainAssetClasses);

                    assetClassesViewModel.ScreenDetailViewModel = new MainAssetClassesViewModel();
                    (assetClassesViewModel.ScreenDetailViewModel as MainAssetClassesViewModel).NavigatedToScreen = NavigatedToScreen;

                    assetClassesViewModel.MainContent = assetClasses;
                    assetClassesViewModel.BackToConfiguration = this.OnNewMainContent;

                    assetClassesContent.DataContext = assetClassesViewModel;

                    // Add content for new tab
                    newTab.Content = assetClassesContent;
                    break;
                case "AssetCollateralClasses":
                    if (await Operations.Security.Authorisation.IsModuleInstalledAsync(Modules.PPSR))
                    {
                        var assetCollateralContent = new MainWindowDetailsToggle();
                        var assetCollateralViewModel = new MainWindowDetailsToggleViewModel("AssetCollateralClasses");

                        var contentassetCollateral = new ObservableCollection<object>();
                        var assetCollateral = new MainWindowDetails();

                        Binding assetCollateralBinding = new Binding("ScreenDetailViewModel");
                        assetCollateralBinding.Source = assetCollateralViewModel;
                        assetCollateral.SetBinding(FrameworkElement.DataContextProperty, assetCollateralBinding);

                        contentassetCollateral.Add(assetCollateral);

                        assetCollateralViewModel.ScreenDetailViewModel =
                            new MainWindowDetailsViewModel(EnumScreen.AssetCollateralClasses);
                        (assetCollateralViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).NavigatedToScreen
                            = NavigatedToScreen;

                        assetCollateralViewModel.MainContent = contentassetCollateral;
                        assetCollateralViewModel.BackToConfiguration = this.OnNewMainContent;

                        assetCollateralContent.DataContext = assetCollateralViewModel;

                        // Add content for new tab
                        newTab.Content = assetCollateralContent;
                    }
                    else
                    {
                        var assetCollateralContent = new MainWindowDetailsToggle();
                        var assetCollateralViewModel = new MainWindowDetailsToggleViewModel("AssetCollateralClasses");

                        var contentassetCollateral = new ObservableCollection<object>();
                        var assetCollateral = new DescriptionModuleView();

                        Binding assetCollateralBinding = new Binding("ScreenDetailViewModel");
                        assetCollateralBinding.Source = assetCollateralViewModel;
                        assetCollateral.SetBinding(FrameworkElement.DataContextProperty, assetCollateralBinding);

                        contentassetCollateral.Add(assetCollateral);

                        assetCollateralViewModel.ScreenDetailViewModel =
                            new DescriptionModuleViewModel("AssetCollateralClasses");
                        assetCollateralViewModel.MainContent = contentassetCollateral;
                        assetCollateralViewModel.BackToConfiguration = this.OnNewMainContent;
                        assetCollateralContent.DataContext = assetCollateralViewModel;

                        // Add content for new tab
                        newTab.Content = assetCollateralContent;
                    }
                    break;
                case "AssetFeatures":
                    var assetFeaturesContent = new MainWindowDetailsToggle();
                    var assetFeaturesViewModel = new MainWindowDetailsToggleViewModel("AssetFeatures");

                    var contentAssetFeatures = new ObservableCollection<object>();
                    var assetFeatures = new MainWindowDetails();

                    Binding assetFeaturesBinding = new Binding("ScreenDetailViewModel");
                    assetFeaturesBinding.Source = assetFeaturesViewModel;
                    assetFeatures.SetBinding(FrameworkElement.DataContextProperty, assetFeaturesBinding);

                    contentAssetFeatures.Add(assetFeatures);

                    assetFeaturesViewModel.ScreenDetailViewModel = new MainWindowDetailsViewModel(EnumScreen.AssetFeatures);
                    (assetFeaturesViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).NavigatedToScreen = NavigatedToScreen;

                    assetFeaturesViewModel.MainContent = contentAssetFeatures;
                    assetFeaturesViewModel.BackToConfiguration = this.OnNewMainContent;

                    assetFeaturesContent.DataContext = assetFeaturesViewModel;

                    // Add content for new tab
                    newTab.Content = assetFeaturesContent;
                    break;
                case "AssetSetting":
                    var assetSettingContent = new MainWindowDetailsToggle();
                    var assetSettingViewModel = new MainWindowDetailsToggleViewModel("AssetSetting");

                    var contentAssetSetting = new ObservableCollection<object>();
                    var assetSetting = new MainWindowDetails();

                    Binding assetSettingBinding = new Binding("ScreenDetailViewModel");
                    assetSettingBinding.Source = assetSettingViewModel;
                    assetSetting.SetBinding(FrameworkElement.DataContextProperty, assetSettingBinding);

                    contentAssetSetting.Add(assetSetting);

                    assetSettingViewModel.ScreenDetailViewModel = new MainWindowDetailsViewModel(EnumScreen.AssetSettings);
                    (assetSettingViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).NavigatedToScreen = NavigatedToScreen;

                    assetSettingViewModel.MainContent = contentAssetSetting;
                    assetSettingViewModel.BackToConfiguration = this.OnNewMainContent;

                    assetSettingContent.DataContext = assetSettingViewModel;

                    // Add content for new tab
                    newTab.Content = assetSettingContent;
                    break;
                case "AssetRegister":

                        var assetRegisterContent = new MainWindowDetailsToggle();
                        var assetRegisterViewModel = new MainWindowDetailsToggleViewModel("AssetRegister");

                        var contentAssetRegister = new ObservableCollection<object>();
                        var assetRegister = new MainWindowDetails();

                        Binding assetRegisterBinding = new Binding("ScreenDetailViewModel");
                        assetRegisterBinding.Source = assetRegisterViewModel;
                        assetRegister.SetBinding(FrameworkElement.DataContextProperty, assetRegisterBinding);

                        contentAssetRegister.Add(assetRegister);

                        assetRegisterViewModel.ScreenDetailViewModel =
                            new MainWindowDetailsViewModel(EnumScreen.AssetRegisters);
                        (assetRegisterViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).NavigatedToScreen =
                            NavigatedToScreen;

                        assetRegisterViewModel.MainContent = contentAssetRegister;
                        assetRegisterViewModel.BackToConfiguration = this.OnNewMainContent;

                        assetRegisterContent.DataContext = assetRegisterViewModel;

                        // Add content for new tab
                        newTab.Content = assetRegisterContent;
                    
                    break;
                case "RegisteredAsset":
                    if (await Operations.Security.Authorisation.IsModuleInstalledAsync(Modules.AssetRegister))
                    {
                        var registeredAssetContent = new MainWindowDetailsToggle();
                        var registeredAssetViewModel = new MainWindowDetailsToggleViewModel("RegisteredAsset");
                        registeredAssetContent.DataContext = registeredAssetViewModel;
                        var contentRegisteredAsset = new ObservableCollection<object>();
                        var registeredAsset = new MainWindowDetails();
                        Binding registeredAssetBinding = new Binding("ScreenDetailViewModel");
                        registeredAssetBinding.Source = registeredAssetViewModel;

                        registeredAsset.SetBinding(FrameworkElement.DataContextProperty, registeredAssetBinding);

                        contentRegisteredAsset.Add(registeredAsset);
                        registeredAssetViewModel.ScreenDetailViewModel =
                            new MainWindowDetailsViewModel(EnumScreen.RegisteredAsset);
                        (registeredAssetViewModel.ScreenDetailViewModel as MainWindowDetailsViewModel).NavigatedToScreen = NavigatedToScreen;
                        registeredAssetViewModel.MainContent = contentRegisteredAsset;

                        registeredAssetContent.DataContext = registeredAssetViewModel;

                        // Add content for new tab
                        newTab.Content = registeredAssetContent;
                    }
                    else
                    {
                        var registeredAssetView = new MainWindowDetailsToggle();
                        var registeredAssetViewModel = new MainWindowDetailsToggleViewModel("RegisteredAsset");

                        var registeredAsssetContent = new ObservableCollection<object>();

                        var registeredAsssetControl = new DescriptionModuleView();

                        Binding registeredAssetBinding = new Binding("ScreenDetailViewModel");
                        registeredAssetBinding.Source = registeredAssetViewModel;
                        registeredAsssetControl.SetBinding(FrameworkElement.DataContextProperty, registeredAssetBinding);

                        registeredAsssetContent.Add(registeredAsssetControl);
                        registeredAssetViewModel.ScreenDetailViewModel =
                            new DescriptionModuleViewModel("RegisteredAsset");

                        registeredAssetViewModel.MainContent = registeredAsssetContent;

                        registeredAssetView.DataContext = registeredAssetViewModel;

                        // Add content for new tab
                        newTab.Content = registeredAssetView;
                    }
                    break;
            }

            // Sender is Add and Configuration will be create new tab.
            if (sender.ToString().Equals("+") || sender.ToString().Equals("Configuration"))
            {
                this._documentTabViewModel.AddTabItemWithContent(sender.ToString(), newTab);
            }
            else
            {
                // All another sender from MainMenu button will be change content of tab is selected.
                this._documentTabViewModel.ChangeContentSelectedTab(sender.ToString(), newTab);
            }
        }