Beispiel #1
0
 private void pipeServer_OnNewMessage(object sender, MessageEventArgs e)
 {
     _logger.Debug("New Message received: " + e.Message);
     if (e.Message.StartsWith("NewJob|", StringComparison.OrdinalIgnoreCase))
     {
         string file = e.Message.Substring(7);
         try
         {
             _logger.Debug("NewJob found: " + file);
             if (File.Exists(file))
             {
                 _logger.Trace("The given file exists");
                 var jobInfo = new JobInfo(file, SettingsHelper.Settings.ApplicationSettings.TitleReplacement);
                 Add(jobInfo);
             }
         }
         catch (Exception ex)
         {
             _logger.Warn(ex, "There was an Exception while adding the print job: ");
         }
     }
     else if (e.Message.StartsWith("DragAndDrop|"))
     {
         var droppedFiles = e.Message.Split('|');
         DragAndDropHelper.OnDrop(droppedFiles);
     }
     else if (e.Message.StartsWith("ShowMain|", StringComparison.OrdinalIgnoreCase))
     {
         ThreadManager.Instance.StartMainWindowThread();
     }
 }
        public AssimpWpfImporterSample()
        {
            InitializeComponent();


            // Use helper class (defined in this sample project) to load the native assimp libraries.
            // IMPORTANT: See commend in the AssimpLoader class for details on how to prepare your project to use assimp library.
            AssimpLoader.LoadAssimpNativeLibrary();


            var assimpWpfImporter = new AssimpWpfImporter();

            string[] supportedImportFormats = assimpWpfImporter.SupportedImportFormats;

            var assimpWpfExporter = new AssimpWpfExporter();

            string[] supportedExportFormats = assimpWpfExporter.ExportFormatDescriptions.Select(f => f.FileExtension).ToArray();

            FileFormatsTextBlock.Text = string.Format("Using native Assimp library version {0}.\r\n\r\nSupported import formats:\r\n{1}\r\n\r\nSupported export formats:\r\n{2}",
                                                      assimpWpfImporter.AssimpVersion,
                                                      string.Join(", ", supportedImportFormats),
                                                      string.Join(", ", supportedExportFormats));


            var dragAndDropHelper = new DragAndDropHelper(this, ".*");

            dragAndDropHelper.FileDropped += (sender, args) => LoadModel(args.FileName);


            string startUpFileName = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Resources\Collada\duck.dae");

            LoadModel(startUpFileName);
        }
Beispiel #3
0
        /// <summary>
        /// Method starts drop if possible
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _TryToDrop(DragEventArgs e)
        {
            DragAndDropHelper dragAndDropHelper = new DragAndDropHelper();

            Point  mousePoint    = e.GetPosition(ganttControl);
            object hoveredObject = ganttControl.HitTest(mousePoint); // Get object under mouse cursor.
            Object dropTarget    = _GetTargetData(hoveredObject);    // Get Tag from hovered object.

            if (dropTarget == null)                                  // If target drop object is "null" - do nothing.
            {
                return;
            }

            // Get collection of dragging orders.
            ICollection <Order> draggingOrders = dragAndDropHelper.GetDraggingOrders(e.Data);

            // If user try to change single stop position - define additional parameters.
            if ((1 == draggingOrders.Count) && (dropTarget is Route) && (hoveredObject is IGanttItemElement) && ((Route)dropTarget).Stops.Count > 0)
            {
                IGanttItem parentItem = null;
                int        index      = 0;
                parentItem = ((IGanttItemElement)hoveredObject).ParentGanttItem;
                index      = parentItem.GanttItemElements.IndexOf((IGanttItemElement)hoveredObject);

                Debug.Assert(index + 1 < parentItem.GanttItemElements.Count);
                if (parentItem.GanttItemElements[index + 1].Tag is Stop)
                {
                    dropTarget = (Stop)parentItem.GanttItemElements[index + 1].Tag;
                }
            }

            // Do Drop.
            dragAndDropHelper.Drop(dropTarget, e.Data);
        }
        public SkeletalAnimation()
        {
            InitializeComponent();

            // Use helper class (defined in this sample project) to load the native assimp libraries
            // IMPORTANT: See commend in the AssimpLoader class for details on how to prepare your project to use assimp library.
            AssimpLoader.LoadAssimpNativeLibrary();

            string fileName = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources\\soldier.X");

            LoadFileWithSkinnedAnimation(fileName);

            var dragAndDropHelper = new DragAndDropHelper(ViewportBorder, ".*");

            dragAndDropHelper.FileDropped += (sender, e) =>
            {
                LoadFileWithSkinnedAnimation(e.FileName);
            };

            // Stop the animation when user leaves this sample.
            this.Unloaded += delegate(object sender, RoutedEventArgs args)
            {
                if (_assimpAnimationController != null)
                {
                    _assimpAnimationController.StopAnimation();
                    _assimpAnimationController = null;
                }
            };
        }
