This is a migrated thread and some comments may be shown as answers.

How to rotate cube programmatically?

3 Answers 98 Views
Cube
This is a migrated thread and some comments may be shown as answers.
Manny
Top achievements
Rank 1
Manny asked on 20 Nov 2009, 03:34 PM
I'm looking for a "Rotate" method in the cube so I can start / stop rotating from code-behind but can't find it. My solution is to set all automatic rotation off. Then I have "spinner" thread I create (it references internal classes from my proprietary Silverlight framework but hopefully you get the idea).

Would be nice to have a "StartRotate() / StopRotate()" method that allowed rotation to be controlled from code. Or did I miss something *really* obvious??

Attached the class for anyone interested...the thread class provides "runOneLoop" which is invoked every ThreadLoopSleep intervals. Starting / stopping the thread is handled in the base thread class. But it's easy enough to build these things just using CLR threads now...

 

    /// <summary>
    /// Spin the cube...
    /// </summary>
    internal class Spinner : Abr.CodeLibrary.Utils.Threading.BaseThread
    {
      // from caller
      private System.Threading.SynchronizationContext _currentContext;
      private Telerik.Windows.Controls.RadCube _cube;
      private Abr.CodeLibrary.Utils.Logger.LoggerHolder _lh;

      /// <summary>
      /// Create object
      /// </summary>
      /// <param name="currentContext">UI context for updating</param>
      /// <param name="cube">The cube to spin</param>
      /// <param name="lh">Logging facilities</param>
      public Spinner(
        System.Threading.SynchronizationContext currentContext,
        Telerik.Windows.Controls.RadCube cube,
        Abr.CodeLibrary.Utils.Logger.LoggerHolder lh
      )
        : base("Spinner", lh.LoggerOrNull)
      {
        _currentContext = currentContext;
        _cube = cube;
        _lh = lh;

        // not sure about this
        this.ThreadLoopSleep = (int)(300 / _cube.RotateSpeed);
      } //ctor

      /// <summary>
      /// Start the spinning
      /// </summary>
      public void Start() {
        // start the spinner
        Abr.CodeLibrary.Utils.Threading.ThreadStartArgs tsa = new Abr.CodeLibrary.Utils.Threading.ThreadStartArgs();
        Start(tsa);
      } //Start

      /// <summary>
      /// Run the spinner
      /// </summary>
      protected override void threadRunOneLoop()
      {
        Abr.CodeLibrary.Sl.Utils.Global.UpdateUIThread(
          _currentContext,
          new System.Threading.SendOrPostCallback(
            delegate(object state)
            {
              if (_cube.SelectedIndex >= 5)
              {
                _cube.SelectedIndex = 0;
              }
              else
              {
                _cube.SelectedIndex += 1;
              } //if
            }),
          _lh
          );
      } //threadRunOneLoop
    } //Spinner

3 Answers, 1 is accepted

Sort by
0
Bobi
Telerik team
answered on 23 Nov 2009, 02:29 PM
Hi Manny,

I'd like to apologize, but currently  RadCube does not currently expose any proper event/method/property for Start/Stop rotation or spinning. However, if there is enough demand for this functionality, we will definitely include it in our future releases of RadCube.
Thank you for your feedback your Telerik points are updated.






Regards,
Boryana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Nic
Top achievements
Rank 1
answered on 15 Jun 2010, 04:07 PM
When will the next release be with the Rotation control functions?
0
Tina Stancheva
Telerik team
answered on 18 Jun 2010, 02:36 PM
Hello Andre,

Unfortunately, the implementation of such a rotation functionality of the RadCube isn't scheduled for now and I cannot bind to a specific date.

All the best,
Tina Stancheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Cube
Asked by
Manny
Top achievements
Rank 1
Answers by
Bobi
Telerik team
Nic
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or