Example #1
0
        //otvaranje detalja o zadatku
        private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            //dupli click za otvaranje detalja o zadatku
            if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2)
            {
                ZadatakGrid zad = sender as ZadatakGrid;

                Zadatak z = (Zadatak)zad.DataContext;

                //prikazuju se detalji
                DetaljiZadatak dz = new DetaljiZadatak(z, this.vm.TrenutniProjekat);
            }
        }
Example #2
0
        private void Grid_PreviewMouseMove(object sender, MouseEventArgs e)
        {
            // Get the current mouse position
            Point  mousePos = e.GetPosition(null);
            Vector diff     = startPoint - mousePos;

            if (e.LeftButton == MouseButtonState.Pressed && (Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance ||
                                                             Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance))
            {
                // Get the dragged ListViewItem
                ZadatakGrid zad = sender as ZadatakGrid;

                Zadatak z = (Zadatak)zad.DataContext;

                //zakljucavanje zadatka u bazi
                //ukoliko zadatak nije ubacen onda
                //ne treba da se ispita ali onda mora da se ispita
                if (z.Id != 0)
                {
                    if (!Packages.PZadatak.IsZakljucan(z.Id))
                    {
                        Packages.PZadatak.Zakljucaj(z.Id);

                        // Initialize the drag & drop operation
                        DataObject dragData = new DataObject("myZad", z);
                        DragDrop.DoDragDrop(zad, dragData, DragDropEffects.Move);
                    }
                    else
                    {
                        MessageBox.Show(PPoruka.VratiPrevod("Z_LOCKED"));
                    }
                }
                else
                {
                    //ako necemo da zakljucava ovo ostavimo a ovo gore sve iskomentarisemo
                    //Initialize the drag & drop operation
                    DataObject dragData = new DataObject("myZad", z);
                    DragDrop.DoDragDrop(zad, dragData, DragDropEffects.Move);
                }
            }
        }