コード例 #1
0
        /// <summary>
        /// Called when the radio button signals that the user want to change the light type.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param>
        private void EhLightTypeChanged(object sender, RoutedEventArgs e)
        {
            if (_lock.IsNotLocked)
            {
                IDiscreteLight newLight = null;
                if (object.ReferenceEquals(sender, _guiNotUsed))
                {
                    newLight = null;
                }
                else if (object.ReferenceEquals(sender, _guiDirectional))
                {
                    newLight = new Altaxo.Graph.Graph3D.Lighting.DirectionalLight();
                }
                else if (object.ReferenceEquals(sender, _guiPoint))
                {
                    newLight = new Altaxo.Graph.Graph3D.Lighting.PointLight();
                }
                else if (object.ReferenceEquals(sender, _guiSpot))
                {
                    newLight = new Altaxo.Graph.Graph3D.Lighting.SpotLight();
                }
                else
                {
                    throw new NotImplementedException();
                }

                if (newLight?.GetType() != SelectedValue?.GetType())
                {
                    ChangeHostControlAccordingToNewLight(newLight);
                    SelectedValueChanged?.Invoke(this, EventArgs.Empty);
                }
            }
        }
コード例 #2
0
		/// <summary>
		/// Called when the radio button signals that the user want to change the light type.
		/// </summary>
		/// <param name="sender">The sender.</param>
		/// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param>
		private void EhLightTypeChanged(object sender, RoutedEventArgs e)
		{
			if (_lock.IsNotLocked)
			{
				IDiscreteLight newLight = null;
				if (object.ReferenceEquals(sender, _guiNotUsed))
				{
					newLight = null;
				}
				else if (object.ReferenceEquals(sender, _guiDirectional))
				{
					newLight = new Altaxo.Graph.Graph3D.Lighting.DirectionalLight();
				}
				else if (object.ReferenceEquals(sender, _guiPoint))
				{
					newLight = new Altaxo.Graph.Graph3D.Lighting.PointLight();
				}
				else if (object.ReferenceEquals(sender, _guiSpot))
				{
					newLight = new Altaxo.Graph.Graph3D.Lighting.SpotLight();
				}
				else
				{
					throw new NotImplementedException();
				}

				if (newLight?.GetType() != SelectedValue?.GetType())
				{
					ChangeHostControlAccordingToNewLight(newLight);
					SelectedValueChanged?.Invoke(this, EventArgs.Empty);
				}
			}
		}