示例#1
0
        private async void More_Tab_Click(object sender, RoutedEventArgs e)
        {
            if (infos_opened)
            {
                RemoveInfos.Begin(); infos_opened = false;
            }
            else
            {
                enable_selection = false;
                try
                {
                    StorageFile file = await StorageFile.GetFileFromPathAsync(current_tab.PathContent);

                    BasicProperties properties = await file.GetBasicPropertiesAsync();

                    if (properties.Size != 0)
                    {
                        if (properties.Size > 1024f) //Ko
                        {
                            size_file.Text = String.Format("{0:0.00}", (properties.Size / 1024f)) + " Ko";

                            if ((properties.Size / 1024f) > 1024f) //Mo
                            {
                                size_file.Text = String.Format("{0:0.00}", ((properties.Size / 1024f) / 1024f)) + " Mo";
                            }
                        }
                        else //Octect
                        {
                            size_file.Text = properties.Size + " Octect(s)";
                        }
                    }

                    modified_file.Text = properties.DateModified.ToString();
                    created_file.Text  = file.DateCreated.ToString();
                }
                catch { }

                ShowInfos.Begin(); infos_opened = true; enable_selection = true;
            }
        }
示例#2
0
        private async void More_Tab_Click(object sender, RoutedEventArgs e)
        {
            if (infos_opened)
            {
                RemoveInfos.Begin(); infos_opened = false;

                if (current_tab.TabContentType == ContentType.Folder)
                {
                    current_tab.FolderOpened = false;
                    await TabsWriteManager.PushUpdateTabAsync(current_tab, current_list, false);
                }
            }
            else
            {
                enable_selection = false;

                switch (current_tab.TabContentType)
                {
                case ContentType.File:
                    try
                    {
                        list_types.SelectedItem = LanguagesHelper.GetLanguageNameViaType(current_tab.TabType);

                        bool ItemFound = false; int EncodingCodepage = Encoding.GetEncoding(current_tab.TabEncoding).CodePage;
                        for (int i = 0; i < (list_encodings.Items.Count - 1); i++)
                        {
                            if (((EncodingType)list_encodings.Items[i]).EncodingCodepage == EncodingCodepage && ((EncodingType)list_encodings.Items[i]).EncodingBOM == current_tab.TabEncodingWithBOM)
                            {
                                list_encodings.SelectedIndex = i;
                                ItemFound = true;
                                break;
                            }
                        }

                        if (!ItemFound)
                        {
                            list_encodings.Items.Insert(0, new EncodingType {
                                EncodingName = Encoding.GetEncoding(current_tab.TabEncoding).EncodingName, EncodingCodepage = Encoding.GetEncoding(current_tab.TabEncoding).CodePage
                            });
                            list_encodings.SelectedIndex = 0;
                        }

                        switch (current_tab.TabStorageMode)
                        {
                        case StorageListTypes.LocalStorage:
                            StorageFile file = await StorageFile.GetFileFromPathAsync(current_tab.TabOriginalPathContent);

                            BasicProperties properties = await file.GetBasicPropertiesAsync();

                            if (properties.Size != 0)
                            {
                                if (properties.Size > 1024f)         //Ko
                                {
                                    size_file.Text = string.Format("{0:0.00}", (properties.Size / 1024f)) + " Ko";

                                    if ((properties.Size / 1024f) > 1024f)         //Mo
                                    {
                                        size_file.Text = string.Format("{0:0.00}", ((properties.Size / 1024f) / 1024f)) + " Mo";
                                    }
                                }
                                else         //Octect
                                {
                                    size_file.Text = properties.Size + " Octect(s)";
                                }
                            }

                            modified_file.Text = properties.DateModified.ToString();
                            created_file.Text  = file.DateCreated.ToString();
                            break;

                        case StorageListTypes.OneDrive:
                            if (await OneDriveAuthHelper.OneDriveAuthentification())
                            {
                                var Item = await TabsDataCache.OneDriveClient.Drive.Items[current_tab.TabOriginalPathContent].Request().GetAsync();

                                if (Item.Size != 0)
                                {
                                    if (Item.Size > 1024f)         //Ko
                                    {
                                        size_file.Text = string.Format("{0:0.00}", (Item.Size / 1024f)) + " Ko";

                                        if ((Item.Size / 1024f) > 1024f)         //Mo
                                        {
                                            size_file.Text = string.Format("{0:0.00}", ((Item.Size / 1024f) / 1024f)) + " Mo";
                                        }
                                    }
                                    else         //Octect
                                    {
                                        size_file.Text = Item.Size + " Octect(s)";
                                    }
                                }

                                modified_file.Text = Item.LastModifiedDateTime.ToString();
                                created_file.Text  = Item.CreatedDateTime.ToString();

                                //path_tab.Text = System.Net.WebUtility.HtmlDecode(Item.ParentReference.Path);
                            }
                            break;
                        }
                    }
                    catch { }

                    break;

                case ContentType.Folder:
                    current_tab.FolderOpened = true;
                    await TabsWriteManager.PushUpdateTabAsync(current_tab, current_list, false);

                    break;
                }

                ShowInfos.Begin(); infos_opened = true; enable_selection = true;
            }
        }
示例#3
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 { }
        }
示例#4
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 { }
        }