public DatabasePackagerView()
 {
     InitializeComponent();
     _dragMgr     = new ListViewDragDropManager <DatabaseChange>(uxIncludedListView);
     this.Loaded += DatabasePackagerView_Loaded;
     uxDatabaseTypeCombo.SelectionChanged += uxDatabaseTypeCombo_SelectionChanged;
 }
示例#2
0
        void INIT()
        {
            // Give the ListView an ObservableCollection of Task
            // as a data source.  Note, the ListViewDragManager MUST
            // be bound to an ObservableCollection, where the collection's
            // type parameter matches the ListViewDragManager's type
            // parameter (in this case, both have a type parameter of Task).
            ObservableCollection <Task> tasks = Task.CreateTasks();

            this.listView.ItemsSource = tasks;//


            tasks2 = Task.CreateTasks2(null);
            this.listView2.ItemsSource = tasks2;

            // This is all that you need to do, in order to use the ListViewDragManager.
            this.dragMgr  = new ListViewDragDropManager <Task>(this.listView);
            this.dragMgr2 = new ListViewDragDropManager <Task>(this.listView2);

            // Turn the ListViewDragManager on and off.

            // Hook up events on both ListViews to that we can drag-drop
            // items between them.
            this.listView.DragEnter  += OnListViewDragEnter;
            this.listView2.DragEnter += OnListViewDragEnter;
            this.listView.Drop       += OnListViewDrop;
            this.listView2.Drop      += OnListViewDrop;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="obj">Game object wich implement IAnimationRigidBody</param>
        public EditAnimators(IPropertyInspectable obj)
        {
            GObj = obj as SpriteObject;
            if (GObj == null)
            {
                this.Close();
                return;
            }
            InitializeComponent();
            dragMgr  = new ListViewDragDropManager <AnimationRigidBody>(lstAnimations);
            dragMgr2 = new ListViewDragDropManager <AnimationRigidBody>(lstNewAnimations);
            dragMgr.ShowDragAdorner  = true;
            dragMgr.ProcessDrop     += dragMgr_ProcessDrop;
            dragMgr2.ShowDragAdorner = true;
            dragMgr2.ProcessDrop    += dragMgr_ProcessDrop;
            Assembly assi            = Assembly.GetAssembly(typeof(GFXContainer));
            var      AnimatorObjects = from typ in assi.GetTypes()
                                       where typeof(AnimationRigidBody).IsAssignableFrom(typ) && !typ.IsInterface
                                       select(Activator.CreateInstance(typ) as AnimationRigidBody);

            lstNewAnimations.ItemsSource   = AnimatorObjects;
            lstNewAnimations.SelectedIndex = 0;

            //AList = new ObservableCollection<AnimationRigidBody>(((GObj as SpriteObject).SerializableAnimations));
            AList = (GObj as SpriteObject).SerializableAnimations;
            lstAnimations.ItemsSource = AList;
        }
示例#4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //listview拖拽实现
            this.dragMgr = new ListViewDragDropManager <Music>(this.musicList);
            if (File.Exists("默认.lst") == true)
            {
                StreamReader sr = new StreamReader("默认.lst");
                string       st = "";
                while (sr.EndOfStream == false)
                {
                    Music tmp = new Music();
                    st            = sr.ReadLine();
                    tmp.musicPath = st;
                    tmp.musicName = Music.GetMusicName(st);
                    if ((tmp.musicPath != null) && (tmp.musicName != "?"))
                    {
                        music.Add(tmp);
                    }
                }
                sr.Close();
                //获取列表文件数目
                count = music.Count;
            }
            //媒体打开时触发方法player_MediaOpened
            player.MediaOpened += new EventHandler(player_MediaOpened);
            //设置定时器同步播放进度
            //获取或设置计时器刻度之间的时间段。
            timer.Interval = TimeSpan.FromMilliseconds(500);

            timer.Tick += timer_Tick;
            timer.Start();
        }
 void InitializeListViewDragDropManager()
 {
     this.contentTasks.ItemsSource = tasks;
     dragMgr = new ListViewDragDropManager <Time_Owner.Task>(this.contentTasks);
     contentTasks.DragEnter += OnListViewDragEnter;
     contentTasks.Drop      += OnListViewDrop;
 }
        public GameDesigner()
        {
            InitializeComponent();
            // Drag and Drop
            //Style itemContainerStyle = new Style(typeof(ListBoxItem));
            //itemContainerStyle.Setters.Add(new Setter(ListBoxItem.AllowDropProperty, true));
            //itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(s_PreviewMouseLeftButtonDown)));
            //itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.DropEvent, new System.Windows.DragEventHandler(lstSprites)));
            //lstSprites.ItemContainerStyle = itemContainerStyle;

            // Drag&Drop Mngr
            this.dragMgr = new ListViewDragDropManager<IGameObject>(lstSprites);
            //this.dragMgr2 = new ListViewDragDropManager<SpriteObject>(lstNewObj);
            // Turn the ListViewDragManager on . 
            //dragMgr.ListView = lstSprites;
            dragMgr.ShowDragAdorner = true;
            //dragMgr2.ShowDragAdorner = true;
            //dragMgr.DragAdornerOpacity = 5;
            // Apply or remove the item container style, which responds to changes
            // in the attached properties of ListViewItemDragState.
            //lstSprites.ItemContainerStyle = this.FindResource("ItemContStyle") as Style; 
            //lstSprites.ItemContainerStyle = null;

            this.dragMgr.ProcessDrop += dragMgr_ProcessDrop;
            //this.dragMgr2.ProcessDrop += dragMgr_ProcessDropNewObj;

            Assembly assi = Assembly.GetAssembly(typeof(GFXContainer));
            var GameObjects = from typ in assi.GetTypes()
                              where typeof(SpriteObject).IsAssignableFrom(typ) && !typ.IsInterface
                              select typ;
            dbNewObj.ItemsSource = GameObjects;
            dbNewObj.SelectedIndex = 0;

            SpriteObject.AnimatedByDefault = false;
        }
