예제 #1
0
        internal virtual void Run(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            if (!_sheerResponse.CheckModified())
            {
                return;
            }

            BaseLayoutItem currentItem = DeserializeItems(args.Parameters["items"])[0];

            if (!args.IsPostBack)
            {
                var url = _dialogLocator.GetDialogUrl(currentItem);
                if (!string.IsNullOrEmpty(url))
                {
                    _sheerResponse.ShowModalDialog(url);
                    args.WaitForPostBack();
                }
                else
                {
                    _sheerResponse.Alert("Could not get the dialog URL.");
                }
            }
            else if (args.HasResult)
            {
                string message;
                if (_dialogResultProcessor.ProcessResult(currentItem, args.Result, out message))
                {
                    Refresh();
                }
                else
                {
                    _sheerResponse.Alert(string.IsNullOrEmpty(message)
                        ? "An unknown error occured while processing your selection."
                        : message);
                }
            }
        }