Exemple #1
0
        /// <summary>
        ///     This method was autogenerated - do not change the contents manually
        /// </summary>
        private void InitializeComponents(bool chooseLocationEnabled)
        {
            ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService));

            //
            //  Set up generated class SaveErrorChooseDialog
            //
            this.SuspendLayout();
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            this.Size            = new Size(520, 262);
            this.Name            = "SaveErrorChooseDialog";
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.ShowInTaskbar   = false;
            this.StartPosition   = FormStartPosition.CenterScreen;

            //
            //  Set up member retryButton
            //
            retryButton = new Button();
            retryButton.DialogResult = System.Windows.Forms.DialogResult.Retry;
            retryButton.Name         = "retryButton";
            retryButton.TabIndex     = 5;
            retryButton.Anchor       = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
            retryButton.Text         = resourceService.GetString("Global.RetryButtonText");
            retryButton.Size         = new Size(120, 23);
            retryButton.Location     = new Point(4, 206);
            this.Controls.Add(retryButton);

            //
            //  Set up member ignoreButton
            //
            ignoreButton              = new Button();
            ignoreButton.Name         = "ignoreButton";
            ignoreButton.DialogResult = System.Windows.Forms.DialogResult.Ignore;
            ignoreButton.TabIndex     = 4;
            ignoreButton.Anchor       = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
            ignoreButton.Text         = resourceService.GetString("Global.IgnoreButtonText");
            ignoreButton.Size         = new Size(120, 23);
            ignoreButton.Location     = new Point(132, 206);
            this.Controls.Add(ignoreButton);

            //
            //  Set up member descriptionLabel
            //
            descriptionLabel          = new Label();
            descriptionLabel.Name     = "descriptionLabel";
            descriptionLabel.Location = new Point(8, 0);
            descriptionLabel.Size     = new Size(510, 24);
            descriptionLabel.TabIndex = 3;
            descriptionLabel.Anchor   = (System.Windows.Forms.AnchorStyles.Top
                                         | (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right));
            descriptionLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
            descriptionLabel.Text      = "Description";
            this.Controls.Add(descriptionLabel);

            //
            //  Set up member descriptionTextBox
            //
            descriptionTextBox           = new TextBox();
            descriptionTextBox.Multiline = true;
            descriptionTextBox.Size      = new Size(502, 174);
            descriptionTextBox.Location  = new Point(8, 24);
            descriptionTextBox.TabIndex  = 2;
            descriptionTextBox.Anchor    = (System.Windows.Forms.AnchorStyles.Top
                                            | (System.Windows.Forms.AnchorStyles.Bottom
                                               | (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            descriptionTextBox.ReadOnly = true;
            descriptionTextBox.Name     = "descriptionTextBox";
            this.Controls.Add(descriptionTextBox);

            //
            //  Set up member exceptionButton
            //
            exceptionButton          = new Button();
            exceptionButton.TabIndex = 1;
            exceptionButton.Anchor   = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
            exceptionButton.Name     = "exceptionButton";
            exceptionButton.Text     = "Show Exception";
            exceptionButton.Size     = new Size(120, 23);
            exceptionButton.Location = new Point(388, 206);
            exceptionButton.Click   += new EventHandler(ShowException);
            this.Controls.Add(exceptionButton);

            if (chooseLocationEnabled)
            {
                //
                //  Set up member chooseLocationButton
                //
                chooseLocationButton              = new Button();
                chooseLocationButton.Name         = "chooseLocationButton";
                chooseLocationButton.DialogResult = System.Windows.Forms.DialogResult.OK;
                chooseLocationButton.TabIndex     = 0;
                chooseLocationButton.Anchor       = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
                chooseLocationButton.Text         = resourceService.GetString("Global.ChooseLocationButtonText");
                chooseLocationButton.Size         = new Size(120, 23);
                chooseLocationButton.Location     = new Point(260, 206);
            }

            this.Controls.Add(chooseLocationButton);
            this.ResumeLayout(false);
        }
        public string Parse(string input, string[,] customTags)
        {
            string output = input;

            if (input != null)
            {
                const string pattern = @"\$\{([^\}]*)\}";
                foreach (Match m in Regex.Matches(input, pattern))
                {
                    if (m.Length > 0)
                    {
                        string token         = m.ToString();
                        string propertyName  = m.Groups[1].Captures[0].Value;
                        string propertyValue = null;
                        switch (propertyName.ToUpper())
                        {
                        case "DATE":                                 // current date
                            propertyValue = DateTime.Today.ToShortDateString();
                            break;

                        case "TIME":                                 // current time
                            propertyValue = DateTime.Now.ToShortTimeString();
                            break;

                        default:
                            propertyValue = null;
                            if (customTags != null)
                            {
                                for (int j = 0; j < customTags.GetLength(0); ++j)
                                {
                                    if (propertyName.ToUpper() == customTags[j, 0].ToUpper())
                                    {
                                        propertyValue = customTags[j, 1];
                                        break;
                                    }
                                }
                            }
                            if (propertyValue == null)
                            {
                                propertyValue = properties[propertyName.ToUpper()];
                            }
                            if (propertyValue == null)
                            {
                                int k = propertyName.IndexOf(':');
                                if (k > 0)
                                {
                                    switch (propertyName.Substring(0, k).ToUpper())
                                    {
                                    case "RES":
                                        ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService));
                                        propertyValue = Parse(resourceService.GetString(propertyName.Substring(k + 1)), customTags);
                                        break;

                                    case "PROPERTY":
                                        PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService));
                                        propertyValue = propertyService.GetProperty(propertyName.Substring(k + 1)).ToString();
                                        break;
                                    }
                                }
                            }
                            break;
                        }
                        if (propertyValue != null)
                        {
                            output = output.Replace(token, propertyValue);
                        }
                    }
                }
            }
            return(output);
        }
        /// <summary>
        ///     This method was autogenerated - do not change the contents manually
        /// </summary>
        private void InitializeComponents()
        {
            ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService));

            //
            //  Set up generated class SaveErrorInformDialog
            //
            this.SuspendLayout();
            this.MaximizeBox     = false;
            this.Name            = "SaveErrorInformDialog";
            this.MinimizeBox     = false;
            this.Size            = new Size(526, 262);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.ShowInTaskbar   = false;
            this.StartPosition   = FormStartPosition.CenterScreen;


            //
            //  Set up member descriptionLabel
            //
            descriptionLabel          = new Label();
            descriptionLabel.Location = new Point(8, 0);
            descriptionLabel.Size     = new Size(514, 24);
            descriptionLabel.TabIndex = 3;
            descriptionLabel.Anchor   = (System.Windows.Forms.AnchorStyles.Top
                                         | (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right));
            descriptionLabel.TextAlign = System.Drawing.ContentAlignment.BottomLeft;
            descriptionLabel.Text      = "Description";
            descriptionLabel.Name      = "descriptionLabel";
            this.Controls.Add(descriptionLabel);

            //
            //  Set up member descriptionTextBox
            //
            descriptionTextBox           = new TextBox();
            descriptionTextBox.Name      = "descriptionTextBox";
            descriptionTextBox.Multiline = true;
            descriptionTextBox.Size      = new Size(506, 176);
            descriptionTextBox.Location  = new Point(8, 24);
            descriptionTextBox.TabIndex  = 2;
            descriptionTextBox.Anchor    = (System.Windows.Forms.AnchorStyles.Top
                                            | (System.Windows.Forms.AnchorStyles.Bottom
                                               | (System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
            descriptionTextBox.ReadOnly = true;
            this.Controls.Add(descriptionTextBox);

            //
            //  Set up member exceptionButton
            //
            exceptionButton          = new Button();
            exceptionButton.TabIndex = 1;
            exceptionButton.Name     = "exceptionButton";
            exceptionButton.Anchor   = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
            exceptionButton.Text     = "Show Exception";
            exceptionButton.Size     = new Size(120, 23);
            exceptionButton.Location = new Point(392, 208);
            exceptionButton.Click   += new EventHandler(ShowException);
            this.Controls.Add(exceptionButton);

            //
            //  Set up member chooseLocationButton
            //
            okButton              = new Button();
            okButton.Name         = "okButton";
            okButton.TabIndex     = 0;
            okButton.Anchor       = (System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right);
            okButton.Text         = resourceService.GetString("Global.OKButtonText");
            okButton.Size         = new Size(120, 23);
            okButton.Location     = new Point(264, 208);
            okButton.DialogResult = DialogResult.OK;
            this.Controls.Add(okButton);
            this.ResumeLayout(false);
        }