-
Off the top of my head, I think this might be the fastest way. Just keep in mind this is not thread safe, nor possibly the best implementation...
Code:
System.Threading.Thread thread = new System.Threading.Thread(addressOf);
thread.Start();
private void addressOf()
{
}
-
If you use the timer class in System.Threading ( System.Threading.Timer), that will execute on it's own thread. But as mentioned, it's not safe to manipulate the UI directly. System.windows.Forms.Timer executes on the UI thread, so it is safe to make changes to the UI in its methods.
Mark
-
I have an issue with my sliders that i can't to move !
This is my code:
Code:
#region Sliders
/// <summary>
///
/// </summary>
/// <param name="SLD"></param>
/// <returns>-1 for not processed</returns>
public long ReturnSlider(ref string SLD)
{
switch (SLD.ToLower())
{
// SETTINGS
case "rrcoretemp_updatedelay":
return ((UpdateDelay) * 65535 / DelayMax);
case "rrcoretemp_maxtemp_alarm":
return ((CoreTempAlarm) * 65535 / CoreTempMax);
}
return -1;
}
//*****************************************************************
//* This Function will be called with requested slider code
//* specified at the skin file. Simply return the value of the
//* slider to be displayed. Values should range from 0 to 65535.
//* It is also possible to intercept/change the slider code before
//* it is processed in RideRunner (to overwrite existing codes).
//*****************************************************************
public long SetSlider(ref string SLD,ref int Value, ref bool Direction)
{
return -1;
switch (SLD.ToLower())
{
// SETTINGS
case "rrcoretemp_maxtemp_alarm":
CoreTempAlarm = (Value * CoreTempMax) / 65535;
case "rrcoretemp_updatedelay":
UpdateDelay = (Value * DelayMax) / 65535;
}
}
Where is my error please ?
-
In the second function, your returning -1 as the first line, thus no other code in the function has a chance to run. Not sure if that's the error/issue causing it not to work. If not, what error are you getting, or what line breaks for debugging?
-
In vb.net the sliders are defined as:
Code:
'*****************************************************************
'* This Function will be called with requested slider code
'* specified at the skin file. Simply return the value of the
'* slider to be displayed. Values should range from 0 to 65536.
'* It is also possible to intercept/change the slider code before
'* it is processed in RideRunner (to overwrite existing codes).
'*****************************************************************
Public Function ReturnSlider(ByRef SLD As String) As Integer
'This tells RR that the Slider was not processed in this plugin
ReturnSlider = -1
Select Case LCase(SLD)
' SETTINGS
Case "rr_p2140_setting_polldelay"
ReturnSlider = Math.Round((TempPluginSettings.PollDelay / 10) * 65535)
Case "rr_p2140_setting_lowvbatt"
ReturnSlider = Math.Round((((TempPluginSettings.LowVbatt - 9) * 10) * 65535) / 20)
End Select
End Function
'*****************************************************************
'* This Function will be called with requested slider code
'* specified at the skin file. Simply return the value of the
'* slider to be displayed. Values should range from 0 to 65535.
'* It is also possible to intercept/change the slider code before
'* it is processed in RideRunner (to overwrite existing codes).
'*****************************************************************
Public Sub SetSlider(ByRef SLD As String, ByRef Value As Integer, ByRef Direction As Boolean)
Select Case LCase(SLD)
' SETTINGS
Case "rr_p2140_setting_lowvbatt"
TempPluginSettings.LowVbatt = (Math.Round((Value * 20) / 65535) * 0.1) + 9
Case "rr_p2140_setting_polldelay"
TempPluginSettings.PollDelay = Math.Round((Value * 10) / 65535)
End Select
End Sub
-
definitely remove the return =1 from the set slider routine. (it's not there in the VB6 example)
in the first routine make the return=-1 a case else (I assume C has a case else statement) rather than where it currently is
-
detlion1643 is correct. In the vb code, you assign a value to ReturnSlider, which is returned once all the relevant code in the function exits. In C# the "return" keyword exits the method immediately, preventing any further execution of code within the method. Try this:
Code:
public long SetSlider(ref string SLD,ref int Value, ref bool Direction)
{
switch (SLD.ToLower())
{
// SETTINGS
case "rrcoretemp_maxtemp_alarm":
{
CoreTempAlarm = (Value * CoreTempMax) / 65535;
return CoreTempAlarm;
}
case "rrcoretemp_updatedelay":
{
UpdateDelay = (Value * DelayMax) / 65535;
return UpdateDelay;
}
}
return -1;
}
P.S. you don't need the "ref" keyword here, since you are not changing the values being referenced. You're only using them in calculations within the method. Also, you're not using the "direction" Boolean at all, so it's unnecessary.
Mark
-
Cool,
Greats thanks VegasGuy that run very well now !!!
Thanks all guys also !!!