// ...

    private void AtSomeLaterPoint()
    {
        // open another window and pass the difficulty via its constructor
        var otherWindow = new OtherWindow(_difficulty);

        otherWindow.Show();
    }
    public MainViewModel()
    {
        var otherView = new OtherWindow();

        otherView.Show();
        var downloader = Application.Current.Resources["MyDownloader"] as Downloader;

        downloader.DownloadProgressChanged                       += (sender, args) =>
                                                         Progress = args.ProgressPercentage;
        downloader.Get("http://mirror.internode.on.net/pub/test/10meg.test");
    }
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            OtherWindow other = new OtherWindow();

            other.Closed += (sender2, e2) =>
            {
                label1.Content = other.SomeData;
            };

            //either of the methods below, depending on desired behavior.
            other.Show();
            //other.ShowDialog();
        }
    public MainViewModel()
    {
        // Open new window beside Main
        var otherView = new OtherWindow();

        otherView.Show();
        // Get downloader resource
        var downloader = Application.Current.Resources["MyDownloader"] as Downloader;

        // Update property when ever download progress changes (event)
        downloader.DownloadProgressChanged                       += (sender, args) =>
                                                         Progress = args.ProgressPercentage;
        // Start downloading a 10Mb file
        downloader.Get("http://mirror.internode.on.net/pub/test/10meg.test");
    }
示例#5
0
 private void MainViewModel_OtherStarted(object sender, BankAccountsEventArgs e)
 {
     _otherWindow             = new OtherWindow();
     _otherWindow.DataContext = _mainViewModel;
     _otherWindow.Show();
 }