本文整理汇总了C#中Progress.Focus方法的典型用法代码示例。如果您正苦于以下问题:C# Progress.Focus方法的具体用法?C# Progress.Focus怎么用?C# Progress.Focus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Progress
的用法示例。
在下文中一共展示了Progress.Focus方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: B_MangleSource_Click
private void B_MangleSource_Click(object sender, RoutedEventArgs e)
{
//validate input
if (Text_RootFolder.Text.Length == 0)
{
MessageBox.Show("Please select a valid root folder", "", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
DirectoryInfo rootInfo = new DirectoryInfo(Text_RootFolder.Text);
if (!rootInfo.Exists)
{
MessageBox.Show("Please select a valid root folder","",MessageBoxButton.OK,MessageBoxImage.Error);
return;
}
if (Text_NewNotice.Text.Length == 0)
{
MessageBox.Show("Please enter a new copyright message", "", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
if (Text_FileTypes.Text.Length == 0)
{
MessageBox.Show("Please enter at least one file type to mangle", "", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
//build filetype list
_fileTypes = Text_FileTypes.Text.Split(new[] { ' ', ','}, StringSplitOptions.RemoveEmptyEntries);
//display UI
_window = new Progress();
_window.T_Current.Content = "Currently Mangling:";
_window.T_Files.Content = "Files Mangled:";
_window.Show();
_window.Focus();
//recurse
long start;
long stop;
long frequency = Stopwatch.Frequency;
//Activator
start = Stopwatch.GetTimestamp();
Recurse(rootInfo);
stop = Stopwatch.GetTimestamp();
double time = (double)(stop - start) / (double)frequency;
//mangle files
//Display results
_window.Close();
MessageBox.Show("Mangled " + _filesMangled + " source files in " + (time * 1000.0).ToString("F1") + " mS");
}
示例2: CalibrateSoundCard
public bool CalibrateSoundCard(Progress progress, int card)
{
if(!chkPower.Checked)
{
MessageBox.Show("Power must be on in order to calibrate Soundcard.", "Power Is Off",
MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false;
}
Audio.testing = true;
progress.SetPercent(0.0f);
double tx_volume = Audio.RadioVolume; // save current TX volume
double rx_volume = Audio.MonitorVolume; // save current RX volume
if(num_channels == 4 || num_channels == 6)
{
chkMOX.Checked = true;
Thread.Sleep(200);
Hdw.TransmitRelay = false;
Audio.RadioVolume = 1.0; // set volume to max
Audio.MonitorVolume = 0.0;
}
else
{
Mixer.SetMainVolume(mixer_id1, 100);
Mixer.SetWaveOutVolume(mixer_id1, 100);
Audio.MonitorVolume = 1.0;
}
Audio.RX1OutputSignal = Audio.SignalSource.SINE; // Start sending tone
progress.Focus();
while(progress.Visible == true) // keep sending tone until abort is pressed
Thread.Sleep(100);
Audio.RX1OutputSignal = Audio.SignalSource.RADIO; // stop sending tone
if(num_channels > 2)
{
Thread.Sleep(200);
chkMOX.Checked = false;
}
Audio.RadioVolume = tx_volume; // restore TX volume
Audio.MonitorVolume = rx_volume; // restore RX volume
Audio.testing = false;
return true;
}
示例3: CalibrateSoundCard
public bool CalibrateSoundCard(Progress progress, int card)
{
if (!PowerOn)
{
MessageBox.Show("Power must be on in order to calibrate.", "Power Is Off",
MessageBoxButtons.OK, MessageBoxIcon.Stop);
return false;
}
Audio.testing = true;
progress.SetPercent(0.0f);
double tx_volume = Audio.RadioVolume; // save current TX volume
double rx_volume = Audio.MonitorVolumeLeft; // save current RX volume
bool twotone = Audio.two_tone; // save current two tone setting
Audio.two_tone = false;
if (num_channels == 4 || num_channels == 6)
{
chkMOX.Checked = true;
Thread.Sleep(200);
Audio.RadioVolume = 1.0; // set volume to max
Audio.MonitorVolumeLeft = 0.0;
Audio.MonitorVolumeRight = 0.0;
}
else
{
switch (WinVer)
{
case WindowsVersion.Windows7:
case WindowsVersion.Windows8:
case WindowsVersion.WindowsVista:
break;
default:
{
Mixer.SetMainVolume(mixer_id1, 100);
Mixer.SetWaveOutVolume(mixer_id1, 100);
}
break;
}
Audio.MonitorVolumeLeft = 1.0;
Audio.MonitorVolumeRight = 1.0;
}
Audio.CurrentAudioState1 = Audio.AudioState.SINL_COSR; // Start sending tone
progress.Focus();
while (progress.Visible == true) // keep sending tone until abort is pressed
Thread.Sleep(100);
Audio.CurrentAudioState1 = Audio.AudioState.DTTSP; // stop sending tone
if (num_channels > 2)
{
Thread.Sleep(200);
chkMOX.Checked = false;
}
Audio.RadioVolume = tx_volume; // restore TX volume
Audio.MonitorVolumeLeft = rx_volume; // restore RX volume
Audio.MonitorVolumeRight = rx_volume; // restore RX volume
Audio.two_tone = twotone; // restore two tone setting
Audio.testing = false;
return true;
}
示例4: ToBase
public static bool ToBase(string firetakeNumber)
{
var res = true;
var xml = XDocument.Load("firetakes.xml");
var node = xml.Element("Firetakes").Element("Firetake");
var progress = new Progress();
progress.Show();
progress.SetBarSize(node.Elements().Count<XElement>()+1);
try
{
progress.Focus();
for (int i = 0; i < int.Parse(firetakeNumber); i++)
{
node = node.NextNode as XElement;
}
foreach (XElement student in node.Elements())
{
var commandText = "INSERT INTO FIRETAKE(DATETAKEN,STATUS,GRADE,COMMENT,DELETED,STUDENT_ID,TEACHER_ID,SCORE) VALUES('" +
node.Attribute("Time").Value + "',0," + student.Attribute("Mark").Value + ",'',0," + student.Attribute("Id").Value + "," +
node.Attribute("Teacher").Value + "," + student.Attribute("Score").Value + ")";
var con = new MySqlConnection(conStr);
var com = new MySqlCommand(commandText, con);
con.Open();
com.ExecuteNonQuery();
con.Close();
progress.Increment();
System.Threading.Thread.Sleep(200);
}
node.Remove();
xml.Save("firetakes.xml");
}
catch
{
res = false;
}
progress.Close();
return res;
}