/// <summary> /// is invoked when the spin field is spun up. /// </summary> /// <param name="spinEvent">The spin event.</param> public void up(SpinEvent spinEvent) { try { // get the control that has fired the event, XControl xControl = (XControl)spinEvent.Source; XControlModel xControlModel = xControl.getModel(); XPropertySet xPSet = (XPropertySet)xControlModel; String sName = (String)xPSet.getPropertyValue("Name").Value; // just in case the listener has been added to several controls, // we make sure we refer to the right one if (sName.Equals("FormattedField1")) { double fvalue = (double)(xPSet.getPropertyValue("EffectiveValue")).Value; System.Diagnostics.Debug.WriteLine("Controlvalue: " + fvalue); // insert your code here to validate the value of the control... } } catch (unoidl.com.sun.star.uno.Exception ex) { System.Diagnostics.Debug.WriteLine("uno.Exception:"); System.Diagnostics.Debug.WriteLine(ex); } catch (System.Exception ex) { System.Diagnostics.Debug.WriteLine("System.Exception:"); System.Diagnostics.Debug.WriteLine(ex); } }
/// <summary>Send spinning result notifications</summary> /// <param name="number">Ranom spinned number</param> public void Spin(Number number) { var sb = new StringBuilder(); sb.Append($"Players: {SpinEvent.GetInvocationList().Length}, Events: "); SpinnerEventArgs spinEventArgs = new SpinnerEventArgs(number); if (number.Color == Number.EColor.BLACK) { sb.Append("BLACK, "); BlackColorEvent?.Invoke(this, spinEventArgs); } if (number.Color == Number.EColor.RED) { sb.Append("RED, "); RedColorEvent?.Invoke(this, spinEventArgs); } if (number.Color == Number.EColor.GREEN) { sb.Append("GREEN, "); GreenColorEvent?.Invoke(this, spinEventArgs); } if (number.Value % 2 == 0) { sb.Append("EVEN, "); EvenNumberEvent?.Invoke(this, spinEventArgs); } if (!(number.Value % 2 == 0)) { sb.Append("ODD, "); OddNumberEvent?.Invoke(this, spinEventArgs); } sb.Append(number.Value); LogManager.GetCurrentClassLogger().Info(sb.ToString()); SpinEvent?.Invoke(this, spinEventArgs); }
/// <summary> /// is invoked when the spin field is set to the upper value. /// </summary> /// <param name="spinEvent">The spin event.</param> public void last(SpinEvent spinEvent) { }
/// <summary> /// is invoked when the spin field is set to the lower value. /// </summary> /// <param name="spinEvent">The spin event.</param> public void first(SpinEvent spinEvent) { }
/// <summary> /// is invoked when the spin field is spun down. /// </summary> /// <param name="spinEvent">The spin event.</param> public void down(SpinEvent spinEvent) { }