Exemplo n.º 1
0
        Bar CreateToolBarFromCodon(ToolbarCodon codon)
        {
            Bar bar = new Bar();

            bar.Stretch         = true;
            bar.CanHide         = false;
            bar.GrabHandleStyle = eGrabHandleStyle.StripeFlat;
            bar.WrapItemsDock   = false;
            bar.BackColor       = SystemColors.Control;

            ResourceService     ResourceService     = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService));
            StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));

            foreach (ToolbarItemCodon childCodon in codon.SubItems)
            {
                ButtonItem button = new ButtonItem();

                if (childCodon.Icon != null)
                {
                    button.Image = ResourceService.GetBitmap(childCodon.Icon);
                }
                if (childCodon.Text != null)
                {
                    button.Text        = stringParserService.Parse(childCodon.Text);
                    button.ButtonStyle = eButtonStyle.ImageAndText;
                }

                if (childCodon.ToolTip != null)
                {
                    if (childCodon.BeginGroup == "true")
                    {
                        button.BeginGroup = true;
                    }
                    else
                    {
                        button.Tooltip = stringParserService.Parse(childCodon.ToolTip);
                    }
                }
                button.Enabled = childCodon.Enabled;
                if (childCodon.Class != null)
                {
                    ClickWrapper clickHandler = new ClickWrapper((ICommand)childCodon.AddIn.CreateObject(childCodon.Class));
                    button.Click += new EventHandler(clickHandler.Run);
                }
                bar.Items.Add(button);
            }
            return(bar);
        }
        public bool TestFileExists(string filename)
        {
            if (!File.Exists(filename))
            {
                StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));

                MessageBox.Show(stringParserService.Parse(resourceService.GetString("Fileutility.CantFindFileError"), new string[, ] {
                    { "FILE", filename }
                }),
                                resourceService.GetString("Global.WarningText"),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
                return(false);
            }
            return(true);
        }
Exemplo n.º 3
0
        public SaveErrorChooseDialog(string fileName, string message, string dialogName, Exception exceptionGot, bool chooseLocationEnabled)
        {
            this.Text = dialogName;
            this.InitializeComponents(chooseLocationEnabled);

            StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));

            displayMessage = stringParserService.Parse(message, new string[, ] {
                { "FileName", fileName },
                { "Path", Path.GetDirectoryName(fileName) },
                { "FileNameWithoutPath", Path.GetFileName(fileName) },
                { "Exception", exceptionGot.GetType().FullName },
            });

            descriptionTextBox.Lines = this.displayMessage.Split('\n');

            this.exceptionGot = exceptionGot;
        }