Esempio n. 1
0
        public static IDisposable WithAutoDIResolver(this AutoMocker mocker)
        {
            var provider = new AutoDIServiceProvider(mocker);

            GlobalDI.Register(provider);
            return(new Disposable(() => GlobalDI.Unregister(provider)));
        }
Esempio n. 2
0
        public MainWindow(Gtk.Application application) : base(application)
        {
            storage = GlobalDI.GetService <IDocumentsStorage>();

            // Widget initialization
            DefaultSize  = new Gdk.Size(800, 600);
            DeleteEvent += Window_DeleteEvent;

            // Init children widgets
            header   = new Header();
            Titlebar = header;

            container = new Norka.Widgets.Paned(Orientation.Horizontal, this);

            _docList = container.Sidebar.DocumentsList;
            _docList.SelectedRowsChanged += (sender, args) => DocumentSelected();
            _docList.ItemRenamed         += DocumentRename;
            _editor = container.Editor;
            Add(container);

            container.Sidebar.DocumentsList.RefreshItems();

            var content = new Box(Orientation.Vertical, 0);

            content.PackStart(container, true, true, 0);
            Add(content);

            // Finally connect actins to window
            SetupActions();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            AutoDI.Generated.AutoDI.Init();
            var quoteBoard = GlobalDI.GetService <QuoteBoard>();

            quoteBoard.ShowQuotes();
            System.Console.ReadLine();
        }
Esempio n. 4
0
        public DocumentsList()
        {
            Hexpand = true;
            Vexpand = true;

            storage = GlobalDI.GetService <IDocumentsStorage>();
            storage.DocumentAdded   += (sender, args) => RefreshItems();
            storage.DocumentRemoved += (sender, args) => RefreshItems();
        }
Esempio n. 5
0
        public void UnregisterRemovesProvider()
        {
            var provider = new TestProvider();

            GlobalDI.Register(provider);

            GlobalDI.Unregister(provider);

            Assert.IsFalse(GlobalDI.Providers.Contains(provider));
        }
Esempio n. 6
0
        public void RegisterAddsProviders()
        {
            var provider1 = new TestProvider();
            var provider2 = new TestProvider();

            GlobalDI.Register(provider1);
            GlobalDI.Register(provider2);

            var providers = GlobalDI.Providers.ToList();
            int index1    = providers.IndexOf(provider1);
            int index2    = providers.IndexOf(provider2);

            Assert.IsTrue(index1 >= 0);
            Assert.IsTrue(index2 >= 0);
            Assert.IsTrue(index1 > index2);
        }
Esempio n. 7
0
        public Editor(Gtk.Window parent)
        {
            Parent = parent;
            View   = new Box(Orientation.Vertical, 0);

            // Load services
            storage = GlobalDI.GetService <IDocumentsStorage>();

            // Init widgets
            var scrolled = new ScrolledWindow()
            {
                Expand = true
            };

            View.StyleContext.AddClass("view");

            FormatBar      = new FormatBar(Orientation.Horizontal, 6);
            FormatRevealer = new Revealer();
            FormatRevealer.Add(FormatBar);

            FormatRevealer.RevealChild = false;

            TextTagTable tagTable = new TextTagTable();

            foreach (var tag in Tags)
            {
                tagTable.Add(tag.Value);
            }
            TextBuffer        = new TextBuffer(tagTable);
            SerializeFormat   = TextBuffer.RegisterSerializeTagset("text/markdown");
            DeserializeFormat = TextBuffer.RegisterDeserializeTagset("text/markdown");
            EditorView        = new EditorView(TextBuffer);
            scrolled.Add(EditorView);

            View.PackStart(FormatRevealer, false, true, 0);
            View.PackEnd(scrolled, true, true, 0);
        }