示例#7
0
        public void LoadMailbox(Mailbox mailbox)
        {
            UnloadMailbox();
            this.mailbox                = mailbox;
            this.selectedIndex          = -1;
            mailbox.AddListViewItem    += OnAddListViewItem;
            mailbox.RemoveListViewItem += OnRemoveListViewItem;
            mailbox.MoveListViewItem   += OnMoveListViewItem;
            listViewItems.ItemsSource   = mailbox.ListViewItems;
            dropManager              = new ListViewDragDropManager <ListViewItem>(listViewItems);
            dropManager.ProcessDrop += OnProcessDrop;
            UpdateDetails();

            mailbox.RepopulateListView();

            int numPartyMail = 0;

            for (int i = 0; i < 6; i++)
            {
                if (i < mailbox.PartyMailCount && mailbox[i, true] != null)
                {
                    numPartyMail++;
                }
            }
            buttonTakeMail.IsEnabled = numPartyMail > 0;
        }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // Give the PanelListView an ObservableCollection of Task
            // as a data source.  Note, the PanelListViewDragManager MUST
            // be bound to an ObservableCollection, where the collection's
            // type parameter matches the PanelListViewDragManager's type
            // parameter (in this case, both have a type parameter of Task).

            // This is all that you need to do, in order to use the PanelListViewDragManager.
            PanelList  = new ListViewDragDropManager <Panel>(PanelListView);
            BranchList = new ListViewDragDropManager <Branch>(BranchListView);
            //ItemList = new ListViewDragDropManager<DialogLine>(ItemsListView);

            // Show and hide the drag adorner.
            // this.PanelList.ShowDragAdorner = true;

            // Change the opacity of the drag adorner.
            //this.PanelList.DragAdornerOpacity = this.sldDragOpacity.Value;

            // Apply or remove the item container style, which responds to changes
            // in the attached properties of PanelListViewItemDragState.
            PanelListView.ItemContainerStyle  = FindResource("ItemContStyle") as Style;
            BranchListView.ItemContainerStyle = FindResource("ItemContStyle") as Style;
            ItemsListView.ItemContainerStyle  = FindResource("ItemContStyle") as Style;


            // Hook up events on both PanelListViews to that we can drag-drop
            // items between them.
            PanelListView.DragEnter  += OnListViewDragEnter;
            BranchListView.DragEnter += OnListViewDragEnter;
            //ItemsListView.DragEnter += OnListViewDragEnter;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="obj">Game object wich implement IAnimationRigidBody</param>
        public EditAnimators(IPropertyInspectable obj)
        {
            GObj = obj as SpriteObject;
            if (GObj == null)
            {
                this.Close();
                return;
            }
            InitializeComponent();
            dragMgr = new ListViewDragDropManager<AnimationRigidBody>(lstAnimations);
            dragMgr2 = new ListViewDragDropManager<AnimationRigidBody>(lstNewAnimations);
            dragMgr.ShowDragAdorner = true;
            dragMgr.ProcessDrop += dragMgr_ProcessDrop;
            dragMgr2.ShowDragAdorner = true;
            dragMgr2.ProcessDrop += dragMgr_ProcessDrop;
            Assembly assi = Assembly.GetAssembly(typeof(GFXContainer));
            var AnimatorObjects = from typ in assi.GetTypes()
                              where typeof(AnimationRigidBody).IsAssignableFrom(typ) && !typ.IsInterface
                              select (Activator.CreateInstance(typ) as AnimationRigidBody);

            lstNewAnimations.ItemsSource = AnimatorObjects;
            lstNewAnimations.SelectedIndex = 0;

            //AList = new ObservableCollection<AnimationRigidBody>(((GObj as SpriteObject).SerializableAnimations));
            AList = (GObj as SpriteObject).SerializableAnimations;
            lstAnimations.ItemsSource = AList;
        }
示例#10
0
 public ContentExplorer()
 {
     InitializeComponent();
     dragMgr = new ListViewDragDropManager <DataRowView>(this.LibraryContentDataListView);
     this.LibraryContentDataListView.Drop      -= dragMgr.listView_Drop;
     this.LibraryContentDataListView.Drop      += dragMgr_ProcessDrop;
     this.LibraryContentDataListView.DragEnter += LibraryContentDataGridView_DragEnter;
 }
示例#11
0
 private static void StopTimer(ScrollViewer s,
                               ListViewDragDropManager dm, InstanceData id)
 {
     EndScrollingWhileDragging(s);
     dm.HandleDragOver = true;
     id.LinesDelta     = 0;
     id.ScrollingState = GetScrollingStateForScrollViewer(s);
 }
