static void Main()
        {
            Workspace workspace = new Workspace("Client-side encrypted workspace", "This is a client-side encrypted workspace. The passphrase is 'password'.");
            Model     model     = workspace.Model;

            Person         user           = model.AddPerson("User", "A user of my software system.");
            SoftwareSystem softwareSystem = model.AddSoftwareSystem("Software System", "My software system.");

            user.Uses(softwareSystem, "Uses");

            ViewSet           viewSet     = workspace.Views;
            SystemContextView contextView = viewSet.CreateSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");

            contextView.AddAllSoftwareSystems();
            contextView.AddAllPeople();

            Styles styles = viewSet.Configuration.Styles;

            styles.Add(new ElementStyle(Tags.SoftwareSystem)
            {
                Background = "#d34407", Color = "#ffffff"
            });
            styles.Add(new ElementStyle(Tags.Person)
            {
                Background = "#f86628", Color = "#ffffff", Shape = Shape.Person
            });

            StructurizrClient structurizrClient = new StructurizrClient(ApiKey, ApiSecret);

            structurizrClient.EncryptionStrategy = new AesEncryptionStrategy("password");
            structurizrClient.PutWorkspaceAsync(WorkspaceId, workspace).Wait();
        }
        public IStyle GetStyles()
        {
            var styles = new Styles();

            Uri themeUri = new Uri(@"avares://Avalonia.Themes.Default/DefaultTheme.xaml");

            styles.Add(new StyleInclude(themeUri)
            {
                Source = themeUri
            });

            Uri lightsUri = new Uri(@"avares://Avalonia.Themes.Default/Accents/BaseLight.xaml");

            if (_settings.IsDarkTheme)
            {
                lightsUri = new Uri(@"avares://Avalonia.Themes.Default/Accents/BaseDark.xaml");
            }

            styles.Add(new StyleInclude(lightsUri)
            {
                Source = lightsUri
            });

            return(styles);
        }
Example #3
0
        static void Main(string[] args)
        {
            Workspace workspace = new Workspace("RegAndElig", "Registration and Eligibility Model.");
            var       model     = workspace.Model;

            Person         user           = model.AddPerson("Service Provider", "A user of my software system.");
            SoftwareSystem softwareSystem = model.AddSoftwareSystem("Ess Web", "Web Front end.");

            user.Uses(softwareSystem, "Uses");

            ViewSet           viewSet = workspace.Views;
            SystemContextView contextView
                = viewSet.CreateSystemContextView(
                      softwareSystem, "context", "A simple example of a System Context diagram.");

            contextView.AddAllSoftwareSystems();
            contextView.AddAllPeople();

            Styles styles = viewSet.Configuration.Styles;

            styles.Add(new ElementStyle(Tags.SoftwareSystem)
            {
                Background = "#1168bd", Color = "#ffffff"
            });
            styles.Add(new ElementStyle(Tags.Person)
            {
                Background = "#08427b", Color = "#ffffff"
            });

            StructurizrClient structurizrClient = new StructurizrClient("key", "secret");

            structurizrClient.PutWorkspace(1234, workspace);
        }
Example #4
0
        static void Main()
        {
            Workspace workspace = new Workspace("Getting Started", "This is a model of my software system.");
            Model     model     = workspace.Model;

            Person         user           = model.AddPerson("User", "A user of my software system.");
            SoftwareSystem softwareSystem = model.AddSoftwareSystem("Software System", "My software system.");

            user.Uses(softwareSystem, "Uses");

            ViewSet           viewSet     = workspace.Views;
            SystemContextView contextView = viewSet.CreateSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");

            contextView.AddAllSoftwareSystems();
            contextView.AddAllPeople();

            Styles styles = viewSet.Configuration.Styles;

            styles.Add(new ElementStyle(Tags.SoftwareSystem)
            {
                Background = "#1168bd", Color = "#ffffff"
            });
            styles.Add(new ElementStyle(Tags.Person)
            {
                Background = "#08427b", Color = "#ffffff", Shape = Shape.Person
            });

            StructurizrClient structurizrClient = new StructurizrClient(ApiKey, ApiSecret);

            structurizrClient.PutWorkspaceAsync(WorkspaceId, workspace).Wait();
        }
