public void DeleteSelectedFiles(bool sendToRecycleBin = true) { StringCollection files = GetSelectedFilesStringCollection(); int fileCount = files.Count; RecycleOption recycleOption = sendToRecycleBin ? RecycleOption.SendToRecycleBin : RecycleOption.DeletePermanently; UIOption uiOption = fileCount == 1 ? UIOption.AllDialogs : UIOption.OnlyErrorDialogs; if (!sendToRecycleBin && fileCount > 1) { if (MessageBox.Show( String.Format(@"Are you sure that you want to permanently delete these {0} items?", fileCount), @"Delete Multiple Items", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) != DialogResult.Yes) { return; } } foreach (string fileInfo in files) { FileSystem.DeleteFile(fileInfo, uiOption, recycleOption); } RefreshFolder(); }
// Delete a file or move it to the recycle bin. public static void DeleteFile(string filename, bool confirm, bool delete_permanently) { UIOption ui_option = UIOption.OnlyErrorDialogs; if (confirm) { ui_option = UIOption.AllDialogs; } RecycleOption recycle_option = recycle_option = RecycleOption.SendToRecycleBin; if (delete_permanently) { recycle_option = RecycleOption.DeletePermanently; } try { Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(filename, ui_option, recycle_option); } catch (Exception ex) { Trace.WriteLine("Error deleting file.\n" + ex.ToString()); } }
public Post() { ViewCount = 0; Seo = new Seo(); UIOption = new UIOption(); ActivityLog = new ActivityLog(); }
public string GetUIOption(UIOption option) { if (option == UIOption.UseGameColours || option == UIOption.UseGameFont) { return("true"); } return(null); }
public void Set(UIOption option) { if (options.Contains(option)) { options[value].OnDeselect.Invoke(); option.OnSelect.Invoke(); value = options.IndexOf(option); } OnValueChange.Invoke(); }
public Property() { HasCarGarage = HasGarden = HasSwimming = false; NumberOfBathRoom = NumberOfBedRoom = NumberOfGarage = 0; OrderStatus = OrderStatus.InProcess; Seo = new Seo(); UIOption = new UIOption(); ActivityLog = new ActivityLog(); }
public void optionsSet(IEnumerable <Option> options) { optionsClear(); foreach (Option option in options) { UIOption uiOption = Instantiate <UIOption>(optionPrefab, transform); uiOption.optionSet(Option.Inherited(option)); } }
private void VerboseComboBoxSelectedIndexChanged(object sender, EventArgs e) { switch (VerboseComboBox.SelectedIndex) { case 0: VerboseOption = UIOption.AllDialogs; // 3 break; case 1: VerboseOption = UIOption.OnlyErrorDialogs; // 2 break; } }
public UpdatePostViewModels() { BasicInformation = new PostBasicInformation(); Avatar = new List <_ImageCropper>(); HeaderImage = new List <_ImageCropper>(); Seo = new Seo(); UIOption = new UIOption(); ActivityLog = new ActivityLog(); }
public static void DeleteFileOrFolder(string path, bool useRecycleBin, bool displayOnlyErrorDialogs) { UIOption uIOption = (displayOnlyErrorDialogs) ? UIOption.OnlyErrorDialogs : UIOption.AllDialogs; if (File.Exists(path) && !Directory.Exists(path)) { //delete file Microsoft.VisualBasic.FileIO.FileSystem.DeleteFile(path, uIOption, useRecycleBin ? RecycleOption.SendToRecycleBin : RecycleOption.DeletePermanently, UICancelOption.ThrowException); } else if (!File.Exists(path) && Directory.Exists(path)) { //delete folder Microsoft.VisualBasic.FileIO.FileSystem.DeleteDirectory(path, uIOption, useRecycleBin ? RecycleOption.SendToRecycleBin : RecycleOption.DeletePermanently, UICancelOption.ThrowException); } }
private void uiSymbolButton1_Click(object sender, System.EventArgs e) { var option = new UIOption(); //设置Title option.Title = new UITitle(); option.Title.Text = "SunnyUI"; option.Title.SubText = "Star"; option.Title.Left = UILeftAlignment.Center; //设置ToolTip option.ToolTip = new UIToolTip(); //设置Legend option.Legend = new UILegend(); option.Legend.Orient = Orient.Vertical; option.Legend.Top = UITopAlignment.Top; option.Legend.Left = UILeftAlignment.Left; option.Legend.AddData("2020-05-19"); option.Legend.AddData("2020-05-20"); option.Legend.AddData("2020-05-21"); option.Legend.AddData("2020-05-22"); option.Legend.AddData("2020-05-23"); option.Legend.AddData("2020-05-24"); option.Legend.AddData("2020-05-25"); //设置Series var series = new UISeries(); series.Name = "Star count"; series.Type = UISeriesType.Pie; series.Center = new UICenter(50, 55); series.Radius = 70; //增加数据 series.AddData("2020-05-19", 38); series.AddData("2020-05-20", 21); series.AddData("2020-05-21", 11); series.AddData("2020-05-22", 52); series.AddData("2020-05-23", 23); series.AddData("2020-05-24", 26); series.AddData("2020-05-25", 27); //增加Series option.Series.Add(series); //设置Option PieChart.SetOption(option); }
private void OnedriveButton_Click(object sender, EventArgs e) { ModifyRegistry.ModifyRegistry userShellFolders = new ModifyRegistry.ModifyRegistry(Registry.CurrentUser, @"Microsoft", @"Windows\CurrentVersion\Explorer\User Shell Folders"); ModifyRegistry.ModifyRegistry onedriveFolder = new ModifyRegistry.ModifyRegistry(Registry.CurrentUser, @"Microsoft", @"Onedrive\Accounts\Business1"); string oneDriveDesktopPath = onedriveFolder.ReadString("UserFolder") + @"\Desktop\"; string oneDriveDocumentsPath = onedriveFolder.ReadString(@"UserFolder") + @"\Documents\"; string desktopShellPath = userShellFolders.ReadString(@"{754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5}") + @"\"; string documentsShellPath = userShellFolders.ReadString(@"Personal") + @"\"; try { if (@desktopShellPath != @oneDriveDesktopPath) { UIOption showUI = UIOption.AllDialogs; UICancelOption onUserCancel = UICancelOption.ThrowException; FileSystem.CopyDirectory(@desktopShellPath, @oneDriveDesktopPath, showUI, onUserCancel); } } catch (Exception dMoveEx) { MessageBox.Show(dMoveEx.Message + dMoveEx.TargetSite); } userShellFolders.WriteString(@"{754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5}", @oneDriveDesktopPath.TrimEnd(char.Parse(@"\"))); userShellFolders.WriteString(@"Desktop", @oneDriveDesktopPath.TrimEnd(char.Parse(@"\"))); try { if (documentsShellPath != oneDriveDocumentsPath) { UIOption showUI = UIOption.AllDialogs; UICancelOption onUserCancel = UICancelOption.ThrowException; FileIOPermission f = new FileIOPermission(PermissionState.Unrestricted); f.AllFiles = FileIOPermissionAccess.AllAccess; FileSystem.CopyDirectory(documentsShellPath, oneDriveDocumentsPath, showUI, onUserCancel); } } catch (Exception dMoveEx) { MessageBox.Show(dMoveEx.Message); } userShellFolders.WriteString(@"Personal", oneDriveDocumentsPath.TrimEnd(char.Parse(@"\"))); RestartProcess.RestartProcessByFileName("explorer"); UpdateOnedriveInfo(); }
private void companyLinks_Click(object sender, EventArgs e) { UIOption showUI = UIOption.AllDialogs; UICancelOption onUserCancel = UICancelOption.ThrowException; try { FileSystem.CopyDirectory(@"Company Links", @"C:\Users\Default\Desktop\Company Links", showUI, onUserCancel); FileSystem.CopyDirectory(@"Company Links", @"C:\Users\" + Environment.UserName + @"\Desktop\Company Links", showUI, onUserCancel); } catch (Exception ee) { MessageBox.Show(ee.Message); } }
void Awake() { mInstance = this; SoundVolume = SystemSettingData.Instance.SoundVolume; MusicVolume = SystemSettingData.Instance.MusicVolume; DialogVolume = SystemSettingData.Instance.DialogVolume; EffectVolume = SystemSettingData.Instance.EffectVolume; mCamSMin.text = CamSMin.ToString(); mCamSMax.text = CamSMax.ToString(); mCameraFOVMin.text = CamFOVMin.ToString(); mCameraFOVMax.text = CamFOVMax.ToString(); mCamInertiaMin.text = CamInertiaMin.ToString(); mCamInertiaMax.text = CamInertiaMax.ToString(); OnVideoBtn(); }
/// <summary> /// 폴더를 삭제 합니다. /// </summary> /// <param name="path">파일 패스</param> /// <param name="showDialog">삭제확인 표시 문구 표시 여부</param> /// <param name="SendToRecycleBin"></param> /// <returns>작업 취소 여부 true:처리 / false:취소</returns> public static bool DeleteFolder(string path, bool showDialog, bool SendToRecycleBin) { UIOption uiopt = showDialog ? UIOption.AllDialogs : UIOption.OnlyErrorDialogs; RecycleOption rOption = SendToRecycleBin ? RecycleOption.SendToRecycleBin : RecycleOption.DeletePermanently; try { FileSystem.DeleteDirectory(path, uiopt, rOption); } catch (OperationCanceledException) { return(false); } catch (Exception ex) { throw ex; } return(true); }
/// <summary> /// Capture the delete key in the list view. /// Will delete the selected item /// </summary> /// <param name = "msg"></param> /// <param name = "keyData"></param> /// <returns></returns> protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.Delete) { if (listViewNonMusicFiles.SelectedItems.Count > 0 && !_inLabeledit) { UIOption dialogOption = UIOption.AllDialogs; if (listViewNonMusicFiles.SelectedItems.Count > 1) { // Don't display the "do you want to delete..." for multiple files dialogOption = UIOption.OnlyErrorDialogs; string dialogMsg = string.Format(localisation.ToString("main", "NonMusicDeleteFilesMessage"), listViewNonMusicFiles.SelectedItems.Count); if ( MessageBox.Show(dialogMsg, localisation.ToString("main", "NonMusicDeleteFilesHeader"), MessageBoxButtons.YesNo) == DialogResult.No) { return(false); } } foreach (ListViewItem item in listViewNonMusicFiles.SelectedItems) { try { FileSystem.DeleteFile((string)item.Tag, dialogOption, RecycleOption.SendToRecycleBin, UICancelOption.ThrowException); listViewNonMusicFiles.Items[item.Index].Remove(); } catch (OperationCanceledException) // User pressed No on delete. Do nothing {} catch (Exception ex) { log.Error("Error deleting file: {0} Exception: {1}", (string)item.Tag, ex.Message); } } } } return(base.ProcessCmdKey(ref msg, keyData)); }
public PostLabel() { Seo = new Seo(); UIOption = new UIOption(); ActivityLog = new ActivityLog(); }
public void DeleteFile(string file, UIOption showUI, RecycleOption recycle, UICancelOption onUserCancel) { FileSystem.DeleteFile(file, showUI, recycle, onUserCancel); }
public void PerformTask(TaskDetail taskDetail, UIOption Verbose = UIOption.OnlyErrorDialogs) { try { int TotalCount = 0, CurrentCount = 0; string FileName, FileExtension, FileNewName; taskDetail(-1, 0, "", "", ""); // Loading... List <FileInfo> FileInfoList = new List <FileInfo>(Source.GetFiles()); FileInfoList = FileInfoList.FindAll(delegate(FileInfo fileInfoObject) { return(ExtensionRegex.IsMatch(fileInfoObject.Extension.ToLower()) && NameRegex.IsMatch(Path.GetFileNameWithoutExtension(fileInfoObject.Name))); }); TotalCount = FileInfoList.Count; List <Tuple <FileInfo, IEnumerable <FileTag> > > FileList = new List <Tuple <FileInfo, IEnumerable <FileTag> > >(); if (AttributeMatchList != null) { IEnumerable <FileTag> FileTagInfoList, FileTagInfoListIntersected; foreach (FileInfo FileInfoObject in FileInfoList) { FileTagInfoList = GenerateFileInfo.GetFileTag(FileInfoObject.FullName); FileTagInfoListIntersected = FileTagInfoList; FileTagInfoListIntersected = FileTagInfoListIntersected.Intersect(AttributeMatchList); if (FileTagInfoListIntersected.Count() > 0) { FileList.Add(new Tuple <FileInfo, IEnumerable <FileTag> >(FileInfoObject, FileTagInfoList)); } } } else { foreach (FileInfo FileInfoObject in FileInfoList) { FileList.Add(new Tuple <FileInfo, IEnumerable <FileTag> >(FileInfoObject, GenerateFileInfo.GetFileTag(FileInfoObject.FullName))); } } TotalCount = FileList.Count; CurrentCount = 0; taskDetail(TotalCount, 0, "", "", ""); // Loading Done... foreach (Tuple <FileInfo, IEnumerable <FileTag> > FileListObject in FileList) { FileName = Path.GetFileNameWithoutExtension(FileListObject.Item1.Name); FileExtension = Path.GetExtension(FileListObject.Item1.Name); FileNewName = GetFormattedName(FileName, FileListObject.Item2); taskDetail(TotalCount, CurrentCount, FileName, FileExtension, FileNewName); switch (PerformType) { case PerformTaskType.Copy: FileSystem.CopyFile(FileListObject.Item1.FullName, Destination + "/" + FileNewName + FileExtension, Verbose); break; case PerformTaskType.Move: FileSystem.MoveFile(FileListObject.Item1.FullName, Destination + "/" + FileNewName + FileExtension, Verbose); break; case PerformTaskType.Rename: FileSystem.RenameFile(FileListObject.Item1.FullName, FileNewName + FileExtension); break; case PerformTaskType.Delete: FileSystem.DeleteFile(FileListObject.Item1.FullName, Verbose, RecycleOption.SendToRecycleBin); break; default: Log.Write("PerformTask() Warning -> Invalid PerformType Given In " + Name); break; } taskDetail(TotalCount, ++CurrentCount, FileName, FileExtension, FileNewName); } } catch (Exception ex) { Log.Write("Task::PerformTask() Error -> Task - " + Name + " [" + ex.Message + "]"); } }
public void CopyFile(string sourceFileName, string destinationFileName, UIOption showUI, UICancelOption onUserCancel) { FileSystem.CopyFile(sourceFileName, destinationFileName, showUI, onUserCancel); }
public void DeleteDirectory(string directory, UIOption showUI, RecycleOption recycle, UICancelOption onUserCancel) { FileSystem.DeleteDirectory(directory, showUI, recycle, onUserCancel); }
public void PerformTask(TaskDetail taskDetail, UIOption Verbose = UIOption.OnlyErrorDialogs) { try { int TotalCount = 0, CurrentCount = 0; string FileName, FileExtension, FileNewName; taskDetail(-1, 0, "", "", ""); // Loading... List<FileInfo> FileInfoList = new List<FileInfo>(Source.GetFiles()); FileInfoList = FileInfoList.FindAll(delegate (FileInfo fileInfoObject) { return ExtensionRegex.IsMatch(fileInfoObject.Extension.ToLower()) && NameRegex.IsMatch(Path.GetFileNameWithoutExtension(fileInfoObject.Name)); }); TotalCount = FileInfoList.Count; List<Tuple<FileInfo, IEnumerable<FileTag>>> FileList = new List<Tuple<FileInfo, IEnumerable<FileTag>>>(); if (AttributeMatchList != null) { IEnumerable<FileTag> FileTagInfoList, FileTagInfoListIntersected; foreach (FileInfo FileInfoObject in FileInfoList) { FileTagInfoList = GenerateFileInfo.GetFileTag(FileInfoObject.FullName); FileTagInfoListIntersected = FileTagInfoList; FileTagInfoListIntersected = FileTagInfoListIntersected.Intersect(AttributeMatchList); if (FileTagInfoListIntersected.Count() > 0) FileList.Add(new Tuple<FileInfo, IEnumerable<FileTag>>(FileInfoObject, FileTagInfoList)); } } else { foreach (FileInfo FileInfoObject in FileInfoList) FileList.Add(new Tuple<FileInfo, IEnumerable<FileTag>>(FileInfoObject, GenerateFileInfo.GetFileTag(FileInfoObject.FullName))); } TotalCount = FileList.Count; CurrentCount = 0; taskDetail(TotalCount, 0, "", "", ""); // Loading Done... foreach (Tuple<FileInfo, IEnumerable<FileTag>> FileListObject in FileList) { FileName = Path.GetFileNameWithoutExtension(FileListObject.Item1.Name); FileExtension = Path.GetExtension(FileListObject.Item1.Name); FileNewName = GetFormattedName(FileName, FileListObject.Item2); taskDetail(TotalCount, CurrentCount, FileName, FileExtension, FileNewName); switch (PerformType) { case PerformTaskType.Copy: FileSystem.CopyFile(FileListObject.Item1.FullName, Destination + "/" + FileNewName + FileExtension, Verbose); break; case PerformTaskType.Move: FileSystem.MoveFile(FileListObject.Item1.FullName, Destination + "/" + FileNewName + FileExtension, Verbose); break; case PerformTaskType.Rename: FileSystem.RenameFile(FileListObject.Item1.FullName, FileNewName + FileExtension); break; case PerformTaskType.Delete: FileSystem.DeleteFile(FileListObject.Item1.FullName, Verbose, RecycleOption.SendToRecycleBin); break; default: Log.Write("PerformTask() Warning -> Invalid PerformType Given In " + Name); break; } taskDetail(TotalCount, ++CurrentCount, FileName, FileExtension, FileNewName); } } catch (Exception ex) { Log.Write("Task::PerformTask() Error -> Task - " + Name + " [" + ex.Message + "]"); } }
public void CopyDirectory(string sourceDirectoryName, string destinationDirectoryName, UIOption showUI, UICancelOption onUserCancel) { FileSystem.CopyDirectory(sourceDirectoryName, destinationDirectoryName, showUI, onUserCancel); }
public static void DeleteFile(string file, UIOption showUI, RecycleOption recycle) { DeleteFileInternal(file, ToUIOptionInternal(showUI), recycle, UICancelOption.ThrowException); }
public void CopyFile(string sourceFileName, string destinationFileName, UIOption showUI) { FileSystem.CopyFile(sourceFileName, destinationFileName, showUI); }
public void CopyDirectory(string sourceDirectoryName, string destinationDirectoryName, UIOption showUI) { FileSystem.CopyDirectory(sourceDirectoryName, destinationDirectoryName, showUI); }
public static void DeleteFile(string file, UIOption showUI, RecycleOption recycle, UICancelOption onUserCancel) { DeleteFileInternal(file, ToUIOptionInternal(showUI), recycle, onUserCancel); }
public string GetUIOption(UIOption option) { return null; }
public void DeleteFile(string file, UIOption showUI, RecycleOption recycle) { FileSystem.DeleteFile(file, showUI, recycle); }
public string GetUIOption(UIOption option) { return("true"); }
public static void DeleteDirectory(string directory, UIOption showUI, RecycleOption recycle, UICancelOption onUserCancel) { DeleteDirectoryInternal(directory, DeleteDirectoryOption.DeleteAllContents, ToUIOptionInternal(showUI), recycle, onUserCancel); }
public PropertyType() { UIOption = new UIOption(); }
public void DeleteDirectory(string directory, UIOption showUI, RecycleOption recycle) { FileSystem.DeleteDirectory(directory, showUI, recycle); }
public static void CopyDirectory(string sourceDirectoryName, string destinationDirectoryName, UIOption showUI, UICancelOption onUserCancel) { CopyOrMoveDirectory(CopyOrMove.Copy, sourceDirectoryName, destinationDirectoryName, false, ToUIOptionInternal(showUI), onUserCancel); }
public static void MoveFile(string sourceFileName, string destinationFileName, UIOption showUI, UICancelOption onUserCancel) { CopyOrMoveFile(CopyOrMove.Move, sourceFileName, destinationFileName, false, ToUIOptionInternal(showUI), onUserCancel); }
public string GetUIOption(UIOption option) { return(null); }
public static void CopyFile(string sourceFileName, string destinationFileName, UIOption showUI) { CopyOrMoveFile(CopyOrMove.Copy, sourceFileName, destinationFileName, false, ToUIOptionInternal(showUI), UICancelOption.ThrowException); }
public string GetUIOption(string optionName) { UIOption option = (UIOption)Enum.Parse(typeof(UIOption), optionName); return(m_worldModel.PlayerUI.GetUIOption(option)); }
private static UIOptionInternal ToUIOptionInternal(UIOption showUI) { switch (showUI) { case UIOption.OnlyErrorDialogs: return UIOptionInternal.OnlyErrorDialogs; case UIOption.AllDialogs: return UIOptionInternal.AllDialogs; } throw new InvalidEnumArgumentException("showUI", (int) showUI, typeof(UIOption)); }
public static void MoveDirectory(string sourceDirectoryName, string destinationDirectoryName, UIOption showUI) { CopyOrMoveDirectory(CopyOrMove.Move, sourceDirectoryName, destinationDirectoryName, false, ToUIOptionInternal(showUI), UICancelOption.ThrowException); }