public void TestFixtureSetUp() { if (_dummyCulture == null) throw new Exception("Error setting up test - dummyCulture should not be NULL"); if (CultureInfo.InvariantCulture.Equals(_dummyCulture)) throw new Exception("Error setting up test - dummyCulture should not be invariant"); if (_dummyCulture2 == null) throw new Exception("Error setting up test - dummyCulture2 should not be NULL"); if (CultureInfo.InvariantCulture.Equals(_dummyCulture2)) throw new Exception("Error setting up test - dummyCulture2 should not be invariant"); if (_dummyCulture2.Equals(_dummyCulture)) throw new Exception("Error setting up test - dummyCulture2 should not be the same as dummyCulture"); // for testing purposes, set up the converter for a specific culture to have a custom mapping // normally, you would use TypeDescriptor.GetConverter, but we want to keep the test appdomain clean of these testing mods XMouseButtonsConverter converter = new XMouseButtonsConverter(_dummyCulture); IDictionary<XMouseButtons, string> relocalizedNames = new Dictionary<XMouseButtons, string>(); relocalizedNames[XMouseButtons.Left] = "LMouse"; relocalizedNames[XMouseButtons.Right] = "RMouse"; relocalizedNames[XMouseButtons.Middle] = "Mouse3"; relocalizedNames[XMouseButtons.XButton1] = "Mouse4"; relocalizedNames[XMouseButtons.XButton2] = XMouseButtonsConverter.ButtonSeparator.ToString(); converter.LocalizedNames = relocalizedNames; _converter = converter; }
public void TestFixtureSetUp() { if (_dummyCulture == null) { throw new Exception("Error setting up test - dummyCulture should not be NULL"); } if (CultureInfo.InvariantCulture.Equals(_dummyCulture)) { throw new Exception("Error setting up test - dummyCulture should not be invariant"); } if (_dummyCulture2 == null) { throw new Exception("Error setting up test - dummyCulture2 should not be NULL"); } if (CultureInfo.InvariantCulture.Equals(_dummyCulture2)) { throw new Exception("Error setting up test - dummyCulture2 should not be invariant"); } if (_dummyCulture2.Equals(_dummyCulture)) { throw new Exception("Error setting up test - dummyCulture2 should not be the same as dummyCulture"); } // for testing purposes, set up the converter for a specific culture to have a custom mapping // normally, you would use TypeDescriptor.GetConverter, but we want to keep the test appdomain clean of these testing mods XMouseButtonsConverter converter = new XMouseButtonsConverter(_dummyCulture); IDictionary <XMouseButtons, string> relocalizedNames = new Dictionary <XMouseButtons, string>(); relocalizedNames[XMouseButtons.Left] = "LMouse"; relocalizedNames[XMouseButtons.Right] = "RMouse"; relocalizedNames[XMouseButtons.Middle] = "Mouse3"; relocalizedNames[XMouseButtons.XButton1] = "Mouse4"; relocalizedNames[XMouseButtons.XButton2] = XMouseButtonsConverter.ButtonSeparator.ToString(); converter.LocalizedNames = relocalizedNames; _converter = converter; }
private bool ValidateMouseToolInitiallyActive(AbstractActionModelTreeLeafAction node, bool initiallyActive) { // if we're just synchronizing the value due to another update action, short the validation request if (_updatingKeyStrokes) { return(true); } // find the mouse button to which this tool is assigned var mouseButton = _mouseButtonMap.FindKey(node.ActionId, XMouseButtons.Left); // check for presence of another initial tool for this button if (initiallyActive && _initialMouseToolsMap.IsAssignedToOther(mouseButton, node.ActionId)) { IList <AbstractActionModelTreeLeafAction> actions = _actionMap[_initialMouseToolsMap[mouseButton]]; if (actions.Count > 0) { string message = string.Format(SR.MessageMouseButtonInitialToolAlreadyAssigned, XMouseButtonsConverter.Format(mouseButton), actions[0].Label); DialogBoxAction result = base.Host.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo); if (result != DialogBoxAction.Yes) { return(false); } } } return(true); }