Example #5
0
        static void Main(string[] args)
        {
            Workspace workspace = new Workspace("Music Sample Manager architecture", "This is a model of the architecture of the Music Sample Manager project.");
            Model     model     = workspace.Model;

            Person musician      = model.AddPerson("Musician", "A person who wants to write/record some music.");
            Person libraryAuthor = model.AddPerson("Author", "A person who authors samples to be used by musicians.");

            SoftwareSystem consoleApp = model.AddSoftwareSystem("msm.exe", "A console application that lets users perform MSM operations.");

            musician.Uses(consoleApp, "Uses");

            SoftwareSystem desktopGUIApp = model.AddSoftwareSystem("Desktop GUI App", "A desktop application that lets uers perform MSM operations.");

            musician.Uses(desktopGUIApp, "Uses");

            SoftwareSystem dawClient = model.AddSoftwareSystem("DAW Client", "Functionality built into DAWs that allows users to perform MSM operations.");

            musician.Uses(dawClient, "Uses");

            SoftwareSystem website = model.AddSoftwareSystem("Website", "Website that allows musicians to browse packages, and authors to publish/manage packages.");

            musician.Uses(website, "Uses packages from");
            libraryAuthor.Uses(website, "Publishes to");


            SoftwareSystem serverSoftware = model.AddSoftwareSystem("Server software", "Handles submissions to the database, authentication, serving requests for packages, etc.");

            consoleApp.Uses(serverSoftware, "Communicates with");
            dawClient.Uses(serverSoftware, "Interfaces with");

            SoftwareSystem localPackageCache = model.AddSoftwareSystem("Local package cache", "Cache of downloaded packages, to be used by DAW projects.");

            consoleApp.Uses(localPackageCache, "Interfaces with");
            dawClient.Uses(localPackageCache, "Works with");



            ViewSet           viewSet     = workspace.Views;
            SystemContextView contextView = viewSet.CreateSystemContextView(consoleApp, "SystemContext", "An example of a System Context diagram.");

            contextView.AddAllSoftwareSystems();
            contextView.AddAllPeople();

            Styles styles = viewSet.Configuration.Styles;

            styles.Add(new ElementStyle(Tags.SoftwareSystem)
            {
                Background = "#1168bd", Color = "#ffffff"
            });
            styles.Add(new ElementStyle(Tags.Person)
            {
                Background = "#08427b", Color = "#ffffff", Shape = Shape.Person
            });

            PublishWorkspace(workspace);
        }
        public void ControlTheme_Cannot_Be_Added_To_Styles()
        {
            var target = new ControlTheme(typeof(Button));
            var styles = new Styles();

            Assert.Throws <InvalidOperationException>(() => styles.Add(target));
        }
Example #7
0
 public virtual void AddStyle(IStyle style)
 {
     if (!Styles.Contains(style))
     {
         Styles.Add(style);
     }
 }
Example #8
0
        static void Main()
        {
            Workspace workspace = new Workspace("Documentation - arc42", "An empty software architecture document using the arc42 template.");
            Model     model     = workspace.Model;
            ViewSet   views     = workspace.Views;

            Person         user           = model.AddPerson("User", "A user of my software system.");
            SoftwareSystem softwareSystem = model.AddSoftwareSystem("Software System", "My software system.");

            user.Uses(softwareSystem, "Uses");

            SystemContextView contextView = views.CreateSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");

            contextView.AddAllSoftwareSystems();
            contextView.AddAllPeople();

            Styles styles = views.Configuration.Styles;

            styles.Add(new ElementStyle(Tags.Person)
            {
                Shape = Shape.Person
            });

            Arc42DocumentationTemplate template = new Arc42DocumentationTemplate(workspace);

            // this is the Markdown version
            DirectoryInfo documentationRoot = new DirectoryInfo("Documentation" + Path.DirectorySeparatorChar + "arc42" + Path.DirectorySeparatorChar + "markdown");

            template.AddIntroductionAndGoalsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "01-introduction-and-goals.md")));
            template.AddConstraintsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "02-architecture-constraints.md")));
            template.AddContextAndScopeSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "03-system-scope-and-context.md")));
            template.AddSolutionStrategySection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "04-solution-strategy.md")));
            template.AddBuildingBlockViewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "05-building-block-view.md")));
            template.AddRuntimeViewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "06-runtime-view.md")));
            template.AddDeploymentViewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "07-deployment-view.md")));
            template.AddCrosscuttingConceptsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "08-crosscutting-concepts.md")));
            template.AddArchitecturalDecisionsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "09-architecture-decisions.md")));
            template.AddRisksAndTechnicalDebtSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "10-quality-requirements.md")));
            template.AddQualityRequirementsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "11-risks-and-technical-debt.md")));
            template.AddGlossarySection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "12-glossary.md")));

            // this is the AsciiDoc version
//            DirectoryInfo documentationRoot = new DirectoryInfo("Documentation" + Path.DirectorySeparatorChar + "arc42" + Path.DirectorySeparatorChar + "asciidoc");
//            template.AddIntroductionAndGoalsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "01-introduction-and-goals.adoc")));
//            template.AddConstraintsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "02-architecture-constraints.adoc")));
//            template.AddContextAndScopeSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "03-system-scope-and-context.adoc")));
//            template.AddSolutionStrategySection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "04-solution-strategy.adoc")));
//            template.AddBuildingBlockViewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "05-building-block-view.adoc")));
//            template.AddRuntimeViewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "06-runtime-view.adoc")));
//            template.AddDeploymentViewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "07-deployment-view.adoc")));
//            template.AddCrosscuttingConceptsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "08-crosscutting-concepts.adoc")));
//            template.AddArchitecturalDecisionsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "09-architecture-decisions.adoc")));
//            template.AddRisksAndTechnicalDebtSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "10-quality-requirements.adoc")));
//            template.AddQualityRequirementsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "11-risks-and-technical-debt.adoc")));
//            template.AddGlossarySection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "12-glossary.adoc")));

            StructurizrClient structurizrClient = new StructurizrClient(ApiKey, ApiSecret);

            structurizrClient.PutWorkspace(WorkspaceId, workspace);
        }
Example #9
0
        public override void Initialize()
        {
            AvaloniaXamlLoader.Load(this);
            instance = this;

            Styles.Add(new Dark());
        }