Beispiel #5
0
        public IAppStart CreateApplicationStart(string[] commandLineArgs, IFile fileWrap)
        {
            if (DragAndDropHelper.IsDragAndDrop(commandLineArgs))
            {
                _logger.Debug("Detected only filenames as parameters: Assuming Drag & Drop");
                var validFiles = DragAndDropHelper.RemoveInvalidFiles(commandLineArgs, fileWrap);
                if (validFiles.Count > 0)
                {
                    return(new DragAndDropStart(commandLineArgs));
                }
            }

            var commandLineParser = new CommandLineParser(commandLineArgs);

            if (commandLineParser.HasArgument("PrintFile"))
            {
                var printFile   = FindPrintFile(commandLineParser);
                var printerName = FindPrinterName(commandLineParser);
                return(new PrintFileStart(printFile, printerName));
            }

            if (ShouldCallInitialize(commandLineParser))
            {
                return(new InitializeSettingsStart());
            }

            var appStart = DetermineAppStart(commandLineParser);

            if (commandLineParser.HasArgument("ManagePrintJobs"))
            {
                appStart.StartManagePrintJobs = true;
            }

            return(appStart);
        }
        public Wpf3DFileImporterSample()
        {
            InitializeComponent();

            // Add drag and drop handler for all file extensions
            var dragAndDropHelper = new DragAndDropHelper(ViewportBorder, ".wpf3d");

            dragAndDropHelper.FileDropped += (sender, e) => LoadWpf3DFile(e.FileName);
        }
Beispiel #7
0
        public void RemoveInvalidFiles_InsertNotExistingFiles_ReturnsEmptyList()
        {
            var files    = new[] { "file1", "file2", "file3" };
            var fileStub = Substitute.For <IFile>();

            fileStub.Exists(Arg.Any <string>()).Returns(false);

            Assert.IsEmpty(DragAndDropHelper.RemoveInvalidFiles(files, fileStub));
        }
Beispiel #8
0
        public void RemoveInvalidFiles_InsertExistingFiles_ReturnsAllFiles()
        {
            var files    = new [] { "file1", "file2", "file3" };
            var fileStub = Substitute.For <IFile>();

            fileStub.Exists(Arg.Any <string>()).Returns(true);

            Assert.AreEqual(files, DragAndDropHelper.RemoveInvalidFiles(files, fileStub));
        }
Beispiel #9
0
        public TestView()
        {
            InitializeComponent();
            DragAndDropHelper helper = new DragAndDropHelper(this.gridControl1);

            if (!mvvmContext1.IsDesignMode)
            {
                InitBindings(helper);
            }
        }
Beispiel #10
0
        /// <summary>
        /// Method checks is dragging allowed and starts dragging if possible
        /// </summary>
        private void _TryToStartDragging()
        {
            DragAndDropHelper dragAndDropHelper = new DragAndDropHelper();

            Collection <Object> selection = _GetSelectedStopsAndOrders();

            if (dragAndDropHelper.IsDragAllowed(selection))
            {
                dragAndDropHelper.StartDragOrders(selection, DragSource.TimeView);
            }
        }
Beispiel #11
0
 static void UpdateDragOverThumb(UIElement source, UIElement target)
 {
     if (source != null)
     {
         DragAndDropHelper dragDropHelper = source.GetValue(DragAndDropHelperProperty) as DragAndDropHelper;
         if (dragDropHelper != null)
         {
             dragDropHelper.UpdateDragOverThumb(target);
         }
     }
 }
Beispiel #12
0
 static void ResetDragThumb(UIElement source)
 {
     if (source != null)
     {
         DragAndDropHelper dragDropHelper = source.GetValue(DragAndDropHelperProperty) as DragAndDropHelper;
         if (dragDropHelper != null)
         {
             dragDropHelper.ResetDragThumb();
         }
     }
 }
