private void ShowViewControlWizard(Dictionary<string, string> replacementsDictionary)
        {
            try
            {
                const string t4Key = "$T4templates$";
                List<Template> templates;

                if (replacementsDictionary.ContainsKey(t4Key))
                    templates = replacementsDictionary[t4Key].FromJson<List<Template>>();
                else
                    templates = null;

                if (templates != null)
                {
                    var data = new ViewControlModel() {
                        NameSpace = replacementsDictionary["$rootnamespace$"],
                        ItemName = replacementsDictionary["$safeitemname$"]
                    };
                    using (var window = new ViewControlDialog(templates, data))
                    {
                        window.ShowDialog();
                        ShouldAddItems = (window.DialogResult == DialogResult.OK);
                        if (ShouldAddItems)
                        {
                            var TokenReplacements = window.TokenReplacements;
                            if (TokenReplacements != null)
                            {
                                var sb = new StringBuilder();
                                foreach (string key in TokenReplacements.Keys)
                                {
                                    replacementsDictionary[key] = TokenReplacements[key];
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var sb = new StringBuilder();
                sb.AppendLine(ex.Message);
                sb.AppendLine("");
                sb.AppendLine(ex.StackTrace);
                MessageBox.Show(sb.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public ViewControlDialog(List<Template> templates, ViewControlModel data)
 {
     InitializeComponent();
     Templates = templates;
     _Data = data;
 }