Example #10
0
        internal void ApplyThemeResourcesFromTheme(Styles styles, Theme theme)
        {
            var item = styles.GetThemeStyle();

            int index = styles.GetThemeStyleIndex(item);

            if (index == -1)
            {
                styles.Add(theme.ThemeStyle);
            }
            else
            {
                styles.Remove(item);
                styles.Add(item);
            }
        }
        void AddProperties(List <Property> properties)
        {
            foreach (Property p in properties)
            {
                var item = new CheckBoxItem()
                {
                    ID        = p.PropertyId,
                    Display   = p.Name,
                    IsChecked = false
                };

                switch (p.Type)
                {
                case Property.PropertyType.Style:
                    Styles.Add(item);
                    break;

                case Property.PropertyType.Neckline:
                    Necklines.Add(item);
                    break;

                case Property.PropertyType.Silhouette:
                    Silhouettes.Add(item);
                    break;
                }
            }
        }
Example #12
0
        public void Run()
        {
            if (isProcessed)
            {
                return;
            }
            if (Parent != null)
            {
                Styles = new List <Style>(Parent.Styles);
            }

            var currentStyle = Document.GetStyle(this);

            if (currentStyle != null)
            {
                Styles.Add(currentStyle);
            }

            tagProcessor.Run(Document);
            foreach (var tag in Childs)
            {
                tag.Run();
            }

            isProcessed = true;
        }
Example #13
0
        private void ApplyStyles()
        {
            Styles.Add(new BaseTheme());

            var theme = Environment.GetEnvironmentVariable("RADISH_THEME");

            if (theme == null)
            {
                if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
                {
                    Styles.Add(new MacosTheme());
                }

                if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                {
                    Styles.Add(new WindowsTheme());
                }
            }
            else if (theme.Equals("windows", StringComparison.InvariantCultureIgnoreCase))
            {
                Styles.Add(new WindowsTheme());
            }
            else // if (theme.Equals("macos", StringComparison.InvariantCultureIgnoreCase))
            {
                Styles.Add(new MacosTheme());
            }
        }
Example #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Styles.AddRange(new []
            {
                "~/skins/default/jquery_style.css",
                "~/skins/default/main-title-icon.less",
                "~/skins/default/empty-screen-control.less",
                "~/skins/default/common_style.less",
                "~/skins/default/page-tabs-navigators.less",
                "~/skins/default/main-page-container.less",
                "~/skins/default/wizard.less",
                "~/skins/default/helper.less",
                "~/skins/default/comments-container.less",
                "~/skins/default/filetype_style.css",
                "~/skins/default/magnific-popup.less",
                "~/skins/default/toastr.less",
                "~/skins/default/groupselector.css",
                "~/skins/default/jquery-advansedfilter.css",
                "~/skins/default/jquery-advansedfilter-fix.less",
                "~/skins/default/jquery-advansedselector.less",
                "~/skins/default/jquery-emailadvansedselector.css",
                "~/skins/default/codestyle.css"
            }.Select(ResolveUrl).ToArray());

            if (WebSkin.HasCurrentCultureCssFile)
            {
                Styles.Add(ResolveUrl("~/skins/default/common_style.css".Replace("css", CultureInfo.CurrentCulture.Name.ToLower() + ".css")));
            }
        }
        public Style AddStyle(Style style)
        {
            style.StyleId = Styles.Any() ? Styles.Max(s => s.StyleId) + 1 : 1;
            Styles.Add(style);

            return(style);
        }
Example #16
0
        public MainView()
        {
            this.InitializeComponent();

            var _themeSelector = this.Find <ComboBox>("themeSelector");

            _themeSelector.SelectionChanged += (sender, e) =>
            {
                switch (_themeSelector.SelectedIndex)
                {
                case 0:
                    Styles[0] = _lightTheme;
                    break;

                case 1:
                    Styles[0] = _darkTheme;
                    break;
                }
            };
            _lightTheme = new StyleInclude(new Uri("resm:Styles?assembly=ThemeEditor"))
            {
                Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default")
            };
            _darkTheme = new StyleInclude(new Uri("resm:Styles?assembly=ThemeEditor"))
            {
                Source = new Uri("resm:Avalonia.Themes.Default.Accents.BaseDark.xaml?assembly=Avalonia.Themes.Default")
            };
            Styles.Add(_darkTheme);
        }
        static void Main()
        {
            Workspace workspace = new Workspace("Documentation - Structurizr", "An empty software architecture document using the Structurizr template.");
            Model     model     = workspace.Model;
            ViewSet   views     = workspace.Views;

            Person         user           = model.AddPerson("User", "A user of my software system.");
            SoftwareSystem softwareSystem = model.AddSoftwareSystem("Software System", "My software system.");

            user.Uses(softwareSystem, "Uses");

            SystemContextView contextView = views.CreateSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");

            contextView.AddAllSoftwareSystems();
            contextView.AddAllPeople();

            Styles styles = views.Configuration.Styles;

            styles.Add(new ElementStyle(Tags.Person)
            {
                Shape = Shape.Person
            });

            StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);

            // this is the Markdown version
            DirectoryInfo documentationRoot = new DirectoryInfo("Documentation" + Path.DirectorySeparatorChar + "structurizr" + Path.DirectorySeparatorChar + "markdown");

            template.AddContextSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "01-context.md")));
            template.AddFunctionalOverviewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "02-functional-overview.md")));
            template.AddQualityAttributesSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "03-quality-attributes.md")));
            template.AddConstraintsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "04-constraints.md")));
            template.AddPrinciplesSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "05-principles.md")));
            template.AddSoftwareArchitectureSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "06-software-architecture.md")));
            template.AddDataSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "07-data.md")));
            template.AddInfrastructureArchitectureSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "08-infrastructure-architecture.md")));
            template.AddDeploymentSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "09-deployment.md")));
            template.AddDevelopmentEnvironmentSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "10-development-environment.md")));
            template.AddOperationAndSupportSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "11-operation-and-support.md")));
            template.AddDecisionLogSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "12-decision-log.md")));

            // this is the AsciiDoc version