Beispiel #13
0
        public Wpf3DFileExporterSample()
        {
            InitializeComponent();

            CreateTestScene();

            // Add drag and drop handler for all file extensions
            var dragAndDropHelper = new DragAndDropHelper(ViewportBorder, "*");

            dragAndDropHelper.FileDropped += (sender, e) => LoadModel(e.FileName);
        }
Beispiel #14
0
        private void InitBindings(DragAndDropHelper helper)
        {
            var fluentAPI = mvvmContext1.OfType <DragDropViewModel>();

            fluentAPI.SetBinding(gridControl1, c => c.DataSource, x => x.Files);

            fluentAPI.WithEvent <MyDragAndDropEventArgs>(helper, "Drop")
            .EventToCommand(x => x.Drop(null), args => args.Record != null);

            fluentAPI.WithEvent <MyOnDeleteEventArgs>(helper, "RemoveRecord")
            .EventToCommand(x => x.RemoveRecord(null), args => args.Record);
        }
Beispiel #15
0
        public ViewerObj()
        {
            InitializeComponent();

            _dragAndDropHelper             = new DragAndDropHelper(this, ".obj");
            _dragAndDropHelper.FileDroped += (sender, args) => LoadObj(args.FileName);

            _readerObj = new Ab3d.ReaderObj();
            _readerObj.IgnoreErrors = true; // If error is found in obj file this will not throw exception but instead continue reading obj file. The error will be written to _readerObj.Errors list.

            this.Loaded += OnLoaded;
        }
        public PBRModelViewer()
        {
            InitializeComponent();

            _disposables = new DisposeList();

            AssimpLoader.LoadAssimpNativeLibrary();

            _dxMaterials   = new Dictionary <AssimpMaterial, PhysicallyBasedMaterial>();
            _texturesCache = new Dictionary <string, ShaderResourceView>();
            _textureFiles  = new Dictionary <TextureMapTypes, string>();

            // Support dragging .obj files to load the 3D models from obj file
            var dragAndDropHelper = new DragAndDropHelper(ViewportBorder, ".*");

            dragAndDropHelper.FileDroped += delegate(object sender, FileDropedEventArgs e)
            {
                FileNameTextBox.Text   = e.FileName;
                FolderPathTextBox.Text = System.IO.Path.GetDirectoryName(e.FileName);

                LoadFile(e.FileName, null);
            };

            MainDXViewportView.DXSceneInitialized += delegate(object sender, EventArgs args)
            {
                if (MainDXViewportView.DXScene == null) // Probably WPF 3D rendering
                {
                    return;
                }

                string rootFolder     = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + @"Resources\RobotModel\");
                string fileName       = rootFolder + @"Robot_Claw.FBX";
                string texturesFolder = rootFolder + @"Robot_Claw_Maps\";

                FileNameTextBox.Text   = fileName;
                FolderPathTextBox.Text = texturesFolder;

                LoadFile(fileName, texturesFolder);
                UpdateEnvironmentMap();
            };

            this.Loaded += delegate(object sender, RoutedEventArgs args)
            {
                UpdateLights();
            };

            this.Unloaded += delegate(object sender, RoutedEventArgs args)
            {
                Dispose();
            };
        }
Beispiel #17
0
        /// <summary>
        /// Returns collection of rectangles which should be highlighted.
        /// </summary>
        /// <param name="context">Drawing context.</param>
        /// <returns>Collection of rectangles.</returns>
        private Collection <Rect> _GetHighlightedRects(GanttItemElementDrawingContext context)
        {
            DragAndDropHelper helper = new DragAndDropHelper();

            // Define collection of dragged orders.
            Collection <Order> orders = helper.GetDraggingOrders(context.DraggedData);

            // If more than one order is dragged - we don't need to highlight anything. Just return.
            if (orders.Count > 1)
            {
                return(null);
            }

            // Define default values for dates.
            DateTime startTime = DateTime.MinValue;
            DateTime endTime   = DateTime.MaxValue;

            // Create result collection.
            Collection <Rect> rectResults = new Collection <Rect>();

            Order order = orders[0];

            Debug.Assert(order != null);

            // If both indows are wideopen - define wideopen time span - from MinDate to MaxDate.
            if (order.TimeWindow.IsWideOpen && order.TimeWindow2.IsWideOpen)
            {
                rectResults.Add(new Rect(context.DrawingArea.X, context.DrawingArea.Top, context.DrawingArea.Width, context.DrawingArea.Height + ANTI_ALIASING_GAP));
            }

            // If first time window is not wideopen - define first time span.
            if (!order.TimeWindow.IsWideOpen)
            {
                startTime = new DateTime(order.TimeWindow.EffectiveFrom.Ticks);
                endTime   = new DateTime(order.TimeWindow.EffectiveTo.Ticks);

                rectResults.Add(_GetRect(startTime, endTime, context));
            }

            // If second time window is not wideopen - define second time span.
            if (!order.TimeWindow2.IsWideOpen)
            {
                startTime = new DateTime(order.TimeWindow2.EffectiveFrom.Ticks);
                endTime   = new DateTime(order.TimeWindow2.EffectiveTo.Ticks);

                rectResults.Add(_GetRect(startTime, endTime, context));
            }

            return(rectResults);
        }
        public StaticEdgeLinesCreationSample()
        {
            InitializeComponent();

            AssimpLoader.LoadAssimpNativeLibrary();

            var dragAndDropHelper = new DragAndDropHelper(this, ".*");

            dragAndDropHelper.FileDropped += (sender, args) => LoadModelWithEdgeLines(args.FileName);

            string startupFileName = AppDomain.CurrentDomain.BaseDirectory + @"Resources\ObjFiles\house with trees.obj";

            LoadModelWithEdgeLines(startupFileName);
        }
