我的口号是公开的。 在启动开放基金之前,它询问用户是否希望拯救现有档案,如果是,它会发射一个拯救基金。 然后发射开放式散射。 标准 st。
我的问题是,银灯然后看着开放基金。 淋浴法并非用户启动,我接受安全检查。
是否有任何已知的合理办法避免这一例外? 这肯定是一种相对标准的情况?
该信属于浏览器。
任何观点都受到欢迎。
EDIT:
Sorry, not allowed to release actual code :( The logic is pretty simple though: In psuedocode the OpenFile" button press event calls a method something like:
*Launch a new SL message asking whether to save first.
*On message window yes/no clicked: -If No, Go to Load -If Yes, Launch SaveFileDialog.ShowDialog(), go to Load
*Load: Launch An Open File Dialog
EDIT 2: Mini programme...
XML content for the main page:
<Grid x:Name="LayoutRoot" Background="White">
<Button Content="Open" Click="Button_Click"/>
</Grid>
法典:
using System.Windows;
using System.Windows.Controls;
namespace SilverlightApplication15
{
public partial class MainPage : UserControl
{
AskWindow aw = new AskWindow();
public MainPage()
{
InitializeComponent();
aw.Closed += new System.EventHandler(aw_Closed);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
aw.Show();
}
private void aw_Closed(object sender, System.EventArgs e)
{
if (aw.DialogResult == true)
{
SaveFileDialog svd = new SaveFileDialog();
svd.ShowDialog();
}
OpenFileDialog ofd = new OpenFileDialog();
ofd.ShowDialog();//Causes security exception
}
}
public class AskWindow : ChildWindow
{
public AskWindow()
{
Button b = new System.Windows.Controls.Button();
b.Click += new System.Windows.RoutedEventHandler(b_Click);
b.Content = "Yes, save it";
this.Content = b;
}
private void b_Click(object sender, System.Windows.RoutedEventArgs e)
{
this.DialogResult = true;
}
}
}