VS 2010 Beta1 "Historical Data Has not been Collected" - visual-studio-2010

I am trying out the Historical Debugger in VS2010 Beta 1.
I have it turned on in the settings (at least I think I do), but when I try to examine objects the value is:
[Historical Data Has Not Been Collected]
Any Ideas how to get this to show the actual value?
Here is the code in question:
public partial class Form1 : Form
{
public Form1()
{InitializeComponent();}
private void button1_Click(object sender, EventArgs e)
{
int numer = Int32.Parse(txtNumerator.Text) ;
int denom = Int32.Parse(txtDemoninator.Text);
float answer = DivideValues(numer, denom);
txtAnswer.Text = answer.ToString();
}
private static float DivideValues(int numer, int denom)
{
float answer = numer / denom;
return answer;
}
}

To get it to work right you need to use the tree view in the Debug History Window. The navigation arrows in the gutter seem to be more of a distraction than a help as it lets you get to areas that are not recorded.
Also, local variables are not recorded. This is by design.

Related

Unity - TextMeshPro text object doesn't update

I have been using TMP objects in several instances in my game, but all of a sudden it decides not to work on a certain object.
public class BeforeRoundTimer : MonoBehaviour
{
public TextMeshProUGUI timer;
private Timer oneSecondTimer;
private int time = 5;
public void StartCountdown()
{
Debug.Log("One second timer");
oneSecondTimer = new Timer(1000);
oneSecondTimer.Elapsed += UpdateTime;
oneSecondTimer.Enabled = true;
oneSecondTimer.AutoReset = true;
oneSecondTimer.Start();
}
private void UpdateTime(object source, ElapsedEventArgs e)
{
if(time == 0)
{
oneSecondTimer.Stop();
return;
}
timer.text = $"{time}";
time--;
}
}
I know the text is updating because I put debug statements (I have since removed them) and they fired when UpdateTime() is called. I also viewed the inspector when the game was playing, and the text value would update in front of my eyes. The text only changes when I make some stylistic change to it (i.e. making it bold, changing the font asset, including changing the text itself). I have looked back to my old code and it basically runs the exact same way, but it actually changes in game.
Ok so after taking a break, I decided to find another way to call my method every second. Instead of using a Timer, I decided to use Unity's InvokeRepeating() function.
public class BeforeRoundTimer : MonoBehaviour
{
public TextMeshProUGUI timer;
private int count = 0;
public void StartCountdown()
{
InvokeRepeating(nameof(UpdateTime), 0, 1f);
}
private void UpdateTime()
{
if(count == 5)
{
CancelInvoke("UpdateTime");
return;
}
Debug.Log("Update Time");
timer.text = $"{5 - count}";
count++;
}
}
One thing I noticed when trying to use the Timer in a different way is that it was only updating the text value every other second. It ran 10 times (I put a Debug.Log() in UpdateTime()) but only changed the value every other time while not actually updating the TMP. You could replace nameof(UpdateTime) with "UpdateTime", but Visual Studio recommended that I use the former so I went with that.
In short: don't use timers, use Unity's InvokeRepeating() function because it works perfectly. It is actually very similar to JavaScript's setInterval() which I found interesting.

UWP: Disabling Tooltips for MediaTransportControls - Element

I am trying to simply disable the tooltips for <MediaTransportControls> elements. However, the tooltip still shows as can be seen in this screenshot.
Using <ToolTipService> has no effect whatsoever on the Tooltip shown. The tooltips show for all elements in the MediaTransportControl as is shown in this screenshot of ToolTip:
Currently, ToolTipService does not provide this method to disable ToolTip. For your requirement, you could use SetToolTip method to set all elements tooltip as null in the MediaTransportControls. And you could use VisualTreeHelper to find all child element. And I also create a MediaTransportControlsExtension class that you could use directly.
public static class MediaTransportControlsExtension
{
public static void DisableTootip(this DependencyObject control)
{
int count = VisualTreeHelper.GetChildrenCount(control);
for (int i = 0; i < count; i++)
{
var child = VisualTreeHelper.GetChild(control, i);
ToolTipService.SetToolTip(child, null);
DisableTootip(child);
}
}
}
Usage
Please note, you need invoke this method after all element initialized.
private void MainMPE_Loaded(object sender, RoutedEventArgs e)
{
MainMPE.TransportControls.DisableTootip();
}

visual c++ dataGridView cellclick event

I googled about cellclick event in dataGridView for c++. All results are about c#.
My dataGridView1 selection mode is FullRowSelect. My target is when I clicked to any cell (row), detect that row and do something.
int i;
private: System::Void dataGridView1_CellDoubleClick(System::Object^ sender, System::Windows::Forms::DataGridViewCellEventArgs^ e)
{
if (double clicked row 1)
{
int = 1;
}
if (double clicked row 2)
{
int = 2;
}
}
I need any simple example or any source for learning. Thank you.
ok found a solution on c# tutorials and converted for c++-clr
if (e->RowIndex == 1) //that's what i looking for, you can use ColumnIndex too.
{
int = 1;
}
works perfect for c++-clr.
DataGridViewCell.RowIndex Property on msdn helps too.

Xamarin.Forms: Scroll effect with collapsing sections of the screen

I'm looking for help on how to do this effect:
On a page is a ListView that is 3cm from the top of the page, below a 3cm tall logo. When the user scrolls up the list view, the entire list view scrolls up to take up the 1/2 the space of the logo. Reverse when going down. So basically the Logo gets it's size allocation reduced. Both the logo and the listview can be in a scroll view, but how do I resize the logo
I'm posting the answer you placed on another site in case others searching for the solution only come across this article.
private const int ScrollMinLimit = 0;
private const int ScrollMaxLimit = 190;
private void ScrollView_Scrolled(object sender, ScrolledEventArgs e)
{
var val = MathHelper.ReMap(e.ScrollY, ScrollMinLimit, ScrollMaxLimit, 1, 0);
this.infoPanel.Scale = val;
this.infoPanel.Opacity = val;
}
and
public static class MathHelper
{
public static double ReMap(double oldValue, double oldMin, double oldMax, double newMin, double newMax)
{
return (((oldValue - oldMin) / (oldMax - oldMin)) * (newMax - newMin)) + newMin;
}
}

Custom ListPopupWindow rendered in different widths

I am using Android.Support.V7.Widget.ListPopupWindow as a Drop-Down Menu from a Button within my layout. Here is the code snippet I am using
void MenuIcon_Click (object sender, EventArgs e)
{
popupWindow = new Android.Support.V7.Widget.ListPopupWindow (this);
popupAdapter = new MenuPopUpAdapter (this,selectedIndex,menuList);
popupAdapter.ItemClick+= PopupAdapter_ItemClick;
popupWindow.SetAdapter (popupAdapter);
popupWindow.AnchorView = menuButton;
Display display = WindowManager.DefaultDisplay;
Point size = new Point();
display.GetSize (size);
int width = size.X;
popupWindow.Width =160;
popupWindow.Show ();
}
But while debugging I noted that, even though I have given it a static width, it is rendered differently in different devices. What is causing this issue ?
This is because of the different screen densities in Android devices. You need to mention dimensions in DPs(Density Independent Pixels) to overcome this issue. This documentation from Google will be a nice read
You can get the corresponding pixel value to be mentioned while setting dimensions programatically from this method.
public int dpToPx(int dp) {
DisplayMetrics displayMetrics = Resources.DisplayMetrics;
int px = (int)Math.Round(dp * (displayMetrics.Density));
return px;
}
You may modify the code as above to fix the issue
popupWindow.Width =dpToPx(160);

Resources