Beispiel #19
0
        public void RemoveInvalidFiles_InsertListWithNotExistingFile_ReturnsListWithoutNotExistingFile()
        {
            var files    = new[] { "existing file1", "not exsiting file", "existing file2" };
            var fileStub = Substitute.For <IFile>();

            fileStub.Exists("existing file1").Returns(true);
            fileStub.Exists("not exsiting file").Returns(false);
            fileStub.Exists("existing file2").Returns(true);

            var validFiles = DragAndDropHelper.RemoveInvalidFiles(files, fileStub).ToList();

            Assert.Contains("existing file1", validFiles);
            Assert.IsFalse(validFiles.Contains("not exsiting file"));
            Assert.Contains("existing file2", validFiles);
        }
Beispiel #20
0
            static object GetDragData(UIElement source)
            {
                if (source == null)
                {
                    return(null);
                }
                DragAndDropHelper dragDropHelper = source.GetValue(DragAndDropHelperProperty) as DragAndDropHelper;

                if (dragDropHelper != null)
                {
                    return(dragDropHelper.DataContainer.DragData);
                }

                return(null);
            }
        /// <summary>
        /// Drops orders to grid.
        /// </summary>
        /// <param name="sender">DataGridControl.</param>
        /// <param name="e">Event args.</param>
        private void _OrdersGridDrop(object sender, DragEventArgs e)
        {
            // Get row where object was dropped.
            Row parentRow = XceedVisualTreeHelper.GetRowByEventArgs(e);

            object targetData = OrdersGrid;

            if (parentRow != null)
            {
                targetData = _GetTargetData(parentRow); // Get data from dropped object.
            }
            // Do necessary actions (move or reassign routes etc.).
            DragAndDropHelper dragAndDropHelper = new DragAndDropHelper();

            dragAndDropHelper.Drop(targetData, e.Data);
        }
Beispiel #22
0
        /// <summary>
        /// Method checks is dragging allowed and starts dragging if possible.
        /// </summary>
        private void _TryToStartDragging()
        {
            Collection <object> selection = _GetSelectedOrders();

            DragAndDropHelper dragAndDropHelper = new DragAndDropHelper();
            bool isDragAllowed = dragAndDropHelper.IsDragAllowed(selection);

            if (isDragAllowed && selection.Count > 0)
            {
                // We use deferred call to allow grid complete BringItemIntoView.
                this.Dispatcher.BeginInvoke(new Action(delegate()
                {
                    dragAndDropHelper.StartDragOrders(selection, DragSource.FindView);
                }));
            }
        }
Beispiel #23
0
        public AdvancedEdgeLinesSample()
        {
            InitializeComponent();


            PowerToysFeaturesInfoControl.InfoText =
                @"With Ab3d.PowerToys library it is possible to show 3D lines (this is not possible when only WPF 3D is used). But the problem is that the geometry for 3D lines (2 triangles for each line) need to be generated on the CPU. Because 3D lines need to face the camera, the geometry needs to be regenerated on each camera change. This can slow the performance of the application when a lot of 3D lines need to be shown.

The Ab3d.PowerToys library can also generate edge lines based on the angle between triangles (if angle is bigger then the specified angle, then an edge line is created).";


            DXEngineFeaturesInfoControl.InfoText =
                @"Ab3d.DXEngine can use hardware acceleration to create the geometry for 3D lines in the geometry shader. This can render millions on 3D lines on a modern GPU.

What is more, as shown in this sample, the following additional features are available when using Ab3d.DXEngine:
1) It is possible to set line depth bias that moves the lines closer to the camera so that they are rendered on top of the 3D shape. This way the lines are not partially occluded by the 3D shape because they occupy the same 3D space. The depth bias processing is done in the vertex shader.