示例#12
0
        private void InitializeCriterias()
        {
            var members = new ObservableCollection <SortCriterionDescriptior>();

            List <Entity> entities = new List <Entity>();

            foreach (var item in _tournament.Walllist.SortCriterion)
            {
                entities.Add(item.Id);
            }

            foreach (var item in _tournament.EntitiesCriteria)
            {
                if (!entities.Contains(item))
                {
                    entities.Add(item);
                }
            }

            foreach (Entity it in entities)
            {
                if (members.FirstOrDefault(val => val != null && val.Id == it) == null)
                {
                    var member = new SortCriterionDescriptior()
                    {
                        Id = it
                    };
                    member.Enabled = true;
                    if (_tournament.Walllist.SortCriterion.Find(item => item.Id == member.Id) != null)
                    {
                        member.Active = true;
                    }
                    if (_tournament.EntitiesHidden.Contains(it))
                    {
                        continue;
                    }

                    members.Add(member);
                }
            }

            this.lvSortCriterion.ItemsSource = members;

            // This is all that you need to do, in order to use the ListViewDragManager.
            this.dragMgr2 = new ListViewDragDropManager <SortCriterionDescriptior>(this.lvSortCriterion);

            // Turn the ListViewDragManager on and off.
            this.dragMgr2.ListView = this.lvSortCriterion;

            // Show and hide the drag adorner.
            this.dragMgr2.ShowDragAdorner = true;

            // Hook up events on both ListViews to that we can drag-drop
            // items between them.
            this.lvSortCriterion.DragEnter += OnListViewDragEnter;
            this.lvSortCriterion.Drop      += OnListViewDrop;
        }
        public ReleaseImagesEditor()
        {
            this.Images = new ObservableCollection<ImageInfo>();
            this.DataContext = this;

            InitializeComponent();

            this.dragDropManager = new ListViewDragDropManager<ImageInfo>(this.listView);
            this.dragDropManager.ProcessDrop += dragDropManager_ProcessDrop;
        }
        public ReleaseImagesEditor()
        {
            this.Images      = new ObservableCollection <ImageInfo>();
            this.DataContext = this;

            InitializeComponent();

            this.dragDropManager              = new ListViewDragDropManager <ImageInfo>(this.listView);
            this.dragDropManager.ProcessDrop += dragDropManager_ProcessDrop;
        }
 void MainWindow_Loaded(object sender, RoutedEventArgs e)
     {
         this.dragMgr = new ListViewDragDropManager<Song>(this.listboxPlaylist);
         this.dragMgr.ListView = this.listboxPlaylist;
         this.dragMgr.ShowDragAdorner = true;
         this.dragMgr.DragAdornerOpacity = 0.7;
         this.dragMgr.ProcessDrop += dragMgr_ProcessDrop;
         this.listboxPlaylist.DragEnter += OnListViewDragEnter;
         this.listboxPlaylist.Drop += OnListViewDrop;
     }
示例#16
0
        void ActionSchedulerWindow_Loaded(object sender, RoutedEventArgs e)
        {
            //todo add items
            ObservableCollection <ScriptInfoItem> items = new ObservableCollection <ScriptInfoItem>();

            listView.ItemsSource = items;

            dragMgr             = new ListViewDragDropManager <ScriptInfoItem>(listView);
            listView.DragEnter += OnListViewDragEnter;
            listView.Drop      += OnListViewDrop;
        }
        private async void BtnRefresh_Click(object sender, RoutedEventArgs e)
        {
            btnRefresh.IsEnabled = false;
            UpdateStatus("Contacting site server...");

            string computer = this.tbSiteServer.Text;
            string siteCode = this.tbSiteCode.Text;

            list.Clear();
            ObservableCollection <DistributionPoint> temp = await Task.Run(() =>
            {
                ManagementScope scope = new ManagementScope(String.Format(@"\\{0}\root\SMS\site_{1}", computer, siteCode));
                scope.Connect();
                ObjectQuery query = new ObjectQuery(@"SELECT * FROM SMS_SCI_SysResUse WHERE RoleName = 'SMS Distribution Point' AND NetworkOSPath LIKE '%'");
                ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);
                ManagementObjectCollection colDPs = searcher.Get();

                ObservableCollection <DistributionPoint> t = new ObservableCollection <DistributionPoint>();

                foreach (ManagementObject objDP in colDPs)
                {
                    string server       = (string)objDP["NetworkOSPath"];
                    int index           = Array.FindIndex((System.Management.ManagementBaseObject[])objDP["Props"], IsPriority);
                    int currentPriority = Convert.ToInt32(((System.Management.ManagementBaseObject[])objDP["Props"])[index].GetPropertyValue("Value"));

                    Debug.WriteLine("Adding Server: {0}", objDP["NetworkOSPath"]);
                    UpdateStatus(String.Format("Adding {0}", objDP["NetworkOSPath"]));
                    t.Add(new DistributionPoint(server, currentPriority, currentPriority, false));
                }

                return(t);
            });

            // sort by priority
            ObservableCollection <DistributionPoint> sorted = new ObservableCollection <DistributionPoint>(temp.OrderBy(p => p.NewPriority));

            foreach (DistributionPoint i in sorted)
            {
                list.Add(i);
                if ((list.Count - 1 > 0) && (list[list.Count - 1].Priority == list[list.Count - 2].Priority))
                {
                    list[list.Count - 1].Shared = true;
                    list[list.Count - 2].Shared = true;
                }
            }

            this.listView.ItemsSource = list;
            this.dragMgr        = new ListViewDragDropManager <DistributionPoint>(this.listView);
            this.listView.Drop += OnListViewDrop;

            btnApply.IsEnabled = true;
            btnReset.IsEnabled = true;
            UpdateStatus("Finished Loading Distribution Points");
        }
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // This is all that you need to do, in order to use the ListViewDragManager.
            _dragManager = new ListViewDragDropManager <Mod>(ModList);
            _dragManager.ShowDragAdorner    = true;
            _dragManager.DragAdornerOpacity = 0.35;

            // Hook up events on both ListViews to that we can drag-drop
            // items between them.
            ModList.DragEnter += OnListViewDragEnter;
            ModList.Drop      += OnListViewDrop;
        }
        public LineUpControl()
        {
            InitializeComponent();
            DataContextChanged += LineUpControl_DataContextChanged;
            Festival.SingleFestival.LineUps.CollectionChanged += LineUps_CollectionChanged;
            foreach (FestivalLibAdmin.Model.LineUp lineUp in Festival.SingleFestival.LineUps)
            {
                lineUp.PropertyChanged += lineup_PropertyChanged;
            }
            var mgr = new ListViewDragDropManager <Stage>(StagesListView);

            mgr.ProcessDrop += mgr_ProcessDrop;
        }
示例#20
0
        public MainWindow()
        {
            InitializeComponent();
            _listViewManager = new ListViewDragDropManager <PixHandler>(this.HandlersListView);

            EngineModeCombobox.ItemsSource = this.EngineModes;

            HandlersListView.ItemsSource = this.Handlers;

            // ReSharper disable CommentTypo
            // DecodedText.Text = "Естественно, желательно примерно представлять, какие языки могут встречаться в документе. Чем больше языков используется — тем дольше работает распознавание. " +
            //                    "Иногда Tesseract некорректно обрабатывает случаи, когда текст на разных языках встречается рядом в одной строке. В таких случаях попробуйте ранее перечисленные способы по улучшению качества распознавания. Если не поможет, то попробуйте обходной путь — распознавайте отдельные слова на разных языках и в каждом случае выбирайте результат с большим значением confidence. Пример кода:";
        }
