private void textBox1_PreviewDrop(object sender, DragEventArgs e)
 {
     IDataObject data = e.Data;
     //var formats = data.GetFormats();
     var converted = (string[]) data.GetData("FileNameW", true);
     textBox1.Text = converted[0];
 }
Example #2
0
        void OnDrop(object sender, DragEventArgs e)
        {
            var element = e.Data.GetData(e.Data.GetFormats()[0]) as UIElement;
            if (element != null)
            {
                // Get data object
                // Check source and target container cannot be same container
                UIElement ctrl = (sender as UIElement);
                try
                {
                    if (ctrl.GetType() == typeof(Canvas))
                    {

                        _target.Children.Remove(element);
                        _source.Children.Add(element);

                    }
                    else
                    {
                        _source.Children.Remove(element);
                        _target.Children.Add(element);

                    }

                }
                catch (Exception)
                {
                }
            }
        }
        /// <summary>
        /// Drop event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listBoxFiles_Drop(object sender, DragEventArgs e)
        {
            MainWindowViewModel mv = this.DataContext as MainWindowViewModel;

            if( e.Data.GetDataPresent(DataFormats.FileDrop, false) == true )
                mv.AddFiles((string[]) e.Data.GetData(DataFormats.FileDrop));
        }
        private void txtCode_Drop(object sender, DragEventArgs e)
        {
            //open file which was drag&dropped.
         /*   if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                //open only single file
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
                if (files.Length == 1)
                {
                    //warn user about wrong file extension
                    if (System.IO.Path.GetExtension(files[0]) != ".tex")
                    {
                        MessageBoxResult r = MessageBox.Show("File does not seem to be a LaTeX-file. Proceed opening?", "Wrong file extension", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
                        if (r == MessageBoxResult.No)
                            return;
                    }
                    if (TryDisposeFile())
                        LoadFile(files[0]);
                }
                else
                    MessageBox.Show("Only one file at a time allowed via drag&drop.", "Too many files", MessageBoxButton.OK, MessageBoxImage.Information);

            }*/

        }
Example #5
0
        public InputDragDrop(DragEventArgs e)
        {
            ObjectHasDataPresent = e.Data.GetDataPresent(DataFormats.FileDrop);
            List<string> fsoPaths = ((string[])e.Data.GetData(DataFormats.FileDrop)).ToList();

            initFSOPath(fsoPaths);
        }
        protected override void OnDragOver(DragEventArgs e)
        {
            base.OnDragEnter(e);

            HitTestResult result = VisualTreeHelper.HitTest(this, e.GetPosition(this));

            if ((result.VisualHit as UIElement).IsDescendantOf(this))
            {
                UIElement element = (result.VisualHit as UIElement);
                DragDropTreeViewItem targetNode = GetNearestContainer(e.Source as UIElement);
                if (e.GetPosition(targetNode).Y < targetNode.ActualHeight * 0.2f)
                {
                    // meter em cima
                    //Console.WriteLine("cima");
                    DragDropHelper.insertionPlace = DragDropHelper.InsertionPlace.Top;
                    DragDropHelper.CreateInsertionAdorner(targetNode, true);
                }
                else if (e.GetPosition(targetNode).Y > targetNode.ActualHeight * 0.8f)
                {
                    //Console.WriteLine("baixo");
                    DragDropHelper.insertionPlace = DragDropHelper.InsertionPlace.Bottom;
                    DragDropHelper.CreateInsertionAdorner(targetNode, false);
                }
                else
                {
                    //Console.WriteLine("centro");
                    DragDropHelper.RemoveInsertionAdorner();
                    DragDropHelper.insertionPlace = DragDropHelper.InsertionPlace.Center;
                    var converter = new System.Windows.Media.BrushConverter();
                    Background = (Brush)converter.ConvertFromString("#555");
                }
            }
        }
Example #7
0
        protected override void OnDrop(DragEventArgs e)
        {
            base.OnDrop(e);

            if (e.Data.GetDataPresent(DataFormats.StringFormat))
            {
                string dataString = (string) e.Data.GetData(DataFormats.StringFormat);

                BrushConverter converter = new BrushConverter();
                if (converter.IsValid(dataString))
                {
                    Brush newFill = (Brush) converter.ConvertFromString(dataString);
                    circleUI.Fill = newFill;

                    if (e.KeyStates.HasFlag(DragDropKeyStates.ControlKey))
                    {
                        e.Effects = DragDropEffects.Copy;
                    }
                    else
                    {
                        e.Effects = DragDropEffects.Move;
                    }
                }
            }
            e.Handled = true;
        }