//            DirectoryInfo documentationRoot = new DirectoryInfo("Documentation" + Path.DirectorySeparatorChar + "structurizr" + Path.DirectorySeparatorChar + "asciidoc");
//            template.AddContextSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "01-context.adoc")));
//            template.AddFunctionalOverviewSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "02-functional-overview.adoc")));
//            template.AddQualityAttributesSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "03-quality-attributes.adoc")));
//            template.AddConstraintsSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "04-constraints.adoc")));
//            template.AddPrinciplesSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "05-principles.adoc")));
//            template.AddSoftwareArchitectureSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "06-software-architecture.adoc")));
//            template.AddDataSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "07-data.adoc")));
//            template.AddInfrastructureArchitectureSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "08-infrastructure-architecture.adoc")));
//            template.AddDeploymentSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "09-deployment.adoc")));
//            template.AddDevelopmentEnvironmentSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "10-development-environment.adoc")));
//            template.AddOperationAndSupportSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "11-operation-and-support.adoc")));
//            template.AddDecisionLogSection(softwareSystem, new FileInfo(Path.Combine(documentationRoot.FullName, "12-decision-log.adoc")));

            StructurizrClient structurizrClient = new StructurizrClient(ApiKey, ApiSecret);

            structurizrClient.PutWorkspaceAsync(WorkspaceId, workspace).Wait();
        }
 public SlideStyle(string text)
 {
     Styles.Add(DefaultStyle);
     Colors.Add(DefaultColor);
     Texts.Add(text);
     Backgrounds.Add(DefaultBackground);
 }
        public override void RegisterServices()
        {
            AvaloniaLocator.CurrentMutable
            .Bind <IAssetLoader>().ToConstant(Services.AssetLoader)
            .Bind <IFocusManager>().ToConstant(Services.FocusManager)
            .Bind <IGlobalClock>().ToConstant(Services.GlobalClock)
            .BindToSelf <IGlobalStyles>(this)
            .Bind <IInputManager>().ToConstant(Services.InputManager)
            .Bind <IKeyboardDevice>().ToConstant(Services.KeyboardDevice?.Invoke())
            .Bind <IKeyboardNavigationHandler>().ToConstant(Services.KeyboardNavigation)
            .Bind <IMouseDevice>().ToConstant(Services.MouseDevice?.Invoke())
            .Bind <IRuntimePlatform>().ToConstant(Services.Platform)
            .Bind <IPlatformRenderInterface>().ToConstant(Services.RenderInterface)
            .Bind <IFontManagerImpl>().ToConstant(Services.FontManagerImpl)
            .Bind <ITextShaperImpl>().ToConstant(Services.TextShaperImpl)
            .Bind <IPlatformThreadingInterface>().ToConstant(Services.ThreadingInterface)
            .Bind <IScheduler>().ToConstant(Services.Scheduler)
            .Bind <ICursorFactory>().ToConstant(Services.StandardCursorFactory)
            .Bind <IStyler>().ToConstant(Services.Styler)
            .Bind <IWindowingPlatform>().ToConstant(Services.WindowingPlatform)
            .Bind <PlatformHotkeyConfiguration>().ToSingleton <PlatformHotkeyConfiguration>();
            var theme = Services.Theme?.Invoke();

            if (theme is Styles styles)
            {
                Styles.AddRange(styles);
            }
            else if (theme is not null)
            {
                Styles.Add(theme);
            }
        }
Example #20
0
        static void Main()
        {
            Workspace workspace = new Workspace("Corporate Branding", "This is a model of my software system.");
            Model     model     = workspace.Model;

            Person         user           = model.AddPerson("User", "A user of my software system.");
            SoftwareSystem softwareSystem = model.AddSoftwareSystem("Software System", "My software system.");

            user.Uses(softwareSystem, "Uses");

            ViewSet           views       = workspace.Views;
            SystemContextView contextView = views.CreateSystemContextView(softwareSystem, "SystemContext", "An example of a System Context diagram.");

            contextView.AddAllSoftwareSystems();
            contextView.AddAllPeople();

            Styles styles = views.Configuration.Styles;

            styles.Add(new ElementStyle(Tags.Person)
            {
                Shape = Shape.Person
            });

            StructurizrDocumentationTemplate template = new StructurizrDocumentationTemplate(workspace);

            template.AddContextSection(softwareSystem, Format.Markdown, "Here is some context about the software system...\n\n![](embed:SystemContext)");

            Branding branding = views.Configuration.Branding;

            branding.Logo = ImageUtils.GetImageAsDataUri(new FileInfo("structurizr-logo.png"));

            StructurizrClient structurizrClient = new StructurizrClient(ApiKey, ApiSecret);

            structurizrClient.PutWorkspace(WorkspaceId, workspace);
        }
