In header
class Xxx {
...
static sometype dict_;
...
In source:sometype Xxx::dict_;
class Xxx {
...
static sometype dict_;
...
In source:sometype Xxx::dict_;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
PeekMessage() - Looks for message matching the filter criteria. Returns immediately. Whether the matching message is removed from the queue or not is determined by the last parameter of the methoddo
{
if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
} while (msg.message != WM_QUIT);
Neither GetMessage or PeekMessage will remove WM_PAINT messages unless the update area of the message is null!<Window ...
<!-- First define the namespace for charting -->
xmlns:charting="clr-namespace:
System.Windows.Controls.DataVisualization.Charting;
assembly=System.Windows.Controls.DataVisualization.Toolkit"
<charting:Chart Name="pieChart">
<charting:PieSeries ItemsSource="{Binding}"
IndependentValueBinding="{Binding Path=Description}"
DependentValueBinding="{Binding Path=Percentage}"
/>
</charting:Chart>
Set the Pie chart wedgesvoid AssignPieChartWedges()
{
System.IO.DriveInfo cdrive = new System.IO.DriveInfo("C");
double availPercentage = Math.Round(100.0d *
(double)cdrive.TotalFreeSpace / (double)cdrive.TotalSize);
List<DrivePercentage> dpList = new List<DrivePercentage>();
dpList.Add(new DrivePercentage()
{ Percentage=availPercentage, Description="Free" });
dpList.Add(new DrivePercentage()
{ Percentage=100.0d-availPercentage, Description="Used" });
pieChart.DataContext = dpList;
}
public static class DriveInfoExtender
{
public static bool IsDriveFree(string drive)
{
if (string.IsNullOrEmpty(drive) || !char.IsLetter(drive[0]))
return false;
if (drive.Length >= 2)
drive = drive.Substring(0,1).ToUpper();
bool isFree = true;
DriveInfo[] nonFreeDrives = System.IO.DriveInfo.GetDrives();
foreach (DriveInfo di in nonFreeDrives)
{
if (di.Name.StartsWith(drive))
{
isFree = false;
break;
}
}
return isFree;
}
}
string fullPath = PathCombine(pathRoot, relativePath);
if (File.Exists(fullPath))
{
FileAttributes fas = File.GetAttributes(fullPath);
if (fas.Contains(FileAttributes.ReadOnly))
File.SetAttributes(fullPath, FileAttributes.Normal);
File.Delete(fullPath);
}