Example #8
0
 private void CMainDisplay_Drop(object sender, DragEventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to recycle these files?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.Cancel)
     {
         return;
     }
     // When File is dropped on top of widget Main Display
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         // Note that you can have more than one file.
         string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
         Timer.Interval = TimeSpan.FromMilliseconds(10);
         Default = CurrentAction;
         CurrentAction = new AMTActionPlayer(Package.Animation, AMTUtil.GetActionFromName(Package.Animation, "recycle"));
         // Assuming you have one file that you care about, pass it off to whatever
         // handling code you have defined.
         foreach (string s in files)
         {
             Console.WriteLine(s);
             if(File.GetAttributes(s) == FileAttributes.Directory)
                 FileSystem.DeleteDirectory(s, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
             else
                 FileSystem.DeleteFile(s, UIOption.OnlyErrorDialogs, RecycleOption.SendToRecycleBin);
         }
     }
 }
Example #9
0
 private void UserControl_Drop(object sender, DragEventArgs e)
 {
     if (this.mainContent.Content != null && this.mainContent.Content is Grid)
     {
         ((Grid)this.mainContent.Content).ShowGridLines = false;
     }
 }
 private void FileContainer_OnDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         images.Add(new animatedImage());
     }
 }
Example #11
0
 void TreeViewDrop(object sender, DragEventArgs e)
 {
     TreeViewItem t = sender as TreeViewItem;
     IStudioResourceRepository rep = StudioResourceRepository.Instance;
     if(t != null)
     {
         ExplorerItemModel destination = t.Header as ExplorerItemModel;
         if (destination != null)
         {
             var dataObject = e.Data;
             if (dataObject != null && dataObject.GetDataPresent(GlobalConstants.ExplorerItemModelFormat))
             {
                 var explorerItemModel = dataObject.GetData(GlobalConstants.ExplorerItemModelFormat);
                 try
                 {
                     ExplorerItemModel source = explorerItemModel as ExplorerItemModel;
                     if (ShouldNotMove(source, destination))
                     {
                         e.Handled = true;
                     }
                     else
                     {
                         MoveItem(source, destination, rep);
                     }
                 }
                 finally { e.Handled = true; }
             }
         }
     }
 }
Example #12
0
 private void allowdrop_DragEnter(object sender, DragEventArgs e)
 {
     if (ExtractRepositoryDirectory(e) != null)
     {
         e.Effects = DragDropEffects.All;
     }
 }
 private void SelectLogFileButton_DragEnter(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
         e.Effects = DragDropEffects.Link;
     else
         e.Effects = DragDropEffects.None;
 }
        /// <summary>
        /// アイテムドロップイベント発生時に呼び出される。
        /// </summary>
        private void Window_Drop(object sender, DragEventArgs e)
        {
            var items = e.Data.GetData(DataFormats.FileDrop) as string[];
            if (items != null && items.Length > 0)
            {
                try
                {
                    // テクスチャアトラスローダ作成
                    var loader = TextureAtlasLoaderFactory.Create();

                    // 作成ウィンドウ起動
                    var makerWindow =
                        new View.MakerWindow(
                            new ViewModel.MakerViewModel(
                                AccessoryFileConfig,
                                EffectFileConfig,
                                loader,
                                items));
                    makerWindow.Show();
                }
                catch (Exception ex)
                {
                    App.ShowAlert(ex.Message, MessageBoxImage.Error);
                }

                e.Handled = true;
            }
        }
