private void fileDrop(object sender, FileDropEventArgs e) { var filePaths = new[] { e.FileName }; var firstExtension = Path.GetExtension(filePaths.First()); if (filePaths.Any(f => Path.GetExtension(f) != firstExtension)) { return; } Task.Factory.StartNew(() => Import(filePaths), TaskCreationOptions.LongRunning); }
protected override void OnFileDrop(FileDropEventArgs e) { if (World.IsValidFile(e.FileName)) { Game game = new Game(World.LoadFromFile(e.FileName, false)); game.OnExit += () => { game.World.SaveToFile(e.FileName, false); SceneManager.LoadScene(new Transition(new MainMenu(), 10)); }; SceneManager.LoadScene(new Transition(game, 10)); } }
private void fileDrop(object _, FileDropEventArgs args) { foreach (var path in args.FileNames) { try { File.Copy(path, Path.Combine(_pagesPath, Path.GetFileName(path))); } catch (Exception e) { Logger.Error(e, "fileDrop failed"); } } }
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { foreach (string droppedFileName in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(droppedFileName).ToUpper(); if (MeshFileIo.ValidFileExtensions().Contains(extension)) { meshViewerWidget.LoadMesh(droppedFileName, MeshVisualizer.MeshViewerWidget.CenterPartAfterLoad.DO); break; } } base.OnDragDrop(fileDropEventArgs); }
public override void OnDragOver(FileDropEventArgs fileDropEventArgs) { foreach (string file in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(file).ToUpper(); if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension)) || extension == ".GCODE" || extension == ".ZIP") { fileDropEventArgs.AcceptDrop = true; } } base.OnDragOver(fileDropEventArgs); }
internal static void DragFile(object sender, FileDropEventArgs e) { int n = Files.Length; Array.Resize(ref Files, n + 1); Files[n] = e.FileName; // reset LightingRelative = -1.0; Game.Reset(); RefreshObjects(); Renderer.InitializeVisibility(); Renderer.UpdateVisibility(0.0, true); ObjectManager.UpdateAnimatedWorldObjects(0.01, true); Renderer.ApplyBackgroundColor(); }
void FileDrop(object?sender, FileDropEventArgs args) { var window = (Window?)sender ?? throw new InvalidOperationException(); var builder = new System.Text.StringBuilder(); builder.Append(args.Position); builder.Append(":\n"); foreach (var path in args.Paths) { builder.Append(" - '"); builder.Append(path); builder.Append("'\n"); } entries.Add(new LogEntry { label = window.Title, type = "FileDrop ", message = builder.ToString() }); }
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { foreach (string droppedFileName in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(droppedFileName).ToUpper(); if (extension == ".STL" || extension == ".GCODE") { PrintQueueItem queueItem = new PrintQueueItem(System.IO.Path.GetFileNameWithoutExtension(droppedFileName), System.IO.Path.GetFullPath(droppedFileName)); PrintQueueControl.Instance.AddChild(queueItem); } PrintQueueControl.Instance.EnsureSelection(); PrintQueueControl.Instance.Invalidate(); } PrintQueueControl.Instance.SaveDefaultQueue(); base.OnDragDrop(fileDropEventArgs); }
private void fileDrop(object sender, FileDropEventArgs e) { var filePaths = new [] { e.FileName }; if (filePaths.All(f => Path.GetExtension(f) == @".osz")) { Task.Factory.StartNew(() => BeatmapManager.Import(filePaths), TaskCreationOptions.LongRunning); } else if (filePaths.All(f => Path.GetExtension(f) == @".osr")) { Task.Run(() => { var score = ScoreStore.ReadReplayFile(filePaths.First()); Schedule(() => LoadScore(score)); }); } }
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { foreach (string droppedFileName in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(droppedFileName).ToUpper(); if (extension == ".STL" || extension == ".GCODE") { PrintItem printItem = new PrintItem(); printItem.Name = Path.GetFileNameWithoutExtension(droppedFileName); printItem.FileLocation = Path.GetFullPath(droppedFileName); printItem.PrintItemCollectionID = LibraryData.Instance.LibraryCollection.Id; printItem.Commit(); LibraryData.Instance.AddItem(new PrintItemWrapper(printItem)); } } base.OnDragDrop(fileDropEventArgs); }
private void scintillaCode_FileDrop(object sender, FileDropEventArgs e) { try { this.Cursor = Cursors.WaitCursor; if (e.FileNames.Length > 0) { this.OpenInputFile(e.FileNames[0]); } } catch (Exception exception) { new ExceptionDialog(exception, "Error Generating CodeDom").ShowDialog(); } finally { this.Cursor = Cursors.Default; } }
protected void OnDropFiles(FrameworkElement target, FileDropEventArgs e) { if (target == null) { return; } var input = (target as ItemsControl).InputHitTest(e.DropPoint) as FrameworkElement; AppInfo appInfo = null; if (input != null) { var appInfoView = input.DataContext as AppInfoView; if (appInfoView != null) { appInfo = appInfoView.Source; } } //File dropped on app, so start it with such argument if ((e.KeyState & DragDropKeyStates.AltKey) == DragDropKeyStates.AltKey) { if (appInfo != null) { _Controller.WorkItem.Commands.RunApp.Execute( new AppStartParams(appInfo) { Args = "\"" + e.Files[0] + "\"" } ); } } else // add new application { var appType = target.DataContext as AppTypeView; if (appType == null) { return; } _Controller.AddFiles(appType.Source, appInfo, e.Files); } }
public override void OnDragEnter(FileDropEventArgs fileDropEventArgs) { if (libraryDataView != null && libraryDataView.CurrentLibraryProvider != null && !libraryDataView.CurrentLibraryProvider.IsProtected()) { foreach (string file in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(file).ToUpper(); if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension)) || extension == ".GCODE" || extension == ".ZIP") { fileDropEventArgs.AcceptDrop = true; } } } base.OnDragEnter(fileDropEventArgs); }
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { foreach (string droppedFileName in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(droppedFileName).ToUpper(); if (extension == ".STL" || extension == ".GCODE") { PrintItem printItem = new PrintItem(); printItem.Name = System.IO.Path.GetFileNameWithoutExtension(droppedFileName); printItem.FileLocation = System.IO.Path.GetFullPath(droppedFileName); printItem.PrintItemCollectionID = ToolsListControl.Instance.LibraryCollection.Id; printItem.Commit(); ToolsListItem queueItem = new ToolsListItem(new PrintItemWrapper(printItem)); ToolsListControl.Instance.AddChild(queueItem); } ToolsListControl.Instance.Invalidate(); } ToolsListControl.Instance.SaveLibraryItems(); base.OnDragDrop(fileDropEventArgs); }
internal static void DragFile(object sender, FileDropEventArgs e) { int n = Files.Length; Array.Resize <string>(ref Files, n + 1); Files[n] = e.FileName; // reset ReducedMode = false; LightingRelative = -1.0; Game.Reset(); TextureManager.UnuseAllTextures(); Fonts.Initialize(); Interface.ClearMessages(); for (int i = 0; i < Files.Length; i++) { #if !DEBUG try { #endif ObjectManager.UnifiedObject o = ObjectManager.LoadObject(Files[i], System.Text.Encoding.UTF8, ObjectManager.ObjectLoadMode.Normal, false, false, false); ObjectManager.CreateObject(o, new Vector3(0.0, 0.0, 0.0), new World.Transformation(0.0, 0.0, 0.0), new World.Transformation(0.0, 0.0, 0.0), true, 0.0, 0.0, 25.0, 0.0); #if !DEBUG } catch (Exception ex) { Interface.AddMessage(Interface.MessageType.Critical, false, "Unhandled error (" + ex.Message + ") encountered while processing the file " + Files[i] + "."); } #endif } ObjectManager.InitializeVisibility(); ObjectManager.FinishCreatingObjects(); ObjectManager.UpdateVisibility(0.0, true); ObjectManager.UpdateAnimatedWorldObjects(0.01, true); }
public override void OnDragOver(FileDropEventArgs fileDropEventArgs) { base.OnDragOver(fileDropEventArgs); if (!fileDropEventArgs.AcceptDrop) { // no child has accepted the drop foreach (string file in fileDropEventArgs.DroppedFiles) { string extension = Path.GetExtension(file).ToUpper(); if ((extension != "" && MeshFileIo.ValidFileExtensions().Contains(extension)) || extension == ".GCODE" || extension == ".ZIP") { fileDropEventArgs.AcceptDrop = true; } } dropWasOnChild = false; } else { dropWasOnChild = true; } }
public static void OnFileDropped(object sender, FileDropEventArgs args) { if (!(Screen.Selected is { } screen)) { return; } string filePath = args.FilePath; if (string.IsNullOrWhiteSpace(filePath)) { return; } string extension = Path.GetExtension(filePath).ToLower(); System.IO.FileInfo info = new System.IO.FileInfo(args.FilePath); if (!info.Exists) { return; } screen.OnFileDropped(filePath, extension); }
protected override void OnFileDrop(FileDropEventArgs e) { LoadFileFormat(e.FileName); }
public void ImportSongs(object sender, FileDropEventArgs e) { ImportPaths(e.FileName); }
private void importSongs(object sender, FileDropEventArgs args) => loader.ImportSongs(sender, args);
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { DoAddFiles(fileDropEventArgs.DroppedFiles); base.OnDragDrop(fileDropEventArgs); }
/// <summary> /// Invoked when files are dropped on a track list /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void TrackList_FilesDropped(object sender, FileDropEventArgs e) { ViewDetails vd = GetCurrentTrackList(); if (vd == null || vd == HistoryTracks) return; foreach (string path in e.Paths) { if (Directory.Exists(path) || MediaManager.IsSupported(path)) { // create callback params List<object> l = new List<object>(); l.Add(vd as object); l.Add(e as object); l.Add(path as object); if (FilesystemManager.PathIsAdded(path)) TrackList_MoveNewlyAdded(l as object); else FilesystemManager.AddSource(path, TrackList_MoveNewlyAdded, l as object); } } }
internal static void DragFile(object sender, FileDropEventArgs e) { int n = Files.Length; Array.Resize <string>(ref Files, n + 1); Files[n] = e.FileName; // reset ReducedMode = false; LightingRelative = -1.0; Game.Reset(); Textures.UnloadAllTextures(); //Fonts.Initialize(); Interface.ClearMessages(); for (int i = 0; i < Files.Length; i++) { #if !DEBUG try { #endif if (String.Compare(System.IO.Path.GetFileName(Files[i]), "extensions.cfg", StringComparison.OrdinalIgnoreCase) == 0) { UnifiedObject[] carObjects; UnifiedObject[] bogieObjects; TrainManager.Train train; double[] axleLocations; ExtensionsCfgParser.ParseExtensionsConfig(Files[i], System.Text.Encoding.UTF8, out carObjects, out bogieObjects, out axleLocations, out train, true); if (axleLocations.Length == 0) { axleLocations = new double[train.Cars.Length * 2]; for (int j = 0; j < train.Cars.Length; j++) { double ap = train.Cars.Length * 0.4; axleLocations[j] = ap; j++; axleLocations[j] = -ap; } } double z = 0.0; for (int j = 0; j < carObjects.Length; j++) { ObjectManager.CreateObject(carObjects[j], new Vector3(0.0, 0.0, z), new Transformation(0.0, 0.0, 0.0), new Transformation(0.0, 0.0, 0.0), true, 0.0, 0.0, 25.0, 0.0); if (j < train.Cars.Length - 1) { z -= (train.Cars[j].Length + train.Cars[j + 1].Length) / 2; } } z = 0.0; for (int j = 0; j < bogieObjects.Length; j++) { ObjectManager.CreateObject(bogieObjects[j], new Vector3(0.0, 0.0, z + axleLocations[j]), new Transformation(0.0, 0.0, 0.0), new Transformation(0.0, 0.0, 0.0), true, 0.0, 0.0, 25.0, 0.0); j++; ObjectManager.CreateObject(bogieObjects[j], new Vector3(0.0, 0.0, z - axleLocations[j]), new Transformation(0.0, 0.0, 0.0), new Transformation(0.0, 0.0, 0.0), true, 0.0, 0.0, 25.0, 0.0); if (j < train.Cars.Length - 1) { z -= (train.Cars[j].Length + train.Cars[j + 1].Length) / 2; } } } else { UnifiedObject o = ObjectManager.LoadObject(Files[i], System.Text.Encoding.UTF8, false, false, false); ObjectManager.CreateObject(o, Vector3.Zero, new Transformation(0.0, 0.0, 0.0), new Transformation(0.0, 0.0, 0.0), true, 0.0, 0.0, 25.0, 0.0); } #if !DEBUG } catch (Exception ex) { Interface.AddMessage(MessageType.Critical, false, "Unhandled error (" + ex.Message + ") encountered while processing the file " + Files[i] + "."); } #endif } ObjectManager.InitializeVisibility(); ObjectManager.FinishCreatingObjects(); ObjectManager.UpdateVisibility(0.0, true); ObjectManager.UpdateAnimatedWorldObjects(0.01, true); }
protected void Scintilla_FileDrop(object sender, FileDropEventArgs e) { foreach (string file in e.FileNames) _mainForm.LoadDocumentIntoWindow(file, true); }
private void scintilla1_FileDrop(object sender, FileDropEventArgs e) { OpenFile(e.FileNames[0]); }
protected override void OnFileDrop(FileDropEventArgs e) { base.OnFileDrop(e); }
/// <summary> /// Raises the <see cref="FileDrop"/> event. /// </summary> /// <param name="e"> /// A <see cref="FileDropEventArgs"/> instance carrying file name. /// The information carried by this instance is only valid within this method body. /// </param> protected virtual void OnFileDrop(FileDropEventArgs e) { FileDrop(this, e); }
private void OnFileDropInternal(object sender, FileDropEventArgs e) { OnFileDrop(e); }
internal static void DragFile(object sender, FileDropEventArgs e) { int n = Files.Length; Array.Resize <string>(ref Files, n + 1); Files[n] = e.FileName; // reset ReducedMode = false; LightingRelative = -1.0; Game.Reset(); Renderer.TextureManager.UnloadAllTextures(); //Fonts.Initialize(); Interface.ClearMessages(); for (int i = 0; i < Files.Length; i++) { #if !DEBUG try { #endif if (String.Compare(System.IO.Path.GetFileName(Files[i]), "extensions.cfg", StringComparison.OrdinalIgnoreCase) == 0) { UnifiedObject[] carObjects, bogieObjects, couplerObjects; double[] axleLocations, couplerDistances; TrainManager.Train train; ExtensionsCfgParser.ParseExtensionsConfig(Files[i], out carObjects, out bogieObjects, out couplerObjects, out axleLocations, out couplerDistances, out train, true); double z = 0.0; for (int j = 0; j < carObjects.Length; j++) { Renderer.CreateObject(carObjects[j], new Vector3(0.0, 0.0, z), new Transformation(), new Transformation(), true, 0.0, 0.0, 25.0, 0.0); if (j < train.Cars.Length - 1) { z -= (train.Cars[j].Length + train.Cars[j + 1].Length) / 2.0; z -= couplerDistances[j]; } } z = 0.0; int trainCar = 0; for (int j = 0; j < bogieObjects.Length; j++) { Renderer.CreateObject(bogieObjects[j], new Vector3(0.0, 0.0, z + axleLocations[j]), new Transformation(), new Transformation(), true, 0.0, 0.0, 25.0, 0.0); j++; Renderer.CreateObject(bogieObjects[j], new Vector3(0.0, 0.0, z + axleLocations[j]), new Transformation(), new Transformation(), true, 0.0, 0.0, 25.0, 0.0); if (trainCar < train.Cars.Length - 1) { z -= (train.Cars[trainCar].Length + train.Cars[trainCar + 1].Length) / 2.0; z -= couplerDistances[trainCar]; } trainCar++; } z = 0.0; for (int j = 0; j < couplerObjects.Length; j++) { z -= train.Cars[j].Length / 2.0; z -= couplerDistances[j] / 2.0; Renderer.CreateObject(couplerObjects[j], new Vector3(0.0, 0.0, z), new Transformation(), new Transformation(), true, 0.0, 0.0, 25.0, 0.0); z -= couplerDistances[j] / 2.0; z -= train.Cars[j + 1].Length / 2.0; } } else { UnifiedObject o; Program.CurrentHost.LoadObject(Files[i], System.Text.Encoding.UTF8, out o); Renderer.CreateObject(o, Vector3.Zero, new Transformation(), new Transformation(), true, 0.0, 0.0, 25.0, 0.0); } #if !DEBUG } catch (Exception ex) { Interface.AddMessage(MessageType.Critical, false, "Unhandled error (" + ex.Message + ") encountered while processing the file " + Files[i] + "."); } #endif } Renderer.InitializeVisibility(); Renderer.UpdateVisibility(0.0, true); ObjectManager.UpdateAnimatedWorldObjects(0.01, true); Renderer.ApplyBackgroundColor(); }
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { libraryDataView.CurrentLibraryProvider.AddFilesToLibrary(fileDropEventArgs.DroppedFiles); base.OnDragDrop(fileDropEventArgs); }
public override void OnDragDrop(FileDropEventArgs fileDropEventArgs) { LibraryData.Instance.LoadFilesIntoLibrary(fileDropEventArgs.DroppedFiles); base.OnDragDrop(fileDropEventArgs); }