本文整理汇总了C#中IWindow.TranslateForTechnology方法的典型用法代码示例。如果您正苦于以下问题:C# IWindow.TranslateForTechnology方法的具体用法?C# IWindow.TranslateForTechnology怎么用?C# IWindow.TranslateForTechnology使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWindow
的用法示例。
在下文中一共展示了IWindow.TranslateForTechnology方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowTaskDialog
public MsgBoxResult ShowTaskDialog(
IWindow owner,
string text,
string caption,
MsgBoxButton button,
MsgBoxImage icon,
Icon custumIcon)
{
return ObservableObject.CurrentDispatcher.Invoke(
() =>
{
var dialog = new TaskDialog
{
CenterParent = true,
Content = text,
ExpandFooterArea = false,
ExpandedByDefault = false,
MinimizeBox = false,
ProgressBarStyle =
ProgressBarStyle.None,
WindowIcon = custumIcon,
WindowTitle = caption,
MainInstruction = caption,
MainIcon = TranslateIcon(icon)
};
TranslateButtons(button, dialog.Buttons);
TaskDialogButton clickedButton =
dialog.ShowDialog(owner != null
? (Window)
owner
.TranslateForTechnology
()
: null);
switch (clickedButton.ButtonType)
{
case ButtonType.Ok:
return MsgBoxResult.Ok;
case ButtonType.Yes:
return MsgBoxResult.Yes;
case ButtonType.No:
return MsgBoxResult.No;
case ButtonType.Cancel:
return MsgBoxResult.Cancel;
case ButtonType.Close:
return MsgBoxResult.Cancel;
default:
throw new ArgumentOutOfRangeException();
}
});
}
示例2: ShowSaveFileDialog
public string ShowSaveFileDialog(
IWindow owner,
bool addExtension,
bool checkFileExists,
bool checkPathExists,
string defaultExt,
bool dereferenceLinks,
string filter,
bool createPrompt,
bool overwritePrompt,
string title,
string initialDirectory,
out bool? result)
{
bool? tempresult = null;
try
{
return ObservableObject.CurrentDispatcher.Invoke(
() =>
{
var dialog = new VistaSaveFileDialog
{
AddExtension = addExtension,
CheckFileExists = checkFileExists,
DefaultExt = defaultExt,
DereferenceLinks =
dereferenceLinks,
Filter = filter,
Title = title,
CheckPathExists = checkPathExists,
CreatePrompt = createPrompt,
OverwritePrompt = overwritePrompt,
InitialDirectory =
initialDirectory
};
TranslateDefaultExt(dialog);
tempresult = owner != null
? dialog.ShowDialog(
(Window)
owner
.TranslateForTechnology
())
: dialog.ShowDialog();
return tempresult == false ? null : dialog.FileName;
});
}
finally
{
result = tempresult;
}
}
示例3: ShowOpenFolderDialog
public string ShowOpenFolderDialog(
IWindow owner,
string description,
Environment.SpecialFolder rootFolder,
bool showNewFolderButton,
bool useDescriptionForTitle,
out bool? result)
{
bool? tempresult = null;
try
{
return ObservableObject.CurrentDispatcher.Invoke(
() =>
{
var dialog = new VistaFolderBrowserDialog
{
Description = description,
RootFolder = rootFolder,
ShowNewFolderButton =
showNewFolderButton,
UseDescriptionForTitle =
useDescriptionForTitle
};
tempresult = owner != null
? dialog.ShowDialog(
(Window)
owner
.TranslateForTechnology
())
: dialog.ShowDialog();
return tempresult == false
? null
: dialog.SelectedPath;
});
}
finally
{
result = tempresult;
}
}
示例4: ShowOpenFileDialog
public IEnumerable<string> ShowOpenFileDialog(
IWindow owner,
bool checkFileExists,
string defaultExt,
bool dereferenceLinks,
string filter,
bool multiSelect,
string title,
bool validateNames,
bool checkPathExists,
out bool? result)
{
bool? tempresult = null;
try
{
return ObservableObject.CurrentDispatcher.Invoke(
() =>
{
var dialog = new VistaOpenFileDialog
{
CheckFileExists = checkFileExists,
DefaultExt = defaultExt,
DereferenceLinks =
dereferenceLinks,
Filter = filter,
Multiselect = multiSelect,
Title = title,
ValidateNames = validateNames,
CheckPathExists = checkPathExists
};
TranslateDefaultExt(dialog);
tempresult = owner != null
? dialog.ShowDialog(
(Window)
owner
.TranslateForTechnology
())
: dialog.ShowDialog();
return tempresult == false
? Enumerable.Empty<string>()
: dialog.FileNames;
});
}
finally
{
result = tempresult;
}
}
示例5: ShowMessageBox
public MsgBoxResult ShowMessageBox(
IWindow owner,
string text,
string caption,
MsgBoxButton button,
MsgBoxImage icon,
Icon custumIcon)
{
Window realWindow = owner == null ? null : (Window)owner.TranslateForTechnology();
return
ObservableObject.CurrentDispatcher.Invoke(
() =>
!TaskDialog.OSSupportsTaskDialogs
? (MsgBoxResult)
MessageBox.Show(
realWindow,
text,
caption,
(MessageBoxButton) button,
(MessageBoxImage) icon)
: ShowTaskDialog(owner, text, caption, button, icon,
custumIcon));
}
示例6: GetText
/// <summary>
/// The get text.
/// </summary>
/// <param name="owner">
/// The owner.
/// </param>
/// <param name="instruction">
/// The instruction.
/// </param>
/// <param name="content">
/// The content.
/// </param>
/// <param name="caption">
/// The caption.
/// </param>
/// <param name="allowCancel">
/// The allow cancel.
/// </param>
/// <param name="defaultValue">
/// The default value.
/// </param>
/// <returns>
/// The <see cref="string" />.
/// </returns>
public string GetText(
IWindow owner,
string instruction,
string content,
string caption,
bool allowCancel,
string defaultValue)
{
return ObservableObject.CurrentDispatcher.Invoke(
() =>
{
Window realWindow = owner == null ? null : (Window) owner.TranslateForTechnology();
var diag = new InputDialog
{
Owner = realWindow,
MainText = instruction,
AllowCancel = allowCancel,
Title = caption,
InstructionText = content,
Result = defaultValue
};
return diag.ShowDialog() == true ? diag.Result : null;
});
}