/// <summary> /// Initializes a new instance of the <see cref="SwitchIconMaterial"/> class. /// </summary> /// <param name="type">The type.</param> public SwitchIconMaterial(SwitchIconType type) : base() { Gliding = false; mSwitchType = type; //fetch the two bitmaps try { SwitchToType(type); } catch (Exception exc) { throw new InconsistencyException("The necessary resource could not be found.", exc); } }
/// <summary> /// Sets the switch to the given <see cref="SwitchIconType"/> /// </summary> /// <param name="type"></param> private void SwitchToType(SwitchIconType type) { switch (type) { case SwitchIconType.UpDown: downBmp = GetBitmap("Resources.down.ico"); upBmp = GetBitmap("Resources.up.ico"); this.Icon = downBmp; break; case SwitchIconType.PlusMinus: downBmp = GetBitmap("Resources.plus.ico"); upBmp = GetBitmap("Resources.minus.ico"); this.Icon = downBmp; break; default: break; } }