Ejemplo n.º 1
0
        private async void UpdateTabInformations()
        {
            //Set temp tab + tabs list ID
            try
            {
                current_tab = TabsAccessManager.GetTabViaID(new TabID {
                    ID_Tab = current_tab.ID, ID_TabsList = current_list
                });

                name_tab.Text = current_tab.TabName;

                //Tooltip name
                ToolTip ButtonTooltip = new ToolTip();
                ButtonTooltip.Content = current_tab.TabName;
                ToolTipService.SetToolTip(IconAndTabNameGrid, ButtonTooltip);

                switch (current_tab.TabContentType)
                {
                case ContentType.File:
                    string ModuleIDIcon = LanguagesHelper.GetModuleIDOfLangageType(current_tab.TabType);
                    TabIcon.Source = await ModulesAccessManager.GetModuleIconViaIDAsync(ModuleIDIcon, ModulesAccessManager.GetModuleViaID(ModuleIDIcon).ModuleSystem);

                    if (!string.IsNullOrEmpty(current_tab.TabOriginalPathContent))
                    {
                        switch (current_tab.TabStorageMode)
                        {
                        case StorageListTypes.LocalStorage:
                            path_tab.Text = current_tab.TabOriginalPathContent;
                            break;

                        case StorageListTypes.OneDrive:
                            path_tab.Text = "OneDrive file";
                            break;
                        }

                        Size_Stackpanel.Visibility     = Visibility.Visible;
                        Modified_Stackpanel.Visibility = Visibility.Visible;
                        Created_Stackpanel.Visibility  = Visibility.Visible;

                        Rename_Tab.IsEnabled = false;
                    }
                    else
                    {
                        Size_Stackpanel.Visibility     = Visibility.Collapsed;
                        Modified_Stackpanel.Visibility = Visibility.Collapsed;
                        Created_Stackpanel.Visibility  = Visibility.Collapsed;

                        Rename_Tab.IsEnabled = true;
                    }

                    Notification.ShowBadge = current_tab.TabNewModifications;

                    TabsListGrid.Visibility = Visibility.Collapsed;
                    TabIcon.Visibility      = Visibility.Visible;
                    FolderIcon.Visibility   = Visibility.Collapsed;
                    StackInfos.Visibility   = Visibility.Visible;

                    MaxHeightAnimShow.Value   = 200;
                    MaxHeightAnimRemove.Value = 200;
                    break;

                case ContentType.Folder:
                    Notification.ShowBadge = false;
                    Rename_Tab.IsEnabled   = false;

                    More_Tab.Visibility     = Visibility.Visible;
                    TabsListGrid.Visibility = Visibility.Visible;
                    StackInfos.Visibility   = Visibility.Collapsed;

                    TabIcon.Visibility    = Visibility.Collapsed;
                    FolderIcon.Visibility = Visibility.Visible;

                    if (TempTabID != current_tab.ID && TabsList.ListID != current_list)
                    {
                        if (current_tab.FolderOpened)
                        {
                            ShowInfos.Begin(); infos_opened = true;
                        }
                        else
                        {
                            infos_opened = false;
                        }

                        TabsList.ListTabs.Items.Clear();
                        TempTabID       = current_tab.ID;
                        TabsList.ListID = current_list;
                        foreach (int ID in current_tab.FolderContent)
                        {
                            try
                            {
                                if (TabsAccessManager.GetTabViaID(new TabID {
                                    ID_Tab = ID, ID_TabsList = current_list
                                }) != null)
                                {
                                    TabsList.ListTabs.Items.Add(new TabID {
                                        ID_Tab = ID, ID_TabsList = current_list
                                    });
                                    if ((int)AppSettings.Values["Tabs_tab-selected-index"] == ID && (int)AppSettings.Values["Tabs_list-selected-index"] == current_list)
                                    {
                                        TabsList.ListTabs.SelectedIndex = TabsList.ListTabs.Items.Count - 1;
                                    }
                                }
                            }
                            catch { }
                        }
                    }

                    MaxHeightAnimShow.Value   = 1500;
                    MaxHeightAnimRemove.Value = 1500;
                    break;
                }
            }
            catch { }
        }
Ejemplo n.º 2
0
        private async void UpdateTabInformations()
        {
            //Set temp tab + tabs list ID
            try
            {
                current_tab = TabsAccessManager.GetTabViaID(new TabID {
                    ID_Tab = current_tab.ID, ID_TabsList = current_list
                });

                name_tab.Text = current_tab.TabName;

                switch (current_tab.TabContentType)
                {
                case ContentType.File:
                    int ModuleIDIcon = LanguagesHelper.GetModuleIDOfLangageType(current_tab.TabType);
                    TabIcon.Source = await ModulesAccessManager.GetModuleIconViaIDAsync(ModuleIDIcon, ModulesAccessManager.GetModuleViaID(ModuleIDIcon).ModuleSystem);

                    if (!string.IsNullOrEmpty(current_tab.PathContent))
                    {
                        path_tab.Text       = current_tab.PathContent;
                        encoding_file.Text  = Encoding.GetEncoding(current_tab.TabEncoding).EncodingName;
                        More_Tab.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        More_Tab.Visibility = Visibility.Collapsed;
                    }

                    TabsListGrid.Visibility = Visibility.Collapsed;
                    TabIcon.Visibility      = Visibility.Visible;
                    FolderIcon.Visibility   = Visibility.Collapsed;
                    StackInfos.Visibility   = Visibility.Visible;
                    break;

                case ContentType.Folder:
                    More_Tab.Visibility     = Visibility.Visible;
                    TabsListGrid.Visibility = Visibility.Visible;
                    StackInfos.Visibility   = Visibility.Collapsed;

                    TabIcon.Visibility    = Visibility.Collapsed;
                    FolderIcon.Visibility = Visibility.Visible;

                    if (TempTabID != current_tab.ID && TabsList.ListID != current_list)
                    {
                        ShowInfos.Begin();

                        TabsList.ListTabs.Items.Clear();
                        TempTabID       = current_tab.ID;
                        TabsList.ListID = current_list;
                        foreach (int ID in current_tab.FolderContent)
                        {
                            try
                            {
                                if (TabsAccessManager.GetTabViaID(new TabID {
                                    ID_Tab = ID, ID_TabsList = current_list
                                }) != null)
                                {
                                    TabsList.ListTabs.Items.Add(new TabID {
                                        ID_Tab = ID, ID_TabsList = current_list
                                    });
                                    if ((int)AppSettings.Values["Tabs_tab-selected-index"] == ID && (int)AppSettings.Values["Tabs_list-selected-index"] == current_list)
                                    {
                                        TabsList.ListTabs.SelectedIndex = TabsList.ListTabs.Items.Count - 1;
                                    }
                                }
                            }
                            catch { }
                        }
                    }

                    break;
                }
            }
            catch { }
        }