private void ListaLokala_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { Point mousePos = e.GetPosition(null); // Get the dragged ListViewItem ListView listView = sender as ListView; ListViewItem listViewItem = FindAncestor <ListViewItem>((DependencyObject)e.OriginalSource); // Find the data behind the ListViewItem try { Lokal lokal = (Lokal)listView.ItemContainerGenerator. ItemFromContainer(listViewItem); if (lokal != null) { lokalSelektovanNaListi = lokal; } else { } } catch { } }
public PrikaziLokale() { InitializeComponent(); WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; selektovanTip = null; selektovanaEtiketa = null; SelektovaniLokal = null; DataContext = this; ObservableCollection <Lokal> l1 = new ObservableCollection <Lokal>(); ObservableCollection <Lokal> l2 = new ObservableCollection <Lokal>(); l1 = Podaci.JustGiveMeInstance().Lokali; l2 = Podaci.JustGiveMeInstance().LokaliNaMapi; lokali = new ObservableCollection <Lokal>(); for (int i = 0; i < l1.Count; i++) { Lokali.Add(l1[i]); } for (int i = 0; i < l2.Count; i++) { Lokali.Add(l2[i]); } Etikete = Podaci.getInstance().Etikete; Tipovi = Podaci.getInstance().Tipovi; }
private void ListView_MouseMove(object sender, MouseEventArgs e) { 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 ListView listView = sender as ListView; ListViewItem listViewItem = FindAncestor <ListViewItem>((DependencyObject)e.OriginalSource); // Find the data behind the ListViewItem try { Lokal lokal = (Lokal)listView.ItemContainerGenerator. ItemFromContainer(listViewItem); // Initialize the drag & drop operation DataObject dragData = new DataObject("myFormat", lokal); DragDrop.DoDragDrop(listViewItem, dragData, DragDropEffects.Move); } catch { } } }
public PretragaNaMapi() { InitializeComponent(); WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; selektovanTip = null; selektovanaEtiketa = null; SelektovaniLokal = null; DataContext = this; Lokali = Podaci.getInstance().LokaliNaMapi; Etikete = Podaci.getInstance().Etikete; Tipovi = Podaci.getInstance().Tipovi; }
private void Mapa_PreviewMouseDown(object sender, MouseButtonEventArgs e) { Point mousePosition = e.GetPosition(Mapa); selektovanLokal = Lokal_Click((int)mousePosition.X, (int)mousePosition.Y); if (e.ChangedButton == MouseButton.Left && e.ClickCount == 2) { if (selektovanLokal != null) { Detaljnije detaljnije = new Detaljnije(selektovanLokal); detaljnije.Show(); } } }
public DodajLokal() { InitializeComponent(); WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; lokal = new Lokal(); autoCompleteBoxTags.DataContext = Podaci.JustGiveMeInstance(); DataContext = lokal; izabraneEtikete = new ObservableCollection <Etiketa>(); comboBoxTags.DataContext = this; id_Eror = false; opis_Error = false; naziv_Error = false; ikonica_Error = false; datum_Error = false; kapacitet_Error = false; }
private void Mapa_MouseMove(object sender, MouseEventArgs e) { Point mousePosition = e.GetPosition(Mapa); Vector diff = startPoint - mousePosition; if (e.LeftButton == MouseButtonState.Pressed && (Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance || Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance)) { Lokal lokal = Lokal_Click((int)mousePosition.X, (int)mousePosition.Y); if (lokal != null) { DataObject dragData = new DataObject("myFormat", lokal); DragDrop.DoDragDrop(Mapa, dragData, DragDropEffects.Move); } } }
private void Mapa_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { Point mousePosition = e.GetPosition(Mapa); selektovanLokal = Lokal_Click((int)mousePosition.X, (int)mousePosition.Y); if (selektovanLokal != null) { var Map = sender as Canvas; Map.ContextMenu.IsOpen = true; Map.ContextMenu.Visibility = Visibility.Visible; } else { var Map = sender as Canvas; Map.ContextMenu.Visibility = Visibility.Hidden; } }
public Lokal(Lokal l) { Id = l.Id; Naziv = l.Naziv; Opis = l.Opis; DatumOtvaranja = l.DatumOtvaranja; DozvoljenoPusenje = l.DozvoljenoPusenje; Kapacitet = l.Kapacitet; PrimaRezervacije = l.PrimaRezervacije; DostupanHendikepiranim = l.DostupanHendikepiranim; SluziAlkohol = l.SluziAlkohol; CenovnaKategorija = l.CenovnaKategorija; Etikete = l.Etikete; Tip = l.Tip; Ikonica = l.Ikonica; Visible = true; naMapi = l.NaMapi; }
private void Mapa_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("myFormat")) { Point dropPosition = e.GetPosition(Mapa); Lokal lokalPin = e.Data.GetData("myFormat") as Lokal; if (lokalPin != null) { lokalPin.X = (int)dropPosition.X - 8; lokalPin.Y = (int)dropPosition.Y - 8; } // if it is close to the edge, move it a little bit else if ((int)dropPosition.Y > -30 && (int)dropPosition.Y < 10) { lokalPin.X = (int)dropPosition.X - 16; lokalPin.Y = (int)dropPosition.Y + 8; } else if ((int)dropPosition.X > -30 && (int)dropPosition.X < 10) { lokalPin.X = (int)dropPosition.X + 8; lokalPin.Y = (int)dropPosition.Y - 16; } else { lokalPin.X = (int)dropPosition.X - 16; lokalPin.Y = (int)dropPosition.Y - 16; } if (lokali.Remove(lokalPin)) { LokaliNaMapi.Add(lokalPin); lokalPin.NaMapi = "DA"; } LokaliPins_Draw(); } }
public Detaljnije(Lokal l) { InitializeComponent(); this.DataContext = this; LokalOrig = l; lokal = new Lokal(lokalOrig); autoCompleteBoxTags.DataContext = Podaci.JustGiveMeInstance(); SelectedCena = -1; izabraneEtikete = new ObservableCollection <Etiketa>(); foreach (var etiketa in l.Etikete) { izabraneEtikete.Add(etiketa); } id_Eror = false; opis_Error = false; naziv_Error = false; ikonica_Error = false; datum_Error = false; Kapacitet = l.Kapacitet.ToString(); if (lokal.PrimaRezervacije == "Da") { SelectedRez = 0; } else { SelectedRez = 1; } if (lokal.DostupanHendikepiranim == "Da") { SelectedHen = 0; } else if (lokal.DostupanHendikepiranim == "Ne") { SelectedHen = 1; } if (lokal.DozvoljenoPusenje == "Dozvoljeno") { SelectedPus = 0; } else if (lokal.DozvoljenoPusenje == "Zabranjeno") { SelectedPus = 1; } if (lokal.SluziAlkohol == "Ne služi") { SelectedAlk = 0; } else if (lokal.SluziAlkohol == "Služi do 23h") { SelectedAlk = 1; } else if (lokal.SluziAlkohol == "Služi i kasno noću") { SelectedAlk = 2; } if (lokal.CenovnaKategorija == "Niske") { SelectedCena = 0; } else if (lokal.CenovnaKategorija == "Srednje") { SelectedCena = 1; } else if (lokal.CenovnaKategorija == "Visoke") { SelectedCena = 2; } else if (lokal.CenovnaKategorija == "Izuzetno visoke") { SelectedCena = 3; } }
public static void dodajLokal(Lokal lokal) { instance.Lokali.Add(lokal); }