private static void locationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { LocationBoxView view = (LocationBoxView)d; if (view.LocationHistory == null) { view.locationBoxViewModel.setPath((String)e.NewValue); return; } else if (view.IsUpdateHistory && view.LocationHistory.Count() == 0) { MiscUtils.insertIntoHistoryCollection(view.LocationHistory, (String)e.NewValue); } else if (view.IsUpdateHistory && !view.LocationHistory[view.index].Equals(e.NewValue)) { for (int i = 0; i < view.index; i++) { view.LocationHistory.RemoveAt(0); } MiscUtils.insertIntoHistoryCollection(view.LocationHistory, (String)e.NewValue); view.Index = 0; } try { view.locationBoxViewModel.setPath((String)e.NewValue); } catch (Exception ex) { Logger.Log.Error("Error opening location: " + (String)e.NewValue, ex); view.Location = ""; } }
private static void locationHistoryChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { LocationBoxView view = (LocationBoxView)d; if (e.NewValue != null && view.IsUpdateHistory) { MiscUtils.insertIntoHistoryCollection((ObservableCollection <String>)e.NewValue, view.Location); } }
private static void isHistoryButtonsVisibileChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { LocationBoxView view = (LocationBoxView)d; if ((bool)e.NewValue == true) { view.forwardButton.Visibility = Visibility.Visible; view.backButton.Visibility = Visibility.Visible; } else { view.forwardButton.Visibility = Visibility.Collapsed; view.backButton.Visibility = Visibility.Collapsed; } }