示例#1
0
        protected override void OnExecute(XenMessage message)
        {
            var res = message as SaveXamlResponse;

            if (res == null)
            {
                return;
            }

            var appEvent = new SaveXamlReceived
            {
                Error      = res.Error,
                Successful = res.Successful,
                Xaml       = res.Xaml
            };

            Bus.Notify(appEvent);
        }
示例#2
0
        private void OnSaveXamlMessageReceived(SaveXamlReceived e)
        {
            string xaml = null;

            try
            {
                xaml = GetOutput(e.Xaml);
            }
            catch (Exception ex)
            {
                ToolboxApp.Log.Error(ex, "Error processing XAML.");

                MessageBox.Show(Application.Instance.MainForm,
                                "Error processing XAML before saving. Please see error log for more details.",
                                "XenForms",
                                MessageBoxType.Error);
            }
            finally
            {
                WorkingDialog.Close();
            }

            if (!string.IsNullOrWhiteSpace(xaml))
            {
                XenFormsExtensionAcceptance();

                var succeeded = ShowSaveDialog(xaml);

                if (!succeeded)
                {
                    MessageBox.Show(Application.Instance.MainForm,
                                    "The save operation failed. Please review the log for more information.",
                                    "XenForms",
                                    MessageBoxType.Error);
                }
            }
        }