Example #21
0
        /// <summary>
        /// Runs the application.
        /// </summary>
        public void Run()
        {
            Styles.Add(new DefaultTheme());

            var loader    = new AvaloniaXamlLoader();
            var baseLight = (IStyle)loader.Load(
                new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"));

            Styles.Add(baseLight);

            Styles.Add(new SampleTabStyle());
            DataTemplates = new DataTemplates
            {
                new FuncTreeDataTemplate <Node>(
                    x => new TextBlock {
                    Text = x.Name
                },
                    x => x.Children),
            };

            MainWindow.RootNamespace = "TestApplication";
            var wnd = MainWindow.Create();

            wnd.AttachDevTools();

            Run(wnd);
        }
Example #22
0
        public void InitStyles()
        {
            Styles.Add("CaptionStyle", new Style("Style"));
            Styles.Add("EditorStyle", new Style("Style"));
            Styles.Add("EvenRowStyle", new Style("Style"));
            Styles.Add("FooterStyle", new Style("Style"));
            Styles.Add("HeadingStyle", new Style("Style"));
            Styles.Add("HighLightRowStyle", new Style("Style"));
            Styles.Add("InactiveStyle", new Style("Style"));
            Styles.Add("OddRowStyle", new Style("Style"));
            Styles.Add("SelectedStyle", new Style("Style"));
            Styles.Add("Style", new Style("Style"));
            Styles.Add("RecordSelectorStyle", new Style("Style"));
            Styles.Add("FilterBarStyle", new Style("Style"));
            Styles.Add("FilterWatermarkStyle", new Style("Style"));
            Styles.Add("GroupStyle", new Style("Style"));
            Styles.Add("RowSelectorStyle", new Style("Style"));
            Styles.Add("ColumnSelectorStyle", new Style("Style"));
            Styles.Add("PrintPageHeaderStyle", new Style("PrintPageHeaderStyle"));
            Styles.Add("PrintPageFooterStyle", new Style("PrintPageFooterStyle"));


            // Since these styles never change, assign their names and parents beforehand
            Styles["Style"].Name           = "Normal";
            Styles["Style"].Parent         = "";
            Styles["HeadingStyle"].Name    = "Heading";
            Styles["HeadingStyle"].Parent  = "Normal";
            Styles["FooterStyle"].Name     = "Footer";
            Styles["FooterStyle"].Parent   = "Heading";
            Styles["CaptionStyle"].Name    = "Caption";
            Styles["CaptionStyle"].Parent  = "Heading";
            Styles["InactiveStyle"].Name   = "Inactive";
            Styles["InactiveStyle"].Parent = "Heading";
            Styles["SelectedStyle"].Name   = "Selected";
            Styles["SelectedStyle"].Parent = "Normal";
            Styles["EditorStyle"].Name     = "Editor";
            Styles["EditorStyle"].Parent   = "Normal";
            // Be careful, the instance is called HighLightRowStyle with capital L but the name is HighlightRow
            Styles["HighLightRowStyle"].Name      = "HighlightRow";
            Styles["HighLightRowStyle"].Parent    = "Normal";
            Styles["EvenRowStyle"].Name           = "EvenRow";
            Styles["EvenRowStyle"].Parent         = "Normal";
            Styles["OddRowStyle"].Name            = "OddRow";
            Styles["OddRowStyle"].Parent          = "Normal";
            Styles["RecordSelectorStyle"].Name    = "RecordSelector";
            Styles["RecordSelectorStyle"].Parent  = "Heading";
            Styles["FilterBarStyle"].Name         = "FilterBar";
            Styles["FilterBarStyle"].Parent       = "Normal";
            Styles["FilterWatermarkStyle"].Name   = "FilterWatermark";
            Styles["FilterWatermarkStyle"].Parent = "FilterBar";
            Styles["GroupStyle"].Name             = "Group";
            Styles["GroupStyle"].Parent           = "Caption";
            Styles["RowSelectorStyle"].Name       = "RowSelector";
            Styles["RowSelectorStyle"].Parent     = "RecordSelector";
            Styles["ColumnSelectorStyle"].Name    = "ColumnSelector";
            Styles["ColumnSelectorStyle"].Parent  = "Heading";

            AddToNamedStyles();
        }
Example #23
0
 internal override void parseJObject(JObject obj)
 {
     base.parseJObject(obj);
     foreach (IfcPresentationStyleSelect sas in mDatabase.extractJArray <IfcPresentationStyleSelect>(obj.GetValue("Styles", StringComparison.InvariantCultureIgnoreCase) as JArray))
     {
         Styles.Add(sas);
     }
 }
Example #24
0
 public TileLayer()
 {
     // We need to add a style on the layer or else all features will
     // be ignored altogher. Perhaps the style on the individual Features
     // should be used instead. Perhaps the Feature.Style could contain
     // the tile data iso the Feature.Geometry
     Styles.Add(new VectorStyle());
 }
Example #25
0
        public void Run(Styles styles, ITypographyOptions options, VerticalRhythm vr)
        {
            string rhythm1 = vr.Rhythm(1);
            string blockMarginBottom;

            if (float.TryParse(options.BlockMarginBottom, out float result))
            {
                blockMarginBottom = vr.Rhythm(result);
            }
            else if (!string.IsNullOrWhiteSpace(options.BlockMarginBottom))
            {
                blockMarginBottom = options.BlockMarginBottom;
            }
            else
            {
                blockMarginBottom = rhythm1;
            }

            styles.Add("tt,code", $@"
                    background-color: {vr.Gray(96)};
                    border-radius: 3px;
                    font-family: ""SFMono - Regular"", Consolas, ""Roboto Mono"" ,""Droid Sans Mono"", ""Liberation Mono"", Menlo, Courier, monospace;
                    padding: 0;
                    padding-top: 0.2em;
                    padding-bottom: 0.2em;
                ");
            styles.Add("pre", $@"
                    background: {vr.Gray(96)};
                    border-radius: 3px;
                    line-height: 1.42;
                    overflow: auto;
                    word-wrap: normal;
                    padding: {blockMarginBottom};
                ");
            styles.Add("pre code", @"
                    background: none;
                    line-height: 1.42;
                ");
            styles.Add("code:before,code:after,tt:before,tt:after", @"
                    letter-spacing: -0.2em;
                    content: "" "";
                ");
            styles.Add("pre code:before,pre code:after,pre tt:before,pre tt:after", @"
                    content: none;
                ");
        }
Example #26
0
        private void InitializeComponent()
        {
            DataTemplates.Add(new ViewLocator <ReactiveObject>());
            Styles.Add(new DefaultTheme());

            Child = new Grid
            {
                RowDefinitions = new RowDefinitions("*,Auto"),
                Children       = new Controls.Controls
                {
                    new TabControl
                    {
                        Items = new[]
                        {
                            new TabItem
                            {
                                Header = "Logical Tree",
                                [!ContentControl.ContentProperty] = _viewModel.WhenAnyValue(x => x.LogicalTree),
                            },
                            new TabItem
                            {
                                Header = "Visual Tree",
                                [!ContentControl.ContentProperty] = _viewModel.WhenAnyValue(x => x.VisualTree),
                            }
                        },
                    },
                    new StackPanel
                    {
                        Orientation        = Orientation.Horizontal,
                        Gap                = 4,
                        [Grid.RowProperty] = 1,
                        Children           = new Controls.Controls
                        {
                            new TextBlock
                            {
                                Text = "Focused: "
                            },
                            new TextBlock
                            {
                                [!TextBlock.TextProperty] = _viewModel
                                                            .WhenAnyValue(x => x.FocusedControl)
                                                            .Select(x => x?.GetType().Name ?? "(null)")
                            },
                            new TextBlock
                            {
                                Text = "Pointer Over: "
                            },
                            new TextBlock
                            {
                                [!TextBlock.TextProperty] = _viewModel
                                                            .WhenAnyValue(x => x.PointerOverElement)
                                                            .Select(x => x?.GetType().Name ?? "(null)")
                            }
                        }
                    }
                }
            };
        }
Example #27
0
 public AttractorDraggingFeature(AttractorObject attractor) : base(attractor)
 {
     Geometry = attractor.Position;
     Styles.Add(new ImageStyle
     {
         BitmapId    = BitmapResources.GetBitmapIdForEmbeddedResourceRelative("Dragging.png"),
         SymbolScale = 0.8f
     });
 }
Example #28
0
        private void SolveElements(XElement element)
        {
            var name = element.Name.LocalName;

            if (name == "style")
            {
                var value  = element.Value;
                var styles = value.Split('\n').Where(x => x != "").ToList();
                styles.ForEach(styleString =>
                {
                    var style = SvgStyle.Parse(styleString);
                    Styles.Add(style);
                });
            }

            if (name == "rect")
            {
                var svgRect = CreateRect(element);
                Elements.Add(svgRect);
            }

            if (name == "circle")
            {
                var svgCircle = CreateCircle(element);
                Elements.Add(svgCircle);
            }

            if (name == "path")
            {
                var svgPath = CreatePath(element);
                Elements.Add(svgPath);
            }

            if (name == "g")
            {
                var svgGroup = CreateGroup(element);
                Elements.Add(svgGroup);
            }

            if (name == "line")
            {
                var svgLine = CreateLine(element);
                Elements.Add(svgLine);
            }

            if (name == "ellipse")
            {
                var svgLine = CreateEllipse(element);
                Elements.Add(svgLine);
            }

            if (name == "polygon")
            {
                var svgPolygon = CreatePolygon(element);
                Elements.Add(svgPolygon);
            }
        }
Example #29
0
            public WorkingRadiusFeature(AttractorObject attractor)
            {
                Attractor = attractor;

                style = new VectorStyle();
                Styles.Add(style);

                Update();
            }
Example #30
0
        /// <summary>
        ///	Adds a style classification to the StyleSheet.
        /// </summary>
        /// <param name="target">
        ///	The string to be styled.
        /// </param>
        /// <param name="color">
        ///	The color to be applied to the target.
        /// </param>
        /// <param name="matchHandler">
        ///	A delegate instance which describes a transformation that can be applied to the target.
        /// </param>
        public void AddStyle(
            string target,
            Color color,
            MatchFound matchHandler)
        {
            var styler = new Stylizer(target, color, matchHandler);

            Styles.Add(styler);
        }
Example #31
0
        private static Styles CreateDefaultTheme()
        {
            var result = new Styles
            {
                new DefaultTheme(),
            };

            var loader = new AvaloniaXamlLoader();
            var baseLight = (IStyle)loader.Load(
                new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"));
            result.Add(baseLight);

            return result;
        }
        internal static AttributeValuePair CreateFromsStrings(string attr, string val) {
            var av = new AttributeValuePair();

            string name = attr.ToLower();

            switch (name) {
                case "uri":
                    av.attributeTypeEnum = AttributeTypeEnum.Uri;
                    av.val = val;
                    break;
                case "constraint":
                    av.attributeTypeEnum = AttributeTypeEnum.Constraint;
                    av.val = val != "false";
                    break;
                case "label":
                    av.attributeTypeEnum = AttributeTypeEnum.Label;
                    av.val = val;
                    break;
                case "size":
                    av.attributeTypeEnum = AttributeTypeEnum.Size;
                    av.val = ParseP2(val);
                    break;
                case "style":
                    {
                        Styles styles = new Styles();
                        av.val = styles;
                        string[] vals = Split(val);
                        av.attributeTypeEnum = AttributeTypeEnum.Style;
                        for (int i = 0; i < vals.Length; ++i)
                        {
                            switch (vals[i])
                            {
                                case "filled": styles.Add(Style.Filled); break;
                                case "dashed": styles.Add(Style.Dashed); break;
                                case "solid": styles.Add(Style.Solid); break;
                                case "invis":
                                case "inviz":
                                case "hidden": styles.Add(Style.Invis); break;
                                case "bold": styles.Add(Style.Bold); break;
                                case "diagonals": styles.Add(Style.Diagonals); break;
                                case "dotted": styles.Add(Style.Dotted); break;
                                case "rounded": styles.Add(Style.Rounded); break;                                
                                default:
                                    int lw;
                                    if (ParseLineWidth(vals[i], out lw)) {
                                        styles.lineWidth = lw;
                                        break; 
                                    }
                                    throw new Exception(String.Format("unexpected style '{0}'", val));
                            }
                        }
                        break;
                    }
                case "color":
                    av.attributeTypeEnum = AttributeTypeEnum.Color;
                    av.val = val;
                    break;
                case "pos":
                    av.attributeTypeEnum = AttributeTypeEnum.Pos;
                    av.val = CreatePosData(val);
                    break;
                case "lp":
                    av.attributeTypeEnum = AttributeTypeEnum.LabelLocation;
                    av.val = CreatePosData(val);
                    break;
                case "fontname":
                    av.attributeTypeEnum = AttributeTypeEnum.Fontname;
                    av.val = val;
                    break;
                case "fontsize":
                    av.attributeTypeEnum = AttributeTypeEnum.FontSize;
                    av.val = (int)TryParseDouble(val, name);
                    break;
                case "rankdir":
                    av.attributeTypeEnum = AttributeTypeEnum.LayerDirection;
		            switch(val) {
		            case "LR": av.val = LayerDirection.LR; break;
		            case "TB":
		            case "TD": av.val = LayerDirection.TB; break;
		            case "RL": av.val = LayerDirection.RL; break;
		            case "BT": av.val = LayerDirection.BT; break;
		            default:
                        throw new Exception("layerdir value \"" + val + "\" is not supported");
		            }
                    break;
                case "labeldouble":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "bb":
                    av.attributeTypeEnum = AttributeTypeEnum.BBox;
                    av.val = CreateBBoxFromString(val);
                    break;
                case "fontcolor":
                    av.attributeTypeEnum = AttributeTypeEnum.Fontcolor;
                    av.val = val;
                    break;
                case "margin":
                    {
                        // a pair x,y (inches)
                        av.attributeTypeEnum = AttributeTypeEnum.Margin;
                        string[] vals = Split(val);
                        av.val = TryParseDouble(Get(vals, 0), name);
                        break;
                    }
                case "width":
                    av.attributeTypeEnum = AttributeTypeEnum.Width;
                    av.val = TryParseDouble(val, name); 
                    break;
                case "height":
                    av.attributeTypeEnum = AttributeTypeEnum.Height;
                    av.val = TryParseDouble(val, name); 
                    break;
                case "shape":
                    av.attributeTypeEnum = AttributeTypeEnum.Shape;
                    val = val.ToLower();
		            switch(val) {
		            case "box":           av.val = Shape.Box; break;
		            case "circle":        av.val = Shape.Circle; break;
		            case "ellipse":       av.val = Shape.Ellipse; break;
		            case "plaintext":     av.val = Shape.Plaintext; break;
		            case "point":         av.val = Shape.Point; break;
		            case "record":        av.val = Shape.Record; break;
		            case "mdiamond":      av.val = Shape.Mdiamond; break;
		            case "polygon":       av.val = Shape.Polygon; break;
		            case "doublecircle":  av.val = Shape.DoubleCircle; break;
		            case "house":         av.val = Shape.House; break;
		            case "invhouse":      av.val = Shape.InvHouse; break;
		            case "parallelogram": av.val = Shape.Parallelogram; break;
		            case "octagon":       av.val = Shape.Octagon; break;
		            case "tripleoctagon": av.val = Shape.TripleOctagon; break;
                    case "triangle":      av.val = Shape.Triangle; break;
                    case "trapezium":     av.val = Shape.Trapezium; break;
                    case "msquare":       av.val = Shape.Msquare; break;
                    case "diamond":       av.val = Shape.Diamond; break;
                    case "hexagon":       av.val = Shape.Hexagon;break;

                    default:              av.val = Shape.Ellipse; break;
		            }
                    break;
                case "ordering":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "rects": {
                    av.attributeTypeEnum = AttributeTypeEnum.Rects;
                    var al = new ArrayList();
                    av.val = al;

                    var points = Split(val);
                    var leftbottom = new P2();
                    var righttop = new P2();
                    for (int i = 0; i < points.Length-3; i += 4) {
                        leftbottom.X = (int)GetNumber(points[i]);
                        leftbottom.Y = (int)GetNumber(points[i+1]);
                        righttop.X = (int)GetNumber(points[i+2]);
                        righttop.Y = (int)GetNumber(points[i+3]);
                        al.Add(new Rectangle(leftbottom, righttop));
                    }
                    }
                    break;
                case "sides":
                    av.attributeTypeEnum = AttributeTypeEnum.Sides;
                    av.val = Int32.Parse(val);
                    break;
                case "distortion":
                    av.attributeTypeEnum = AttributeTypeEnum.Distortion;
                    av.val = val == "" ? 0.0 : TryParseDouble(val, name); 
                    break;
                case "orientation":
                    av.attributeTypeEnum = AttributeTypeEnum.Orientation;
                    av.val = val;
                    break;
                case "skew":
                    av.attributeTypeEnum = AttributeTypeEnum.Skew;
                    av.val = TryParseDouble(val, name); 
                    break;
                case "layer":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "nodesep":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "layersep":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "taillabel":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "ratio":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "minlen":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "splines":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "overlap":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "labeldistance":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "peripheries":
                case "fname":
                case "subkind":
                case "kind":
                case "pname":
                case "headlabel":
                case "samearrowhead":
                case "sametail":
                case "samehead":
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
                case "arrowtail":
                    av.attributeTypeEnum =AttributeTypeEnum.ArrowTail;
                    av.val = ParseArrowStyle(val);
                    break;
                case "arrowhead":
                    av.attributeTypeEnum = AttributeTypeEnum.Arrowhead;
                    av.val = ParseArrowStyle(val);
                    break;
                case "dir":
                    av.attributeTypeEnum = AttributeTypeEnum.EdgeDirection;
                    if (val == "back")
                        av.val = EdgeDirection.Back;
                    else if (val == "forward")
                        av.val = EdgeDirection.Forward;
                    else if (val == "both")
                        av.val = EdgeDirection.Both;
                    else if (val == "none")
                        av.val = EdgeDirection.None;
                    else
                        throw new Exception("unexpected edge direction '" + val + "'");
                    break;
                case "page":
                    av.attributeTypeEnum = AttributeTypeEnum.Page;
                    av.val = ParseP2(val);
                    break;
                case "regular":
                    av.attributeTypeEnum = AttributeTypeEnum.Regular;
                    av.val = val == "1";
                    break;
                case "center":
                    av.attributeTypeEnum = AttributeTypeEnum.Center;
                    av.val = val == "true";
                    break;
                case "wt":
                    av.attributeTypeEnum = AttributeTypeEnum.Weight;
                    av.val = Int32.Parse(val);
                    break;
                case "id":
                    av.attributeTypeEnum = AttributeTypeEnum.Id;
                    av.val = val;
                    break;
                case "labelfontsize":
                    av.attributeTypeEnum = AttributeTypeEnum.LabelFontSize;
                    av.val = val;
                    break;
                case "arrowsize":
                    av.attributeTypeEnum = AttributeTypeEnum.ArrowSize;
                    av.val = val;
                    break;
                case "labelangle":
                    av.attributeTypeEnum = AttributeTypeEnum.ArrowSize;
                    av.val = val;
                    break;
                case "weight":
                    av.attributeTypeEnum = AttributeTypeEnum.Weight;
                    av.val = val;
                    break;
                case "bgcolor":
                    av.attributeTypeEnum = AttributeTypeEnum.BGColor;
                    av.val = val;
                    break;
                case "fillcolor":
                    av.attributeTypeEnum = AttributeTypeEnum.FillColor;
                    av.val = val;
                    break;
                case "cellpadding":
                    av.attributeTypeEnum = AttributeTypeEnum.CELLPADDING;
                    av.val = Int32.Parse(val, AttributeBase.USCultureInfo);
                    break;
                case "border":
                    av.attributeTypeEnum = AttributeTypeEnum.Border;
                    av.val = Int32.Parse(val, AttributeBase.USCultureInfo);
                    break;
                case "xrad":
                    av.attributeTypeEnum = AttributeTypeEnum.XRad;
                    av.val = float.Parse(val, CultureInfo.InvariantCulture);
                    break;
                case "yrad":
                    av.attributeTypeEnum = AttributeTypeEnum.YRad;
                    av.val = float.Parse(val, CultureInfo.InvariantCulture);
                    break;
                case "padding":
                    av.attributeTypeEnum = AttributeTypeEnum.Padding;
                    av.val = float.Parse(val, CultureInfo.InvariantCulture);
                    break;
                default:
                    av.attributeTypeEnum = AttributeTypeEnum.Ignore;
                    break;
            }
            //throw new Exception("attribute \""+ attr +"\" is not supported");


            return av;
        }