2) It is possible to render object's outlines. Here a technique is used that first renders the scene with black color and with expanded geometry. Then the scene is rendered normally on top of the black scene. For other techniques to render object outlines see the 'Object outlines rendering' sample.

3) To reduce anti-aliasing the WPF 3D can use multi-sampling (MSAA). With Ab3d.DXEngine it is possible to further reduce the aliasing and produce super-smooth 3D lines with using super-sampling (SSAA). This renders the scene to a higher resolution (4 times higher when 4xSSAA is used). Then the rendered image is down-sampled to the final resolution with using a smart filter. This can be combined with multi-sampling to produce much better results that using multi-sampling alone.";


            DepthBiasComboBox.ItemsSource  = PossibleEdgeLineDepthBiases;
            DepthBiasComboBox.SelectedItem = 0.05;


            AssimpLoader.LoadAssimpNativeLibrary();

            var dragAndDropHelper = new DragAndDropHelper(this, ".*");

            dragAndDropHelper.FileDropped += (sender, args) => LoadModelWithEdgeLines(args.FileName);


            CreateDXViewportView();


            var startupFileName = AppDomain.CurrentDomain.BaseDirectory + @"Resources\Models\planetary-gear.fbx";

            LoadModelWithEdgeLines(startupFileName);


            this.Unloaded += delegate(object sender, RoutedEventArgs args)
            {
                Dispose();
            };
        }
        public AssimpWpfExporterSample()
        {
            InitializeComponent();

            AssimpWpfImporter.LoadAssimpNativeLibrary(AppDomain.CurrentDomain.BaseDirectory);


            var assimpWpfExporter = new AssimpWpfExporter();

            _exportFormatDescriptions = assimpWpfExporter.ExportFormatDescriptions;


            for (int i = 0; i < _exportFormatDescriptions.Length; i++)
            {
                var comboBoxItem = new ComboBoxItem()
                {
                    Content = string.Format("{0} (.{1})", _exportFormatDescriptions[i].Description, _exportFormatDescriptions[i].FileExtension),
                    Tag     = _exportFormatDescriptions[i].FormatId
                };

                ExportTypeComboBox.Items.Add(comboBoxItem);
            }


            ExportTypeComboBox.SelectedIndex = 0; // Use Collada file format by default
            _selectedExportFormatId          = _exportFormatDescriptions[ExportTypeComboBox.SelectedIndex].FormatId;


            // Use helper class (defined in this sample project) to load the native assimp libraries
            // IMPORTANT: See commend in the AssimpLoader class for details on how to prepare your project to use assimp library.
            AssimpLoader.LoadAssimpNativeLibrary();

            _assimpWpfImporter = new AssimpWpfImporter();
            _assimpWpfImporter.AssimpPostProcessSteps = PostProcessSteps.Triangulate;

            CreateTestScene();

            // Set initial output file name
            OutputFileName.Text = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "AssimpExport.dae");

            // Add drag and drop handler for all file extensions
            var dragAndDropHelper = new DragAndDropHelper(ViewportBorder, "*");

            dragAndDropHelper.FileDroped += (sender, e) => LoadModel(e.FileName);
        }
Beispiel #25
0
        static void OnTargetMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            DependencyObject source = sender as DependencyObject;

            if (source == null)
            {
                return;
            }
            if ((bool)source.GetValue(AllowDragProperty))
            {
                DragAndDropHelper dragDropHelper = source.GetValue(DragAndDropHelperProperty) as DragAndDropHelper;
                if (dragDropHelper != null)
                {
                    dragDropHelper.SetHandler(source.GetValue(DragAndDropHandlerProperty) as IDragAndDropHandler);
                    dragDropHelper.OnPreviewMouseLeftButtonDown(source, e);
                }
            }
        }
        /// <summary>
        /// Fired when an object is dropped on the calendar.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void calendar_Drop(object sender, DragEventArgs e)
        {
            DragAndDropHelper dragAndDropHelper      = new DragAndDropHelper();
            FrameworkElement  targetFrameworkElement = (FrameworkElement)e.OriginalSource;
            Object            context = targetFrameworkElement.DataContext;

            while (!(context is DateTime))
            {
                targetFrameworkElement = (FrameworkElement)VisualTreeHelper.GetParent(targetFrameworkElement);
                context = targetFrameworkElement.DataContext;
                Debug.Assert(context != null); // context shouldn't be null
            }

            DateTime targetDate = (DateTime)context;

            if (targetDate != null)
            {
                dragAndDropHelper.DropOnDate(targetDate, e.Data);
            }
        }
