コード例 #1
0
        private async void UpdateTabInformations()
        {
            //Set temp tab + tabs list ID
            try
            {
                current_tab = await TabsAccessManager.GetTabViaIDAsync(new TabID { ID_Tab = current_tab.ID, ID_TabsList = current_list });

                foreach (CoreApplicationView view in CoreApplication.Views)
                {
                    if (current_tab.TabName.Length >= 4)
                    {
                        Extension_tab.Text = current_tab.TabName.Substring(0, 4);
                    }
                    else
                    {
                        Extension_tab.Text = current_tab.TabType.ToUpper();
                    }

                    name_tab.Text = current_tab.TabName;

                    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;
                    }
                }
            }
            catch { }
        }
コード例 #2
0
        private async void Tabs_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (Tabs.SelectedItem != null)
            {
                if (((TabID)Tabs.SelectedItem).ID_Tab != GlobalVariables.CurrentIDs.ID_Tab)
                {
                    CurrentSelectedIDs = (TabID)Tabs.SelectedItem;
                    var tab = await TabsAccessManager.GetTabViaIDAsync(CurrentSelectedIDs);

                    int    EncodingType = tab.TabEncoding;
                    string TabType      = "";

                    if (EncodingType == 0)
                    {
                        EncodingType = Encoding.UTF8.CodePage;
                    }

                    if (string.IsNullOrEmpty(tab.TabType))
                    {
                        TabType = "TXT";
                    }
                    else
                    {
                        TabType = tab.TabType.ToUpper();
                    }

                    if (tab != null)
                    {
                        Messenger.Default.Send(new TabSelectedNotification {
                            tabID = CurrentSelectedIDs.ID_Tab, tabsListID = CurrentSelectedIDs.ID_TabsList, code = await TabsAccessManager.GetTabContentViaIDAsync(CurrentSelectedIDs), contactType = ContactTypeSCEE.SetCodeForEditor, typeLanguage = TabType, typeCode = Encoding.GetEncoding(EncodingType).EncodingName
                        });
                    }

                    AppSettings.Values["Tabs_tab-selected-index"]  = ((TabID)Tabs.SelectedItem).ID_Tab;
                    AppSettings.Values["Tabs_list-selected-index"] = ((TabID)Tabs.SelectedItem).ID_TabsList;
                }
            }
        }