示例#21
0
        public Proto()
        {
            InitializeComponent();

            this._context = new ProtoViewModel();
            // this.cData.ItemsSource = this._context.ListData;
            this.DataContext = this._context;

            this._ddManager              = new ListViewDragDropManager <DummyData>(this.cData);
            this._ddManager.IsValidItem += (index) => {
                if (this._context.ListData[index] is DummyData item && item.IsHeader)
                {
                    return(false);
                }
示例#22
0
 public void UnloadMailbox()
 {
     listViewItems.ItemsSource = null;
     if (mailbox != null)
     {
         dropManager.ListView        = null;
         dropManager.ProcessDrop    -= OnProcessDrop;
         mailbox.AddListViewItem    -= OnAddListViewItem;
         mailbox.RemoveListViewItem -= OnRemoveListViewItem;
         mailbox.MoveListViewItem   -= OnMoveListViewItem;
         mailbox     = null;
         dropManager = null;
     }
 }
示例#23
0
        public MainWindow()
        {
            InitializeComponent();

            this.DataContext = new MainViewModel();
            // this.Loaded += mainWindow_Loaded;
            listViewDragDropManager = new ListViewDragDropManager <DragableItem>(this.dragableListView)
            {
                IsDeleteSourceItem = true
            };
            listViewDragDropManager2 = new ListViewDragDropManager <DragableItem>(this.dragableListView2)
            {
                IsDeleteSourceItem = true
            };
        }
        void Window1_Loaded(object sender, RoutedEventArgs e)
        {
            // Give the ListView an ObservableCollection of Task
            // as a data source.  Note, the ListViewDragManager MUST
            // be bound to an ObservableCollection, where the collection's
            // type parameter matches the ListViewDragManager's type
            // parameter (in this case, both have a type parameter of Task).
            ObservableCollection <Task> tasks = Task.CreateTasks();// Task是数据模型

            this.listView.ItemsSource = tasks;

            this.listView2.ItemsSource = new ObservableCollection <Task>();

            // This is all that you need to do, in order to use the ListViewDragManager.
            this.dragMgr  = new ListViewDragDropManager <Task>(this.listView);
            this.dragMgr2 = new ListViewDragDropManager <Task>(this.listView2);

            // Turn the ListViewDragManager on and off.
            this.chkManageDragging.Checked   += delegate { this.dragMgr.ListView = this.listView; };
            this.chkManageDragging.Unchecked += delegate { this.dragMgr.ListView = null; };

            // Show and hide the drag adorner.
            this.chkDragAdorner.Checked   += delegate { this.dragMgr.ShowDragAdorner = true; };
            this.chkDragAdorner.Unchecked += delegate { this.dragMgr.ShowDragAdorner = false; };

            // Change the opacity of the drag adorner.
            this.sldDragOpacity.ValueChanged += delegate { this.dragMgr.DragAdornerOpacity = this.sldDragOpacity.Value; };

            // Apply or remove the item container style, which responds to changes
            // in the attached properties of ListViewItemDragState.
            this.chkApplyContStyle.Checked   += delegate { this.listView.ItemContainerStyle = this.FindResource("ItemContStyle") as Style; };
            this.chkApplyContStyle.Unchecked += delegate { this.listView.ItemContainerStyle = null; };

            // Use or do not use custom drop logic.
            this.chkSwapDroppedItem.Checked   += delegate { this.dragMgr.ProcessDrop += dragMgr_ProcessDrop; };
            this.chkSwapDroppedItem.Unchecked += delegate { this.dragMgr.ProcessDrop -= dragMgr_ProcessDrop; };

            // Show or hide the lower ListView.
            this.chkShowOtherListView.Checked   += delegate { this.listView2.Visibility = Visibility.Visible; };
            this.chkShowOtherListView.Unchecked += delegate { this.listView2.Visibility = Visibility.Collapsed; };

            // Hook up events on both ListViews to that we can drag-drop
            // items between them.
            this.listView.DragEnter  += OnListViewDragEnter;
            this.listView2.DragEnter += OnListViewDragEnter;
            this.listView.Drop       += OnListViewDrop;
            this.listView2.Drop      += OnListViewDrop;
        }
        public void LoadPokeblockCase(PokeblockCase blockCase)
        {
            UnloadPokeblockCase();
            this.blockCase = blockCase;
            blockCase.AddListViewItem += OnAddListViewItem;
            blockCase.RemoveListViewItem += OnRemoveListViewItem;
            blockCase.MoveListViewItem += OnMoveListViewItem;
            listViewItems.ItemsSource = blockCase.ListViewItems;
            dropManager = new ListViewDragDropManager<ListViewItem>(listViewItems);
            dropManager.ProcessDrop += OnProcessDrop;
            UpdateDetails();
            stackPanelFlavors1.Children.Clear();
            stackPanelFlavors2.Children.Clear();

            blockCase.RepopulateListView();
        }
示例#26
0
        public void LoadPokeblockCase(PokeblockCase blockCase)
        {
            UnloadPokeblockCase();
            this.blockCase                = blockCase;
            blockCase.AddListViewItem    += OnAddListViewItem;
            blockCase.RemoveListViewItem += OnRemoveListViewItem;
            blockCase.MoveListViewItem   += OnMoveListViewItem;
            listViewItems.ItemsSource     = blockCase.ListViewItems;
            dropManager              = new ListViewDragDropManager <ListViewItem>(listViewItems);
            dropManager.ProcessDrop += OnProcessDrop;
            UpdateDetails();
            stackPanelFlavors1.Children.Clear();
            stackPanelFlavors2.Children.Clear();

            blockCase.RepopulateListView();
        }
示例#27
0
 public void UnloadPokeblockCase()
 {
     listViewItems.ItemsSource = null;
     if (blockCase != null)
     {
         dropManager.ListView          = null;
         dropManager.ProcessDrop      -= OnProcessDrop;
         blockCase.AddListViewItem    -= OnAddListViewItem;
         blockCase.RemoveListViewItem -= OnRemoveListViewItem;
         blockCase.MoveListViewItem   -= OnMoveListViewItem;
         blockCase   = null;
         dropManager = null;
     }
     stackPanelFlavors1.Children.Clear();
     stackPanelFlavors2.Children.Clear();
 }
示例#28
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        public TemplateWindow()
        {
            InitializeComponent();

            var viewModel = new TemplateViewModel(this);

            this.DataContext = viewModel;
            var manager = new ListViewDragDropManager <TemplateDetailData>(this.cData)
            {
                AllowStartX = 0,
                AllowEndX   = 24
            };

            manager.IsValidItem = viewModel.IsValidItem;
            manager.DropDone   += viewModel.DropDone;
        }
示例#29
0
		void Window1_Loaded( object sender, RoutedEventArgs e )
		{
			// Give the ListView an ObservableCollection of Task 
			// as a data source.  Note, the ListViewDragManager MUST
			// be bound to an ObservableCollection, where the collection's
			// type parameter matches the ListViewDragManager's type
			// parameter (in this case, both have a type parameter of Task).
			ObservableCollection<Task> tasks = Task.CreateTasks();
			this.listView.ItemsSource = tasks;

			this.listView2.ItemsSource = new ObservableCollection<Task>();

			// This is all that you need to do, in order to use the ListViewDragManager.
			this.dragMgr = new ListViewDragDropManager<Task>( this.listView );
			this.dragMgr2 = new ListViewDragDropManager<Task>( this.listView2 );

			// Turn the ListViewDragManager on and off. 
			this.chkManageDragging.Checked += delegate { this.dragMgr.ListView = this.listView; };
			this.chkManageDragging.Unchecked += delegate { this.dragMgr.ListView = null; };

			// Show and hide the drag adorner.
			this.chkDragAdorner.Checked += delegate { this.dragMgr.ShowDragAdorner = true; };
			this.chkDragAdorner.Unchecked += delegate { this.dragMgr.ShowDragAdorner = false; };

			// Change the opacity of the drag adorner.
			this.sldDragOpacity.ValueChanged += delegate { this.dragMgr.DragAdornerOpacity = this.sldDragOpacity.Value; };

			// Apply or remove the item container style, which responds to changes
			// in the attached properties of ListViewItemDragState.
			this.chkApplyContStyle.Checked += delegate { this.listView.ItemContainerStyle = this.FindResource( "ItemContStyle" ) as Style; };
			this.chkApplyContStyle.Unchecked += delegate { this.listView.ItemContainerStyle = null; };

			// Use or do not use custom drop logic.
			this.chkSwapDroppedItem.Checked += delegate { this.dragMgr.ProcessDrop += dragMgr_ProcessDrop; };
			this.chkSwapDroppedItem.Unchecked += delegate { this.dragMgr.ProcessDrop -= dragMgr_ProcessDrop; };

			// Show or hide the lower ListView.
			this.chkShowOtherListView.Checked += delegate { this.listView2.Visibility = Visibility.Visible; };
			this.chkShowOtherListView.Unchecked += delegate { this.listView2.Visibility = Visibility.Collapsed; };

			// Hook up events on both ListViews to that we can drag-drop
			// items between them.
			this.listView.DragEnter	 += OnListViewDragEnter;
			this.listView2.DragEnter += OnListViewDragEnter;
			this.listView.Drop	+= OnListViewDrop;			
			this.listView2.Drop += OnListViewDrop;
		}
示例#30
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _audioFilesServices      = new AudioFilesServices();
            _queueServices           = new QueueServices();
            _listViewDragDropManager = new ListViewDragDropManager <Song>(QueueSongsListView);

            SongsSearchTextBox.Text      = SONG_SEARCH_TEXTBOX_DEFAULT_TEXT;
            SoundClipsSearchTextBox.Text = SONG_SEARCH_TEXTBOX_DEFAULT_TEXT;

            QueueSongsListView.ItemsSource = new ObservableCollection <Song>();

            DispatcherTimer timer = new DispatcherTimer();

            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += timer_Tick;
            timer.Start();
        }
        public void LoadPocket(ItemPocket pocket)
        {
            this.pocket                = pocket;
            pocket.AddListViewItem    += OnAddListViewItem;
            pocket.UpdateListViewItem += OnUpdateListViewItem;
            pocket.RemoveListViewItem += OnRemoveListViewItem;
            pocket.MoveListViewItem   += OnMoveListViewItem;
            listViewItems.ItemsSource  = pocket.ListViewItems;
            dropManager                = new ListViewDragDropManager <ListViewItem>(listViewItems);
            dropManager.ProcessDrop   += OnProcessDrop;
            UpdateDetails();
            buySellInfo.UnloadBuySellInfo();

            pocket.RepopulateListView();

            gridSortButton.Visibility = (pocket.IsOrdered || pocket.PocketType == ItemTypes.KeyItems ? Visibility.Hidden : Visibility.Visible);
        }
        public ManageBoxesWindow()
        {
            InitializeComponent();
            this.pokePC = PokeManager.ManagerGameSave.PokePC as ManagerPokePC;

            contextMenu = new ContextMenu();
            MenuItem edit = new MenuItem();

            edit.Header = "Edit Box";
            edit.Click += OnEditBox;
            MenuItem insert = new MenuItem();

            insert.Header = "Insert Box";
            insert.Click += OnInsertBox;
            MenuItem duplicate = new MenuItem();

            duplicate.Header = "Duplicate Box";
            duplicate.Click += OnDuplicateBox;
            MenuItem delete = new MenuItem();

            delete.Header    = "Remove Box";
            delete.Click    += OnDeleteBox;
            delete.IsEnabled = pokePC.NumBoxes > 1;
            contextMenu.Items.Add(edit);
            contextMenu.Items.Add(insert);
            contextMenu.Items.Add(duplicate);
            contextMenu.Items.Add(delete);

            selectedIndex = -1;

            boxes = new ObservableCollection <ListViewItem>();
            PopulateBoxes();

            listViewBoxes.ItemsSource = boxes;
            dropManager              = new ListViewDragDropManager <ListViewItem>(listViewBoxes);
            dropManager.ProcessDrop += OnProcessDrop;

            pokeBoxControl.UnloadBox();
            pokeBoxControl.Mode          = PokeBoxControlModes.ViewOnly;
            pokeBoxControl.PokemonViewer = pokemonViewer;

            buttonRemoveRow.IsEnabled = PokeManager.ManagerGameSave.NumPokePCRows > 1;
        }
        public WaveformUserControl()
        {
            InitializeComponent();
            core            = new WaveformCore(this);
            dragDropManager = new ListViewDragDropManager(core, ListViewMain);
            dragDropManager.UpdateViewEvent += new UpdateView(dragDropManager_UpdateViewEvent);
            core.ScaleManager            = new ScaleManager(core, timeScaleViewer);
            timeScaleViewer.ScaleManager = core.ScaleManager;
            timeScaleViewer.ScaleManager.PropertyChanged += new PropertyChangedEventHandler(ScaleManager_PropertyChanged);
            cursorViewer = new CursorViewer(this, core);
            cursorViewer.CursorPositionChangedEvent += new UpdateView(cursorViewer_CursorPositionChangedEvent);
            TreeListView.AllowMultiSelection(ListViewMain);
            core.CursorViewer         = cursorViewer;
            actionMode                = WaveformActionMode.Cursor;
            TimeMeasureDataView1.Core = core;
            lines = new List <Line>();;
            core.TimeMeasureList.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(TimeMeasureList_CollectionChanged);

            runEvent = new RunDelegate(CustomRunCommandHandler);
        }
示例#34
0
        void WindowMOVE_Loaded(object sender, RoutedEventArgs e)
        {
            header = this;
            INIT();

            this.listView.ItemsSource  = dataDD.tasks;//
            this.listView2.ItemsSource = new ObservableCollection <Task>();

            // This is all that you need to do, in order to use the ListViewDragManager.
            this.dragMgr  = new ListViewDragDropManager <Task>(this.listView);
            this.dragMgr2 = new ListViewDragDropManager <Task>(this.listView2);

            // Turn the ListViewDragManager on and off.
            // Hook up events on both ListViews to that we can drag-drop
            // items between them.
            this.listView.DragEnter  += OnListViewDragEnter;
            this.listView2.DragEnter += OnListViewDragEnter;
            this.listView.Drop       += OnListViewDrop;
            this.listView2.Drop      += OnListViewDrop;
        }
        public GameInfoPage()
        {
            InitializeComponent();

            Instance    = this;
            syncContext = SynchronizationContext.Current;

            BluePlayerList.ItemsSource = PlayerViewModel.BluePlayers;
            RedPlayerList.ItemsSource  = PlayerViewModel.RedPlayers;

            if (BroadcastHubController.CurrentLeagueState.Equals("InProgress") && !GameController.IsPaused && PlayerViewModel.BluePlayers.Count == 0)
            {
                var gameState = BroadcastHubController.Instance.gameController.gameState;
                InitPlayers(gameState.blueTeam);
                InitPlayers(gameState.redTeam);
            }

            var blueDropManager = new ListViewDragDropManager <PlayerViewModel>(BluePlayerList);
            var redDropManager  = new ListViewDragDropManager <PlayerViewModel>(RedPlayerList);

            blueDropManager.ProcessDrop += PlayerViewModel.OnProcessDrop;
            redDropManager.ProcessDrop  += PlayerViewModel.OnProcessDrop;
        }
示例#36
0
        public GameDesigner()
        {
            InitializeComponent();
            // Drag and Drop
            //Style itemContainerStyle = new Style(typeof(ListBoxItem));
            //itemContainerStyle.Setters.Add(new Setter(ListBoxItem.AllowDropProperty, true));
            //itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.PreviewMouseLeftButtonDownEvent, new MouseButtonEventHandler(s_PreviewMouseLeftButtonDown)));
            //itemContainerStyle.Setters.Add(new EventSetter(ListBoxItem.DropEvent, new System.Windows.DragEventHandler(lstSprites)));
            //lstSprites.ItemContainerStyle = itemContainerStyle;

            // Drag&Drop Mngr
            this.dragMgr = new ListViewDragDropManager <IGameObject>(lstSprites);
            //this.dragMgr2 = new ListViewDragDropManager<SpriteObject>(lstNewObj);
            // Turn the ListViewDragManager on .
            //dragMgr.ListView = lstSprites;
            dragMgr.ShowDragAdorner = true;
            //dragMgr2.ShowDragAdorner = true;
            //dragMgr.DragAdornerOpacity = 5;
            // Apply or remove the item container style, which responds to changes
            // in the attached properties of ListViewItemDragState.
            //lstSprites.ItemContainerStyle = this.FindResource("ItemContStyle") as Style;
            //lstSprites.ItemContainerStyle = null;

            this.dragMgr.ProcessDrop += dragMgr_ProcessDrop;
            //this.dragMgr2.ProcessDrop += dragMgr_ProcessDropNewObj;

            Assembly assi        = Assembly.GetAssembly(typeof(GFXContainer));
            var      GameObjects = from typ in assi.GetTypes()
                                   where typeof(SpriteObject).IsAssignableFrom(typ) && !typ.IsInterface
                                   select typ;

            dbNewObj.ItemsSource   = GameObjects;
            dbNewObj.SelectedIndex = 0;

            SpriteObject.AnimatedByDefault = false;
        }
 public void UnloadMailbox()
 {
     listViewItems.ItemsSource = null;
     if (mailbox != null) {
         dropManager.ListView = null;
         dropManager.ProcessDrop -= OnProcessDrop;
         mailbox.AddListViewItem -= OnAddListViewItem;
         mailbox.RemoveListViewItem -= OnRemoveListViewItem;
         mailbox.MoveListViewItem -= OnMoveListViewItem;
         mailbox = null;
         dropManager = null;
     }
 }
示例#38
0
    public MainWindow()
    {
      InitializeComponent();
      This = this;

      Title = string.Format("WpfMpdClient v.{0}", Assembly.GetExecutingAssembly().GetName().Version);
      stcAbout.DataContext = m_About;
      try {
        txtLicense.Text = File.ReadAllText("LICENSE.TXT");
      } catch (Exception){ 
        txtLicense.Text = "LICENSE not found!!!";
      }

      m_Settings = Settings.Deserialize(Settings.GetSettingsFileName());
      if (m_Settings != null) {
        txtServerAddress.Text = m_Settings.ServerAddress;
        txtServerPort.Text = m_Settings.ServerPort.ToString();
        txtPassword.Password = m_Settings.Password;
        chkAutoreconnect.IsChecked = m_Settings.AutoReconnect;
        chkShowStop.IsChecked = m_Settings.ShowStopButton;
        chkShowFilesystem.IsChecked = m_Settings.ShowFilesystemTab;
        chkMinimizeToTray.IsChecked = m_Settings.MinimizeToTray;
        chkCloseToTray.IsChecked = m_Settings.CloseToTray;
        chkShowMiniPlayer.IsChecked = m_Settings.ShowMiniPlayer;
        chkScrobbler.IsChecked = m_Settings.Scrobbler;
        cmbLastFmLang.SelectedIndex = m_Languages.IndexOf(m_Settings.InfoLanguage);
        if (cmbLastFmLang.SelectedIndex == -1)
          cmbLastFmLang.SelectedIndex = 0;
        cmbPlaylistStyle.SelectedIndex = m_Settings.StyledPlaylist ? 1 : 0;

        chkTray_Changed(null, null);

        lstTracks.SetColumnsInfo(m_Settings.TracksListView);
        lstPlaylist.SetColumnsInfo(m_Settings.PlayListView);
      } else
        m_Settings = new Settings();
      m_LastfmScrobbler = new LastfmScrobbler(Utilities.DecryptString(m_Settings.ScrobblerSessionKey));

      if (m_Settings.WindowWidth > 0 && m_Settings.WindowHeight > 0){
        Width = m_Settings.WindowWidth;
        Height = m_Settings.WindowHeight;
      }
      if (m_Settings.WindowLeft >= 0 && m_Settings.WindowHeight >= 0){
        Left = m_Settings.WindowLeft;
        Top = m_Settings.WindowTop;
      }else
        WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
      if (m_Settings.WindowMaximized)
        WindowState = System.Windows.WindowState.Maximized;

      m_Mpc = new Mpc();
      m_Mpc.OnConnected += MpcConnected;
      m_Mpc.OnDisconnected += MpcDisconnected;

      m_MpcIdle = new Mpc();
      m_MpcIdle.OnConnected += MpcIdleConnected;
      m_MpcIdle.OnSubsystemsChanged += MpcIdleSubsystemsChanged;

      cmbSearch.SelectedIndex = 0;

      tabFileSystem.Visibility = m_Settings.ShowFilesystemTab ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;
      playerControl.ShowStopButton = m_Settings.ShowStopButton;
      playerControl.Mpc = m_Mpc;
      lstPlaylist.Visibility = m_Settings.StyledPlaylist ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
      lstPlaylistStyled.Visibility = m_Settings.StyledPlaylist ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;

      lstTracks.Visibility = m_Settings.StyledPlaylist ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
      lstTracksStyled.Visibility = m_Settings.StyledPlaylist ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed;


      m_NotifyIcon = new System.Windows.Forms.NotifyIcon();
      m_NotifyIcon.Icon = new System.Drawing.Icon("mpd_icon.ico", new System.Drawing.Size(32,32));
      m_NotifyIcon.MouseDown += new System.Windows.Forms.MouseEventHandler(NotifyIcon_MouseDown);
      m_NotifyIconMenu = (ContextMenu)this.FindResource("TrayIconContextMenu");
      Closing += CloseHandler;

      if (!string.IsNullOrEmpty(m_Settings.ServerAddress)){
        m_StartTimer = new System.Timers.Timer();
        m_StartTimer.Interval = 500;
        m_StartTimer.Elapsed += StartTimerHandler;
        m_StartTimer.Start();
      }

      m_Updater = new Updater(new Uri("http://www.sakya.it/updater/updater.php"), "WpfMpdClient", "Windows");
      m_Updater.AppCurrentVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
      m_Updater.CheckCompletedDelegate += CheckCompleted;
      m_Updater.Check();

      lstArtist.ItemsSource = m_ArtistsSource;
      Type t = typeof(ListboxEntry);
      lstArtist.SearchProperty = t.GetProperty("Artist");

      lstAlbums.ItemsSource = m_AlbumsSource;
      lstAlbums.SearchProperty = t.GetProperty("Album");

      lstGenresAlbums.ItemsSource = m_GenresAlbumsSource;
      lstGenresAlbums.SearchProperty = t.GetProperty("Album");

      lstPlaylist.ItemsSource = m_PlaylistTracks;
      lstPlaylistStyled.ItemsSource = m_PlaylistTracks;
      m_DragDropManager = new ListViewDragDropManager<MpdFile>(m_Settings.StyledPlaylist ? lstPlaylistStyled : lstPlaylist);
      m_DragDropManager.ProcessDrop += dragMgr_ProcessDrop;

      lstChannels.ItemsSource = m_Channels;
      cmbChannnels.ItemsSource = m_Channels;
      lstMessages.ItemsSource = m_Messages;
      CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(lstMessages.ItemsSource);
      PropertyGroupDescription group = new PropertyGroupDescription("Channel");
      view.GroupDescriptions.Add(group);

      m_ArtDownloader.Start();      
      txtStatus.Text = "Not connected";
    }
示例#39
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            dragMgr = new ListViewDragDropManager<FuncWrapper>(this.operatorsListView);

            dragMgr.DropComplete += DragMgr_DropComplete;
        }
 public void UnloadPokeblockCase()
 {
     listViewItems.ItemsSource = null;
     if (blockCase != null) {
         dropManager.ListView = null;
         dropManager.ProcessDrop -= OnProcessDrop;
         blockCase.AddListViewItem -= OnAddListViewItem;
         blockCase.RemoveListViewItem -= OnRemoveListViewItem;
         blockCase.MoveListViewItem -= OnMoveListViewItem;
         blockCase = null;
         dropManager = null;
     }
     stackPanelFlavors1.Children.Clear();
     stackPanelFlavors2.Children.Clear();
 }
 internal void initDragAndDrop()
 {
     Dispatcher.Invoke(() =>
     {
         dragDropManager = new ListViewDragDropManager<ChallengeView>(challengesListview);
         dragDropManager.ShowDragAdorner = true;
         dragDropManager.ProcessDrop += DragDropManager_ProcessDrop;
     });
 }
        public RearangeMovesWindow(IPokemon pokemon)
        {
            InitializeComponent();
            this.pokemon = pokemon;

            ContextMenu contextMenu = new ContextMenu();
            MenuItem delete = new MenuItem();
            delete.Header = "Delete Move";
            delete.Click += OnDeleteMove;
            delete.IsEnabled = pokemon.NumMoves > 1;
            contextMenu.Items.Add(delete);
            moves = new ObservableCollection<ListViewItem>();
            for (int i = 0; i < pokemon.NumMoves; i++) {
                Move move = pokemon.GetMoveAt(i);
                ListViewItem listViewItem = new ListViewItem();
                Grid grid = new Grid();
                grid.Width = 321;
                grid.Height = 27;
                Rectangle panel = new Rectangle();
                panel.Margin = new Thickness(1, 1, 0, 0);
                panel.Width = 319;
                panel.Height = 23;
                panel.RadiusX = 2;
                panel.RadiusY = 2;
                panel.Fill = new SolidColorBrush(Color.FromRgb(248, 248, 248));
                panel.Stroke = new SolidColorBrush(Color.FromRgb(0, 0, 0));
                panel.StrokeThickness = 1;
                PokemonTypeControl type = new PokemonTypeControl();
                type.Type = move.MoveData.Type;
                type.Margin = new Thickness(10, 4, 0, 0);
                ConditionTypeControl condition = new ConditionTypeControl();
                condition.Type = move.MoveData.ConditionType;
                condition.Margin = new Thickness(10, 4, 0, 0);
                condition.Visibility = Visibility.Hidden;
                Label name = new Label();
                name.Content = move.MoveData.Name;
                name.Margin = new Thickness(120, 0, 0, 0);
                name.FontWeight = FontWeights.Bold;
                Label pp = new Label();
                pp.Content = (move.MoveData.PP == 0 ? "--" : move.TotalPP.ToString());
                pp.Margin = new Thickness(281, 0, 0, 0);
                pp.FontWeight = FontWeights.Bold;
                grid.Children.Add(panel);
                grid.Children.Add(type);
                grid.Children.Add(condition);
                grid.Children.Add(name);
                grid.Children.Add(pp);
                listViewItem.Content = grid;
                listViewItem.Tag = move;
                moves.Add(listViewItem);
                listViewItem.ContextMenu = contextMenu;
            }

            listViewMoves.ItemsSource = moves;
            dropManager = new ListViewDragDropManager<ListViewItem>(listViewMoves);

            this.labelMoveAccuracy.Content = "";
            this.labelMovePower.Content = "";
            this.labelMoveCategory.Content = "";
            this.labelMoveAppeal.Content = "";
            this.labelMoveJam.Content = "";
            this.textBlockMoveDescription.Text = "";
            buttonOpenMoveInBulbapedia.Visibility = Visibility.Hidden;
        }
        public void LoadMailbox(Mailbox mailbox)
        {
            UnloadMailbox();
            this.mailbox = mailbox;
            this.selectedIndex = -1;
            mailbox.AddListViewItem += OnAddListViewItem;
            mailbox.RemoveListViewItem += OnRemoveListViewItem;
            mailbox.MoveListViewItem += OnMoveListViewItem;
            listViewItems.ItemsSource = mailbox.ListViewItems;
            dropManager = new ListViewDragDropManager<ListViewItem>(listViewItems);
            dropManager.ProcessDrop += OnProcessDrop;
            UpdateDetails();

            mailbox.RepopulateListView();

            int numPartyMail = 0;
            for (int i = 0; i < 6; i++) {
                if (i < mailbox.PartyMailCount && mailbox[i, true] != null)
                    numPartyMail++;
            }
            buttonTakeMail.IsEnabled = numPartyMail > 0;
        }
示例#44
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //listview拖拽实现
            this.dragMgr = new ListViewDragDropManager<Music>(this.musicList);
            if (File.Exists("默认.lst") == true)
            {
                StreamReader sr = new StreamReader("默认.lst");
                string st = "";
                while (sr.EndOfStream == false)
                {
                    Music tmp = new Music();
                    st = sr.ReadLine();
                    tmp.musicPath = st;
                    tmp.musicName = Music.GetMusicName(st);
                    if ((tmp.musicPath != null) && (tmp.musicName != "?"))
                    {
                        music.Add(tmp);
                    }
                }
                sr.Close();
                //获取列表文件数目
                count = music.Count;
            }
            //媒体打开时触发方法player_MediaOpened
            player.MediaOpened += new EventHandler(player_MediaOpened);
            //设置定时器同步播放进度
            //获取或设置计时器刻度之间的时间段。
            timer.Interval = TimeSpan.FromMilliseconds(500);

            timer.Tick += timer_Tick;
            timer.Start();
        }
示例#45
0
 private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
 {
     dragMgr = new ListViewDragDropManager<VideoCut>(lvCuts);
     lvCuts.DragEnter += OnlvCutsDragEnter;
     lvCuts.Drop += OnlvCutsDrop;
 }