private void highlightPrev() { Dispatcher.BeginInvoke(new Action(delegate() { int selectedIndex = -2; for (int i = this.layoutList.Children.Count - 1; i >= 0; i--) { LayoutSelectionRow row = this.layoutList.Children[i] as LayoutSelectionRow; if (row.isSelected()) { selectedIndex = i; row.setSelected(false); } if (i == selectedIndex - 1) { row.setSelected(true); } } if (selectedIndex == 0) { LayoutSelectionRow row = this.layoutList.Children[this.layoutList.Children.Count - 1] as LayoutSelectionRow; row.setSelected(true); } else if (selectedIndex == -2)//If no row was found selected { LayoutSelectionRow row = this.layoutList.Children[this.layoutList.Children.Count - 1] as LayoutSelectionRow; row.setSelected(true); } })); }
public void ShowLayoutOverlay(WiiKeyMapper keyMapper) { if (this.hidden) { this.hidden = false; previousForegroundWindow = UIHelpers.GetForegroundWindow(); if (previousForegroundWindow == null) { previousForegroundWindow = IntPtr.Zero; } this.keyMapper = keyMapper; this.keyMapper.SwitchToDefault(); this.keyMapper.OnButtonDown += keyMapper_OnButtonDown; this.keyMapper.OnButtonUp += keyMapper_OnButtonUp; Dispatcher.BeginInvoke(new Action(delegate() { this.baseGrid.Opacity = 0.0; this.baseGrid.Visibility = Visibility.Visible; this.layoutChooserOverlay.Visibility = Visibility.Visible; this.Activate(); Color bordercolor = CursorColor.getColor(keyMapper.WiimoteID); //bordercolor.ScA = 0.5f; bordercolor.R = (byte)(bordercolor.R * 0.8); bordercolor.G = (byte)(bordercolor.G * 0.8); bordercolor.B = (byte)(bordercolor.B * 0.8); this.titleBorder.BorderBrush = new SolidColorBrush(bordercolor); this.title.Text = "Choose a layout for Wiimote " + keyMapper.WiimoteID; //this.title.Foreground = new SolidColorBrush(bordercolor); this.layoutList.Children.Clear(); foreach (LayoutChooserSetting config in this.keyMapper.GetLayoutList()) { string name = config.Title; string filename = config.Keymap; LayoutSelectionRow row = new LayoutSelectionRow(name, filename, bordercolor); //row.OnClick += row_OnClick; if (this.keyMapper.GetFallbackKeymap().Equals(filename)) { row.setSelected(true); } row.MouseDown += row_MouseDown; row.TouchDown += row_TouchDown; this.layoutList.Children.Add(row); } DoubleAnimation animation = UIHelpers.createDoubleAnimation(1.0, 200, false); animation.FillBehavior = FillBehavior.HoldEnd; animation.Completed += delegate(object sender, EventArgs pEvent) { }; this.baseGrid.BeginAnimation(FrameworkElement.OpacityProperty, animation, HandoffBehavior.SnapshotAndReplace); }), null); } }
void row_MouseDown(object sender, MouseButtonEventArgs e) { for (int i = this.layoutList.Children.Count - 1; i >= 0; i--) { LayoutSelectionRow row = this.layoutList.Children[i] as LayoutSelectionRow; row.setSelected(false); } LayoutSelectionRow senderRow = sender as LayoutSelectionRow; senderRow.setSelected(true); }
private void selectHighlighted() { Dispatcher.BeginInvoke(new Action(delegate() { for (int i = this.layoutList.Children.Count - 1; i >= 0; i--) { LayoutSelectionRow row = this.layoutList.Children[i] as LayoutSelectionRow; if (row.isSelected()) { this.Select_Layout(row.getFilename()); } } })); }
public void ShowLayoutOverlay(WiiKeyMapper keyMapper) { if (this.hidden) { this.keyMapper = keyMapper; this.keyMapper.SwitchToDefault(); Dispatcher.BeginInvoke(new Action(delegate() { this.baseGrid.Opacity = 0.0; this.baseGrid.Visibility = Visibility.Visible; this.layoutChooserOverlay.Visibility = Visibility.Visible; this.Activate(); Color bordercolor = CursorColor.getColor(keyMapper.WiimoteID); bordercolor.ScA = 0.5f; this.titleBorder.BorderBrush = new SolidColorBrush(bordercolor); this.title.Text = "Choose a layout for Wiimote " + keyMapper.WiimoteID; this.layoutList.Children.Clear(); foreach (JObject config in this.keyMapper.GetLayoutList()) { string name = config.GetValue("Title").ToString(); string filename = config.GetValue("Keymap").ToString(); LayoutSelectionRow row = new LayoutSelectionRow(name, filename, bordercolor); row.OnClick += Select_Layout; this.layoutList.Children.Add(row); } DoubleAnimation animation = UIHelpers.createDoubleAnimation(1.0, 200, false); animation.FillBehavior = FillBehavior.HoldEnd; animation.Completed += delegate(object sender, EventArgs pEvent) { }; this.baseGrid.BeginAnimation(FrameworkElement.OpacityProperty, animation, HandoffBehavior.SnapshotAndReplace); this.hidden = false; }), null); } }
public void ShowLayoutOverlay(WiiKeyMapper keyMapper) { if (this.hidden) { this.keyMapper = keyMapper; this.keyMapper.SwitchToDefault(); this.keyMapper.OnButtonDown += keyMapper_OnButtonDown; this.keyMapper.OnButtonUp += keyMapper_OnButtonUp; Dispatcher.BeginInvoke(new Action(delegate() { this.baseGrid.Opacity = 0.0; this.baseGrid.Visibility = Visibility.Visible; this.layoutChooserOverlay.Visibility = Visibility.Visible; this.Activate(); Color bordercolor = CursorColor.getColor(keyMapper.WiimoteID); //bordercolor.ScA = 0.5f; bordercolor.R = (byte)(bordercolor.R * 0.8); bordercolor.G = (byte)(bordercolor.G * 0.8); bordercolor.B = (byte)(bordercolor.B * 0.8); this.titleBorder.BorderBrush = new SolidColorBrush(bordercolor); this.title.Text = "Choose a layout for Wiimote " + keyMapper.WiimoteID; //this.title.Foreground = new SolidColorBrush(bordercolor); this.layoutList.Children.Clear(); foreach (LayoutChooserSetting config in this.keyMapper.GetLayoutList()) { string name = config.Title; string filename = config.Keymap; LayoutSelectionRow row = new LayoutSelectionRow(name, filename, bordercolor); //row.OnClick += row_OnClick; if(this.keyMapper.GetFallbackKeymap().Equals(filename)) { row.setSelected(true); } row.MouseDown += row_MouseDown; row.TouchDown += row_TouchDown; this.layoutList.Children.Add(row); } DoubleAnimation animation = UIHelpers.createDoubleAnimation(1.0, 200, false); animation.FillBehavior = FillBehavior.HoldEnd; animation.Completed += delegate(object sender, EventArgs pEvent) { }; this.baseGrid.BeginAnimation(FrameworkElement.OpacityProperty, animation, HandoffBehavior.SnapshotAndReplace); this.hidden = false; }), null); } }