Beispiel #27
0
        public Form1()
        {
            InitializeComponent();

            appLocalPath = ApplicationNiceties.ApplicationSetup.CreateApplicationResourcesPath();
            //bm = new Bitmap(@"C:\Users\James\Documents\Visual Studio 2017\Projects\_JP_Hobby Apps\ArtRoom\ArtRoom\TestImages\FullSizeRender.jpg");
            // scrolledDoubleBuffer1.DataWidth = bm.Width;
            // scrolledDoubleBuffer1.DataHeight = bm.Height;
            scrolledDoubleBuffer1.DataWidth  = 1000;
            scrolledDoubleBuffer1.DataHeight = 1000;

            dbuffer             = scrolledDoubleBuffer1.DoubleBuffer;
            dbuffer.PaintEvent += DoubleBuffer_PaintEvent;
            dbuffer.MouseClick += Dbuffer_MouseClick;
            dbuffer.MouseDown  += Dbuffer_MouseDown;
            dbuffer.MouseMove  += Dbuffer_MouseMove;
            dbuffer.MouseUp    += Dbuffer_MouseUp;

            ddH            = new DragAndDropHelper(dbuffer);
            ddH.FileAction = dropFileAction;
            ddH.Extensions = new string[] { ".*" };

            ttC0 = new TooltipContainer(dbuffer);
            ttC1 = new TooltipContainer(dbuffer);
            ttcA = new TooltipContainer(dbuffer);

            // read settings
            lastFile = System.IO.Path.Combine(appLocalPath, "lastSettings");
            // default settings
            if (!readSettings(lastFile))
            {
                defaultSettings();
            }

            _uiUpdate();
            _geometryUpdate();
            scrolledDoubleBuffer1.Invalidate();
        }
        public ModelOptimizerTest()
        {
            InitializeComponent();

            var dragAndDropHelper = new DragAndDropHelper(this, ".obj");

            dragAndDropHelper.FileDropped += (sender, e) => LoadFile(e.FileName);

            this.Loaded += delegate(object sender, RoutedEventArgs args)
            {
                LoadFile(AppDomain.CurrentDomain.BaseDirectory + @"Resources\ObjFiles\ship_boat.obj");

                StartCameraRotation();

                StartFpsMonitor();
                StartCpuMonitor();
            };

            this.Unloaded += delegate(object sender, RoutedEventArgs args)
            {
                StopFpsMonitor();
                StopCpuMonitor();
            };
        }
Beispiel #29
0
        private void PhotoPreviewBorder_OnDrop(object sender, DragEventArgs e)
        {
            var border = (Border)sender;

            if (!IsTagged(border))
            {
                border.BorderBrush = null;
            }
            else
            {
                border.BorderThickness = new Thickness(border.BorderThickness.Left - 1);
            }

            using (var helper = new DragAndDropHelper(border, true))
            {
                string[]             files      = helper.GetDroppedFiles(e);
                IEnumerable <string> imageFiles = files.Where(PreviewProvider.IsImage);
                if (!imageFiles.Any())
                {
                    return;
                }

                // мы в режиме детализации
                if (border.DataContext is PhotoPanelDecorator decorator)
                {
                }
                else if (border.DataContext is PhotoAlbumAttachmentViewModel albumViewModel)
                {
                    albumViewModel.AddFilesToAddedBuffer(imageFiles);
                }
                else if (border.DataContext is PhotoAlbumPanelDecorator photoAlbumDecorator)
                {
                    photoAlbumDecorator.EditableAttachmentViewModel.AddFilesToAddedBuffer(imageFiles);
                }
            }
        }
Beispiel #30
0
 private void OnDrop(object sender, DragEventArgs e)
 {
     DragAndDropHelper.Drop(e);
 }