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; } }
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; } }