Example #15
0
 private void Grid_Drop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         bool allGood = true;
         string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
         foreach (string f in files)
         {
             if (System.IO.Path.GetExtension(f) == ".wad")
             {
                 try
                 {
                     free(f);
                 }
                 catch (ArgumentException ex)
                 {
                     MessageBox.Show("Could not free the file. Try again.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                     allGood = false;
                 }
             }
             else
             {
                 MessageBox.Show("Not a WAD file.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
         if (allGood)
             MessageBox.Show("All files freed successfully.", "Success.", MessageBoxButton.OK, MessageBoxImage.Information);
         else
             MessageBox.Show("Not all files were successfull. Try again.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 private void DropList_DragEnter(object sender, DragEventArgs e)
 {
     if (!e.Data.GetDataPresent(_format) || sender == e.Source)
     {
         e.Effects = DragDropEffects.None;
     }
 }
        private void OnDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetFormats().Contains("GettingThingsDone.src.view.StaticListPanel") && this.AllowListDrop)
            {
                StaticListPanel source = e.Data.GetData(e.Data.GetFormats().First()) as StaticListPanel;
                StaticListPanel target = e.Source as StaticListPanel;

                var tmp = source.DataContext;
                source.DataContext = target.DataContext;
                target.DataContext = tmp;

                return;
            }

            else if (e.Data.GetFormats().Contains(typeof(TaskMoveData).ToString()))
            {
                TaskMoveData data = e.Data.GetData(e.Data.GetFormats().First(), true) as TaskMoveData;

                data.OrigList.removeTask(data.Task);

                TaskList l = DataContext as TaskList;

                l.AddTask(data.Task);

                this.List.BorderThickness = new Thickness(0);
            }
        }
 public void OnDrop(DirectionalDropArea dropArea, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(typeof(NamingRuleTreeItemViewModel)))
     {
         NamingRuleTreeItemViewModel namingRule = e.Data.GetData(typeof(NamingRuleTreeItemViewModel)) as NamingRuleTreeItemViewModel;
         if (!namingRule.IsAncestorOfMe(this))
         {
             switch (dropArea)
             {
                 case DirectionalDropArea.On:
                     namingRule.Parent.Children.Remove(namingRule);
                     this.Children.Add(namingRule);
                     break;
                 case DirectionalDropArea.Above:
                     namingRule.Parent.Children.Remove(namingRule);
                     this.Parent.Children.Insert(this.Parent.Children.IndexOf(this), namingRule);
                     break;
                 case DirectionalDropArea.Below:
                     namingRule.Parent.Children.Remove(namingRule);
                     this.Parent.Children.Insert(this.Parent.Children.IndexOf(this) + 1, namingRule);
                     break;
             }
         }
     }
 }
 private void DragList_DragOver(object sender, DragEventArgs e)
 {
     _overTarget = ((DependencyObject)e.OriginalSource).FindAnchestor<ListViewItem>();
     if (_overTarget == null) return;
     if (_draggedItem == _overTarget) return;
     (_overTarget.Content as AssetViewModel).DragOverTarget = true;
 }
        // Drag & Drop

        private void Window_DragOver(object sender, DragEventArgs e)
        {
            string[] filePaths = e.Data.GetData(DataFormats.FileDrop) as string[];
            if (filePaths == null) return;
            foreach (var filePath in filePaths)
            {
                try
                {
                    string extension = Path.GetExtension(filePath).Remove(0, 1);
                    if (!(extension == "gif" ||
                        extension == "jpg" ||
                        extension == "jpeg" ||
                        extension == "png"))
                    {
                        e.Effects = DragDropEffects.None;
                        e.Handled = true;
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Log.Add(ex);
                }
            }
        }
        /// <summary>
        /// 匹配插口和插头
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <param name="socketName"></param>
        public static void validPlugAndSocket(object sender, DragEventArgs e) {
            try {
                //取得工具
                var dataObj = e.Data as DataObject;
                AbstractCableKit kit = (AbstractCableKit)dataObj.GetData(typeof(AbstractCableKit));
                if ((sender as ISocket).CableKit != null) {
                    e.Effects = DragDropEffects.None;
                    return;
                }

                //类型匹配
                if (sender.GetType() != Type.GetType(kit.SocketType.ToString())) {
                    
                    e.Effects = DragDropEffects.None;
                }

                //编号匹配
                if(kit.IsActive == true) {
                    if(kit.SocketA != null) {
                        if (!kit.SocketA.Label.Equals((sender as ISocket).Label)) {
                            e.Effects = DragDropEffects.None;
                        }
                    } else {
                        if (!kit.SocketB.Label.Equals((sender as ISocket).Label)) {
                            e.Effects = DragDropEffects.None;
                        }
                    }
                }
            } catch {

            }
            e.Handled = true;
        }
Example #22
0
        private void PNGDropContent_Drop(object sender, DragEventArgs e)
        {
            System.Array array = ((System.Array)e.Data.GetData(DataFormats.FileDrop));
            bool isOverlap = CBIsOverlap.IsChecked.Value;
            bool isETCEncode = ETCEncodeTag.IsChecked.Value;
            bool isJPGAEncode = JPGAEncodeTag.IsChecked.Value;
            bool isPVREncode = PVREncodeTag.IsChecked.Value;
            bool isPVRTC4Encode = PVRTC4EncodeTag.IsChecked.Value;

            PNGEncodeHelper.Instance.isFast = pngIsFast.IsChecked.Value;
            PNGEncodeHelper.Instance.isConvertMP = pngIsConvertMP.IsChecked.Value;

            if (isETCEncode)
            {
                PNGEncodeHelper.Instance.convertType = PNGEncodeHelper.ConvertType.ETC;
            }
            else if (isJPGAEncode)
            {
                PNGEncodeHelper.Instance.convertType = PNGEncodeHelper.ConvertType.JPGA;
            }
            else if (isPVREncode)
            {
                PNGEncodeHelper.Instance.convertType = PNGEncodeHelper.ConvertType.PVR;
            }
            else if (isPVRTC4Encode)
            {
                PNGEncodeHelper.Instance.convertType = PNGEncodeHelper.ConvertType.PVRTC4;
            }
            PNGEncodeHelper.Instance.workWithFileList(array, isOverlap);
        }
Example #23
0
 protected override void OnDragEnter(DragEventArgs e)
 {
     if (GetDraggingFileList(e.Data).Length > 0)
     {
         e.Effects = DragDropEffects.Copy;
     }
 }
 private void _tbDrop_Drop(object sender, DragEventArgs e)
 {
     _ddh.DragDrop(sender, e);
     e.Handled = true;
     this._tbDrop.Text = _ddh.XmlText;
     Clipboard.SetText(_ddh.XmlText);
 }
		private void Window_Drop(object sender, DragEventArgs e)
		{
			if (e.Data.GetDataPresent(DataFormats.FileDrop))
			{
				string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

				if(files.Length > 0)
				{
					string file = files[0];

					if(file.EndsWith(".hmap"))
					{
						if (machine.Mode == Machine.OperatingMode.Probe || Map != null)
							return;

						OpenHeightMap(file);
					}
					else
					{
						if (machine.Mode == Machine.OperatingMode.SendFile)
							return;

						try
						{
							machine.SetFile(System.IO.File.ReadAllLines(file));
						}
						catch (Exception ex)
						{
							MessageBox.Show(ex.Message);
						}
					}
				}
			}
		}
        private void legend_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("legendLayerFormat"))
            {
                Layer moveLayer = e.Data.GetData("legendLayerFormat") as Layer;

                var lvItem = legend.ContainerFromElement((FrameworkElement)e.OriginalSource) as ListViewItem;
                if (lvItem != null)
                {
                    Layer replaceLayer = lvItem.DataContext as Layer;
                    if (replaceLayer != null)
                    {
                        int index = mapView.Map.Layers.IndexOf(replaceLayer);
                        if (index >= 0)
                        {
                            mapView.Map.Layers.Remove(moveLayer);
                            mapView.Map.Layers.Insert(index, moveLayer);
                        }
                        else
                        {
                            mapView.Map.Layers.Remove(moveLayer);
                            mapView.Map.Layers.Add(moveLayer);
                        }
                    }
                }
            }
        }
 private void DragImage_Execute(DragEventArgs args)
 {
     args.Effects = args.Data.GetDataPresent(DataFormats.FileDrop)
                        ? DragDropEffects.Copy
                        : DragDropEffects.None;
     args.Handled = true;
 }
 private void ItemsControl_DragOver(object sender, DragEventArgs e)
 {
     //            if (e.Data.GetDataPresent(typeof(Model)))
     //            {
     //                e.Effects = DragDropEffects.All;
     //            }
 }
 private void legend_DragEnter(object sender, DragEventArgs e)
 {
     if (!e.Data.GetDataPresent("legendLayerFormat") || sender == e.Source)
     {
         e.Effects = DragDropEffects.None;
     }
 }
 private bool CanArrangeObject(DragEventArgs dragArgs)
 {
     object data = DragDropBehavior.GetDragBehaviorData(dragArgs.Data);
     if (data is InteriorObjectBase) return this.CanArrangeObject(data as InteriorObjectBase);
     else if (data is ArrangedFieldViewModel) return this.CanArrangeObject(data as ArrangedFieldViewModel);
     else return false;
 }
Example #31
0
 private void rtb_DragLeave(object sender, System.Windows.DragEventArgs e)
 {
     VisualStateManager.GoToState(this, "Normal", true);
 }
Example #32
0
 private void AdornedWindowOnDragOver(object sender, System.Windows.DragEventArgs e)
 {
     WidgetDragOverHandler(sender, e);
 }
Example #33
0
 void WidgetDragLeaveHandler(object sender, System.Windows.DragEventArgs e)
 {
     OnDragLeave(sender, e);
 }
Example #34
0
 public void StartImageDrag(DragEventArgs e)
 {
     e.Effects = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
 }
Example #35
0
 private void OnPreviewDragOver(object sender, DragEventArgs e)
 {
     e.Handled = true;
 }
Example #36
0
 protected virtual void OnPreviewDrop(DragEventArgs e)
 {
     throw new NotImplementedException();
 }
Example #37
0
 protected virtual void OnDragOver(DragEventArgs e)
 {
     throw new NotImplementedException();
 }
        private void lb_imagen_Drop(object sender, System.Windows.DragEventArgs e)
        {
            bool          inserto = false;
            string        result  = "";
            string        destFile;
            Test_Internet ti = new Test_Internet();

            string extension             = "";
            Fotos_estudio_carpetaModel f = new Fotos_estudio_carpetaModel();

            //Recuperamos la lista de los elementos arrastrados y y los añadimos a la lista
            string[] s = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop, false);
            int      i;

            for (i = 0; i < s.Length; i++)
            {
                extension = System.IO.Path.GetExtension(s[i]);
                if (extension.Equals(".png") || extension.Equals(".jpg") || extension.Equals(".JPG") || extension.Equals(".PNG"))
                {
                    result = System.IO.Path.GetFileName(s[i]);

                    // ---------ACOMODAR ESTO-------- -/
                    //SUBIRLO TODO LOCAL
                    //REALIZAR INSERCION DEL REGISTRO
                    Fotos_estudio_carpeta fotos = new Fotos_estudio_carpeta(bandera_online_offline);
                    bool insertar_foto          = fotos.insertarFoto_estudio_carpeta(id_carpeta, id_paciente, id_carpeta + "_" + result, carpeta.id_motivo, carpeta.id_clinica, alias);
                    //SI SE INSERTA PROCEDER A PASAR LA IMAGEN A CARPETA BS Y BS_OFFLINE
                    if (insertar_foto)
                    {
                        try
                        {
                            destFile = System.IO.Path.Combine(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\", result);
                            File.Copy(s[i], destFile, true);
                            renombrar(false, result, id_carpeta + "_" + result);

                            destFile = System.IO.Path.Combine(@configuracion.carpetas.ruta_imagenes_carpeta + "\\", result);
                            File.Copy(s[i], destFile, true);
                            renombrar(true, result, id_carpeta + "_" + result);
                        }
                        catch (Exception ex)
                        {
                            // System.Windows.MessageBox.Show(ex + "");
                            // ----------eliminar fotos insertadas en las carpetas y eliminar el registro de la base de datos-------------/
                            //revisar paridad entre carpetas offline y bs. si esta en offline forzosamente debe de estar en bs, de lo contrario eliminar imagen de offline =====> PROBABLEMENTE TAMBIÉN VERIFICAR ESTO AL ENTRAR A ESTE PAGE(INTERFAZ)
                            //POSIBLE ERROR : Que no exista una de las carpetas o servicio ocupado
                            //eliminar registro de BS Local

                            System.Windows.Forms.MessageBox.Show("La imagen ya existe", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        //SUBIR TODO AL SERVIDOR
                        //REALZAR INSERCION DEL REGISTRO EN EL SERVIDOR
                        //fotos = new Fotos_estudio_carpeta(!bandera_online_offline);
                        //insertar_foto = fotos.insertarFoto_estudio_carpeta(id_carpeta, id_paciente, id_carpeta + "_" + result);

                        if (insertar_foto)
                        {
                            //System.Windows.MessageBox.Show("ENTRO PARA SUBIR FOTO A SERVIDOR");
                            //PROCEDER A MIGRAR LA IMAGEN POR FTP
                            //inserto = SubirFicheroStockFTP(id_carpeta + "_" + result, s[i]);

                            /*if (inserto)
                             * {
                             *  //ELIMINAR FOTO QUE SE SUBIO AL SERVIDOR DE CARPETA OFFLINE
                             *  if(File.Exists(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\"+ id_carpeta + "_" + result))
                             *  {
                             *      File.Delete(@configuracion.carpetas.ruta_subir_servidor_carpeta + "\\" + id_carpeta + "_" + result);
                             *  }
                             *
                             * }*/
                        }
                        else
                        {
                            //NO HAY INTERNET, NO HACER NADA
                        }
                    }
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Formato No valido solo acepta PNG y JPG " + s[i], "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            lb_imagen.Items.Clear();

            Fotos_estudio_carpeta             f_estudio = new Fotos_estudio_carpeta(bandera_online_offline);
            List <Fotos_estudio_carpetaModel> lista     = f_estudio.MostrarFoto_estudio_carpeta(id_carpeta, id_paciente, carpeta.id_motivo, carpeta.id_clinica);

            var fotografos = new ObservableCollection <Fotos_estudio_carpetaModel>(lista);

            for (int j = 0; j < lista.Count; j++)
            {
                lb_imagen.Items.Add(fotografos[j]);
            }
        }
 private void Border_PreviewDragOver(object sender, System.Windows.DragEventArgs e)
 {
     // ファイルをドロップされた場合のみ e.Handled を True にする
     e.Handled = e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop);
 }
Example #40
0
 private void rtb_DragEnter(object sender, System.Windows.DragEventArgs e)
 {
     VisualStateManager.GoToState(this, "DragOver", true);
 }
 private void tlLoadFromFile_DragEnter(object sender, DragEventArgs e)
 {
     e.Effects = e.Data.GetDataPresent(DataFormats.FileDrop)
         ? DragDropEffects.Copy
         : DragDropEffects.None;
 }
Example #42
0
 private void Grid_Drop(object sender, System.Windows.DragEventArgs e)
 {
     chunkFileName = ((System.Array)e.Data.GetData(System.Windows.DataFormats.FileDrop)).GetValue(0).ToString();
     Console.WriteLine(chunkFileName);
     analyzeWorker.RunWorkerAsync();
 }
 private void MyViewPort3D_DragEnter(object sender, System.Windows.DragEventArgs e)
 {
     e.Effects = (DragDropEffects)System.Windows.Forms.DragDropEffects.Copy;
 }
 private void tlLoad_PreviewDragEnter(object sender, DragEventArgs e)
 {
     //e.Handled = true;
 }
Example #45
0
 private void Grid_DragEnter(object sender, System.Windows.DragEventArgs e)
 {
     LayerDropping.Visibility     = Visibility.Visible;
     TextLayerDropping.Visibility = Visibility.Visible;
 }
 private void tlLoadFromFile_PreviewDragOver(object sender, DragEventArgs e)
 {
     e.Handled = true;
 }
Example #47
0
 public DragEventSource(long pointerId, DragEventArgs wpfArgs)
 {
     _wpfArgs = wpfArgs;
     Id       = pointerId;
 }
Example #48
0
 private void Grid_DragLeave(object sender, System.Windows.DragEventArgs e)
 {
     LayerDropping.Visibility     = Visibility.Hidden;
     TextLayerDropping.Visibility = Visibility.Hidden;
 }
Example #49
0
 private void dropBox_PreviewDragOver(object sender, System.Windows.DragEventArgs e)
 {
     e.Effects = System.Windows.DragDropEffects.All;
     e.Handled = true;
 }
Example #50
0
 private void OnHostDrop(object sender, DragEventArgs e)
 => e.Effects = ToDropEffects(_manager.ProcessDropped(new DragEventSource(_fakePointerId, e)));
Example #51
0
 void MainWindow_OnDragLeave(object sender, DragEventArgs e)
 {
     _vm.HoveredUrl = null;
 }
Example #52
0
 private void dropPanel_DragEnter(object sender, System.Windows.DragEventArgs e)
 {
     e.Effects = System.Windows.DragDropEffects.All;
     e.Handled = true;
 }
Example #53
0
 private void FilesListView_OnDragEnter(object sender, DragEventArgs e)
 {
     e.Effects = e.Data.GetDataPresent(DataFormats.FileDrop) ? DragDropEffects.Copy : DragDropEffects.None;
 }
Example #54
0
 void MainWindow_OnDrop(object sender, DragEventArgs e)
 {
     _vm.State = MainState.Collapsed;
 }
Example #55
0
 private void Fuck_PreviewDragOver(object sender, System.Windows.DragEventArgs e)
 {
     e.Effects = System.Windows.DragDropEffects.Copy;
     e.Handled = true;
 }
Example #56
0
 void MainWindow_OnDragEnter(object sender, DragEventArgs e)
 {
     _vm.HoveredUrl = e.Data.GetData(typeof(string)).ToString();
 }
Example #57
0
 private void InputList_PreviewDrop(object sender, System.Windows.DragEventArgs e)
 {
     // nothing
 }
Example #58
0
        private void Fuck_PreviewDrop(object sender, System.Windows.DragEventArgs e)
        {
            var list = (string[])e.Data.GetData(System.Windows.DataFormats.FileDrop);

            OpenText(list[list.Length - 1]);
        }
Example #59
0
        /// <summary>
        /// Dropイベント
        /// </summary>
        /// <param name="args"></param>
        private void Description_DragDrop(System.Windows.DragEventArgs args)
        {
            if (args.Data.GetDataPresent(typeof(ContentModel)))
            {
                // Drop item
                var data = args.Data.GetData(typeof(ContentModel)) as ContentModel;

                // EventArgsからDrop先のFrameworkElementを取得
                var feDest = args.Source as System.Windows.Controls.ListBox;
                // EventArgsからDrop先のバインドオブジェクトを取得
                var bindDest = BindingOperations.GetBinding(
                    (args.Source as System.Windows.Controls.ListBox), System.Windows.Controls.ListBox.ItemsSourceProperty).Path.Path;

                // Drop元のバインドオブジェクトを取得
                var dragFromTheme = ThemeList.Any(item => item.ContentList.Contains(data));
                var dragFromFree  = ContentFreeList.Contains(data);

                // Drop元とDrop先のチェック
                if (bindDest == nameof(ThemeList))
                {
                    if (dragFromFree)
                    {
                        Point position = args.GetPosition(args.OriginalSource as IInputElement);
                        //System.Windows.Media.VisualTreeHelper.HitTest(
                        //    this
                        //                         , null
                        //                         , new System.Windows.Media.HitTestResultCallback(OnHitTestResultCallback)
                        //                         , new System.Windows.Media.PointHitTestParameters(position));
                        // Drop Index
                        //var targetContainer = GuiUtils.GetTemplatedRootElement(args.OriginalSource as FrameworkElement);
                        //var targetContainer2 = GuiUtils.FindAncestor<System.Windows.Controls.ListBox>(args.OriginalSource as FrameworkElement);
                        var index = ThemeList.IndexOf(DropTarget);
                        index = index < 0 ? feDest.Items.Count - 1 : index;
                        //var datas =
                        ThemeList[index].ContentList.Add(data);
                        ContentFreeList.Remove(data);
                    }
                    else if (dragFromTheme)
                    {
                        return;
                    }
                }
                else if (bindDest == nameof(ContentFreeList))
                {
                    if (dragFromFree)
                    {
                        // Drop Index
                        var targetContainer = GuiUtils.GetTemplatedRootElement(args.OriginalSource as FrameworkElement);
                        var index           = feDest.ItemContainerGenerator.IndexFromContainer(targetContainer);
                        index = index < 0 ? feDest.Items.Count - 1 : index;
                        // Collectionに反映
                        var ocDest = this[bindDest] as ObservableCollection <ContentModel>;
                        ocDest.Move(feDest.SelectedIndex, index);
                    }
                    else if (dragFromTheme)
                    {
                        // Drop Index
                        var index = ThemeList
                                    .Select((thm, i) => new { Theme = thm, Index = i })
                                    .Where(item => item.Theme.ContentList.Contains(data))
                                    .Select(item => item.Index).FirstOrDefault();

                        // Collectionに反映
                        ContentFreeList.Add(data);
                        ThemeList[index].ContentList.Remove(data);
                    }
                }
                return;
            }
            if (args.Data.GetDataPresent(typeof(ThemeModel)))
            {
                return;
            }
        }
 private void TextBoxPuTTYLocation_PreviewDragOver(object sender, System.Windows.DragEventArgs e)
 {
     e.Effects = DragDropEffects.Copy;
     e.Handled = true;
 }