Ejemplo n.º 1
0
        public MainPage()
        {
            InitializeComponent();

            // workflows yield IWorkflow objects. We can optionally handled errors encountered
            // during the workflow, at which point the workflow is terminated.
            WorkflowController.Begin(Workflow(),
                                     ex => JounceHelper.ExecuteOnUI(() => MessageBox.Show(ex.Message)));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Request a xap to be downloaded and integrated
        /// </summary>
        /// <param name="xapName">The name of the XAP to download</param>
        /// <param name="xapLoaded">Callback once xap is loaded</param>
        /// <param name="xapProgress">Callback for xap progress with bytes received, pct, and total bytes</param>
        public void RequestXap(string xapName, Action <Exception> xapLoaded,
                               Action <long, int, long> xapProgress)
        {
            if (string.IsNullOrEmpty(xapName))
            {
                throw new ArgumentNullException("xapName");
            }

            var uri = new Uri(Application.Current.Host.Source, xapName);

            if (!uri.GetComponents(UriComponents.Path, UriFormat.Unescaped).EndsWith(".xap", StringComparison.InvariantCultureIgnoreCase))
            {
                throw new ArgumentOutOfRangeException("xapName", Resources.DeploymentService_RequestXap_XAPExtensionError);
            }

            WorkflowController.Begin(DownloadWorkflow(xapName, xapLoaded, xapProgress));
        }