本文整理汇总了C#中System.Windows.Controls.TabItem.BeginInit方法的典型用法代码示例。如果您正苦于以下问题:C# TabItem.BeginInit方法的具体用法?C# TabItem.BeginInit怎么用?C# TabItem.BeginInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.TabItem
的用法示例。
在下文中一共展示了TabItem.BeginInit方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AWindow
public AWindow(IWindow owner)
: base(owner, Core.settings)
{
TabItem from_me = new TabItem();
from_me.BeginInit();
from_me.EndInit();
this.Background = from_me.Background;
ProgressBar from_color = new ProgressBar();
default_progress_color = from_color.Foreground;
// Taskbar progress setup
TaskbarItemInfo = new TaskbarItemInfo();
// var uriSource = new Uri(System.IO.Path.Combine(Core.ExecutablePath, "masgau.ico"), UriKind.Relative);
System.Drawing.Icon ico = Properties.Resources.MASGAUIcon;
this.Icon = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(
ico.ToBitmap().GetHbitmap(),
IntPtr.Zero,
Int32Rect.Empty,
BitmapSizeOptions.FromEmptyOptions());
if (owner != null) {
this.Owner = owner as System.Windows.Window;
this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
} else {
this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
}
}
示例2: RefreshWeightsView
private void RefreshWeightsView()
{
if (designPageViewModel.TabItems != null)
designPageViewModel.TabItems.Clear();
else
designPageViewModel.TabItems = new ObservableCollection<TabItem>();
foreach (Layers layer in pageViewModel.NeuralNetwork.Layers)
{
if (layer.LayerType == LayerTypes.Convolutional || layer.LayerType == LayerTypes.ConvolutionalSubsampling)
{
TabItem tb = new TabItem();
tb.BeginInit();
tb.UseLayoutRounding = true;
tb.SnapsToDevicePixels = true;
tb.Header = layer.LayerIndex.ToString();
tb.Content = layer.GetMappedLayerWeights();
tb.EndInit();
designPageViewModel.TabItems.Add(tb);
}
}
needRefreshWeightsView = false;
}
示例3: Calculate
private void Calculate()
{
(MainView.DataContext as PageViewModel).CommandToolBar[0].IsEnabled = false;
calculatePageViewModel.IsValid = false;
MainView.Status.Text = "Calculating...";
Mouse.OverrideCursor = Cursors.Wait;
DoubleImageData pattern;
if (calculatePageViewModel.UseTrainingSet)
{
if (calculatePageViewModel.UseDistortions)
{
pageViewModel.DataProvider.SeverityFactor = calculatePageViewModel.SeverityFactor;
pageViewModel.DataProvider.MaxRotation = calculatePageViewModel.MaxRotation;
pageViewModel.DataProvider.MaxScaling = calculatePageViewModel.MaxScaling;
pageViewModel.DataProvider.ElasticScaling = calculatePageViewModel.ElasticScaling;
pageViewModel.DataProvider.ElasticSigma = calculatePageViewModel.ElasticSigma;
pageViewModel.DataProvider.CalculateGaussianKernel();
pattern = new DoubleImageData(pageViewModel.DataProvider.TrainingPatterns[calculatePageViewModel.PatternIndex].Label, pageViewModel.DataProvider.GetDistortedPattern(calculatePageViewModel.PatternIndex, true));
}
else
pattern = pageViewModel.DataProvider.TrainingPatterns[calculatePageViewModel.PatternIndex];
}
else
{
if (calculatePageViewModel.UseDistortions)
{
pageViewModel.DataProvider.SeverityFactor = calculatePageViewModel.SeverityFactor;
pageViewModel.DataProvider.MaxRotation = calculatePageViewModel.MaxRotation;
pageViewModel.DataProvider.MaxScaling = calculatePageViewModel.MaxScaling;
pageViewModel.DataProvider.ElasticScaling = calculatePageViewModel.ElasticScaling;
pageViewModel.DataProvider.ElasticSigma = calculatePageViewModel.ElasticSigma;
pageViewModel.DataProvider.CalculateGaussianKernel();
pattern = new DoubleImageData(pageViewModel.DataProvider.TestingPatterns[calculatePageViewModel.PatternIndex].Label, pageViewModel.DataProvider.GetDistortedPattern(calculatePageViewModel.PatternIndex, false));
}
else
pattern = pageViewModel.DataProvider.TestingPatterns[calculatePageViewModel.PatternIndex];
}
Layers firstLayer = pageViewModel.NeuralNetwork.Layers.First();
for (int i = 0; i < pageViewModel.DataProvider.PatternSize; ++i)
{
//pattern[i] = ((pattern[i] * 0.6375D) + 0.5375D); // normalization (-0.1 --> 1.175)
firstLayer.Neurons[i].Output = pattern.Image[i];
}
string result = String.Empty;
result += "Input: " + pattern.Label.ToString() + "\r\n";
int bestIndex = 0;
System.Diagnostics.Stopwatch timer = new Stopwatch();
timer.Restart();
pageViewModel.NeuralNetwork.Calculate();
bestIndex = Recognised();
timer.Stop();
result += "\r\n";
Layers lastLayer = pageViewModel.NeuralNetwork.Layers.Last();
for (int i = 0; i < lastLayer.NeuronCount; i++)
{
result += i.ToString() + " ==> " + lastLayer.Neurons[i].Output.ToString("N17") + "\r\n";
}
result += "\r\n";
double patternMSE = GetPatternMSE(pattern.Label);
result += "Pattern MSE: " + patternMSE.ToString("N17") + "\r\n";
result += "Highest prob: " + bestIndex.ToString() + "\r\n";
if (bestIndex == pattern.Label)
result += "Correctly recognized";
else
result += "Not correctly recognized";
result += "\r\nTime: " + timer.ElapsedMilliseconds.ToString() + " ms.";
calculatePageViewModel.Result = result;
calculatePageViewModel.TabItems = new ObservableCollection<TabItem>();
foreach (Layers layer in pageViewModel.NeuralNetwork.Layers)
{
if (layer.UseMapInfo)
{
TabItem tb = new TabItem();
tb.BeginInit();
tb.UseLayoutRounding = true;
tb.SnapsToDevicePixels = true;
tb.Header = layer.LayerIndex.ToString();
tb.Content = layer.GetMappedLayerOutputs();
tb.EndInit();
calculatePageViewModel.TabItems.Add(tb);
}
}
Mouse.OverrideCursor = null;
MainView.Status.Text = "Ready";
//.........这里部分代码省略.........
示例4: AWindow
public AWindow(AWindow owner)
: base()
{
TabItem from_me = new TabItem();
from_me.BeginInit();
from_me.EndInit();
this.Background = from_me.Background;
ProgressBar from_color = new ProgressBar();
default_progress_color = from_color.Foreground;
// Taskbar progress setup
TaskbarItemInfo = new TaskbarItemInfo();
var uriSource = new Uri(System.IO.Path.Combine(Core.app_path,"masgau.ico"), UriKind.Relative);
this.Icon = new BitmapImage(uriSource);
if(owner!=null) {
this.Owner = owner;
this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
} else {
this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
}
// Jumplist setup
JumpList masgau_jump_list = JumpList.GetJumpList(Application.Current);
if(masgau_jump_list==null) {
masgau_jump_list = new JumpList();
JumpList.SetJumpList(Application.Current, masgau_jump_list);
} else {
masgau_jump_list.JumpItems.Clear();
masgau_jump_list.ShowFrequentCategory = false;
masgau_jump_list.ShowRecentCategory = false;
}
JumpTask masgau_jump = new JumpTask();
masgau_jump.ApplicationPath = Path.Combine(Core.app_path,"MASGAU.Main.WPF.exe");
masgau_jump.IconResourcePath = Path.Combine(Core.app_path,"masgau.ico");
masgau_jump.WorkingDirectory = Core.app_path;
masgau_jump.Title = "Main Program";
masgau_jump.Description = "Open MASGAU's Main Window";
masgau_jump.CustomCategory = "MASGAU";
masgau_jump_list.JumpItems.Add(masgau_jump);
masgau_jump = new JumpTask();
masgau_jump.ApplicationPath = Path.Combine(Core.app_path,"MASGAU.Main.WPF.exe");
masgau_jump.IconResourcePath = Path.Combine(Core.app_path,"masgau.ico");
masgau_jump.WorkingDirectory = Core.app_path;
masgau_jump.Title = "Main Program (All Users Mode)";
masgau_jump.Description = "Open MASGAU's Main Window In All Users Mode";
masgau_jump.Arguments = "-allusers";
masgau_jump.CustomCategory = "MASGAU";
masgau_jump_list.JumpItems.Add(masgau_jump);
masgau_jump = new JumpTask();
masgau_jump.ApplicationPath = Path.Combine(Core.app_path,"MASGAU.Analyzer.WPF.exe");
masgau_jump.IconResourcePath = Path.Combine(Core.app_path,"masgau.ico");
masgau_jump.WorkingDirectory = Core.app_path;
masgau_jump.Title = "Analyzer";
masgau_jump.Description = "Open MASGAU's Save Game Analyzer";
masgau_jump.CustomCategory = "MASGAU";
masgau_jump_list.JumpItems.Add(masgau_jump);
masgau_jump = new JumpTask();
masgau_jump.ApplicationPath = Path.Combine(Core.app_path,"MASGAU.Monitor.WPF.exe");
masgau_jump.IconResourcePath = Path.Combine(Core.app_path,"masgau.ico");
masgau_jump.WorkingDirectory = Core.app_path;
masgau_jump.Title = "Monitor";
masgau_jump.Description = "Open MASGAU's Monitor";
masgau_jump.CustomCategory = "MASGAU";
masgau_jump_list.JumpItems.Add(masgau_jump);
masgau_jump_list.Apply();
//These intitialize the contexts of the CommunicationHandlers
if(SynchronizationContext.Current == null)
SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext(this.Dispatcher));
_context = SynchronizationContext.Current;
CommunicationHandler.addReceiver(this);
this.Closing += new CancelEventHandler(Window_Closing);
}