本文整理汇总了C#中Decoder.LoadFromFile方法的典型用法代码示例。如果您正苦于以下问题:C# Decoder.LoadFromFile方法的具体用法?C# Decoder.LoadFromFile怎么用?C# Decoder.LoadFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Decoder
的用法示例。
在下文中一共展示了Decoder.LoadFromFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnImportDecoder_Click
private void btnImportDecoder_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog dlgOpen = new OpenFileDialog();
dlgOpen.Filter = LanguageDictionary.Current.Translate<string>("DecoderFilesFilter", "Text", "Decoder files|*.decoder|All files|*.*");
if (dlgOpen.ShowDialog() == true)
{
try
{
Decoder d = new Decoder();
if (d.LoadFromFile(dlgOpen.FileName))
Decoder = d;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, App.Name, MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
示例2: cbDecoders_SelectionChanged
private void cbDecoders_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (assignDecoder)
{
DecoderReference dref = cbDecoders.SelectedItem as DecoderReference;
if (dref == null)
Decoder = null;
else
{
Decoder decoder = new Decoder();
if (decoder.LoadFromFile(dref.FileName))
Decoder = decoder;
}
}
}
示例3: OpenDecoder_Executed
private void OpenDecoder_Executed(object sender, ExecutedRoutedEventArgs e)
{
if (e.Parameter != null)
{
Decoder.LoadFromFile((string)e.Parameter);
fileName = (string)e.Parameter;
modified = false;
UpdateTitle();
}
else
{
if (dlgOpen.ShowDialog() == true)
{
if (modified)
{
string s = LanguageDictionary.Current.Translate<string>("SaveCurrentDecoder", "Text", "Save current decoder?");
MessageBoxResult res = MessageBox.Show(s, App.Name, MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
if (res == MessageBoxResult.Yes)
RoutedCommands.SaveDecoder.Execute(null, null);
else if (res == MessageBoxResult.Cancel)
return;
}
Decoder = new Decoder();
Decoder.LoadFromFile(dlgOpen.FileName);
fileName = dlgOpen.FileName;
modified = false;
UpdateTitle();
}
}
}