コード例 #1
0
ファイル: QueryEditor.cs プロジェクト: rajeshwarn/TestProject
        protected override void OnDragDrop(DragEventArgs e)
        {
            bool flag  = false;
            bool flag2 = e.Effect == DragDropEffects.Copy;

            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] source = e.Data.GetData(DataFormats.FileDrop) as string[];
                if ((source != null) && (MainForm.Instance != null))
                {
                    Func <string, bool> predicate = s => ".dll .exe .xml .pdb .winmd".Split(new char[0]).Contains <string>(Path.GetExtension(s).ToLowerInvariant());
                    if (source.All <string>(predicate))
                    {
                        RunnableQuery currentQuery = MainForm.Instance.CurrentQuery;
                        if (currentQuery != null)
                        {
                            foreach (string str in source)
                            {
                                if (".dll .exe .winmd".Split(new char[0]).Contains <string>(Path.GetExtension(str).ToLowerInvariant()))
                                {
                                    currentQuery.AddRefIfNotPresent(true, new string[] { str });
                                }
                            }
                            currentQuery.SortReferences();
                            flag = true;
                        }
                    }
                    else
                    {
                        foreach (string str in source)
                        {
                            if (".linq .sql .txt".Split(new char[0]).Contains <string>(Path.GetExtension(str).ToLowerInvariant()) || (new FileInfo(str).Length < 0xc350L))
                            {
                                MainForm.Instance.OpenQuery(str, true);
                            }
                        }
                    }
                }
                MainForm.Instance.Activate();
            }
            else if (e.Data.GetDataPresent(typeof(RepositoryDragData)))
            {
                RepositoryDragData  data = (RepositoryDragData)e.Data.GetData(typeof(RepositoryDragData));
                RepositoryEventArgs args = new RepositoryEventArgs {
                    Repository = data.Repository,
                    Copy       = flag2
                };
                this.RepositoryDropped(this, args);
            }
            base.OnDragDrop(e);
            base.Focus();
            if (flag)
            {
                MainForm.Instance.BeginInvoke(new Action(MainForm.Instance.AdvancedQueryProps));
            }
        }
コード例 #2
0
ファイル: QueryEditor.cs プロジェクト: rajeshwarn/TestProject
 protected override void OnDragOver(DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         e.Effect = DragDropEffects.Copy;
     }
     else if (e.Data.GetDataPresent(typeof(RepositoryDragData)))
     {
         RepositoryDragData data = (RepositoryDragData)e.Data.GetData(typeof(RepositoryDragData));
         e.Effect = ((((e.KeyState & 8) != 8) || !MainForm.Instance.IsPremium) || data.Repository.LinkedDatabases.Any <LinkedDatabase>()) ? DragDropEffects.Link : DragDropEffects.Copy;
     }
     else
     {
         base.OnDragOver(e);
     }
 }