Exemple #1
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();
        }
        protected override void InitializeWorkerMain()
        {
            if (!WorkerSettings.TryGetValue("OutputFolder", out OutputFolder))
            {
                throw new ArgumentException("Missing argument 'OutputFolder'");
            }

            if (!WorkerSettings.TryGetValue("ConfigFileName", out string configFileName))
            {
                throw new ArgumentException("Missing argument 'ConfigFileName'");
            }

            if (!WorkerSettings.TryGetValue("PluginId", out string pluginId))
            {
                throw new ArgumentException("Missing argument 'PluginId'");
            }

            this.Fields = FieldUtils.GetFieldsFromXml(configFileName, pluginId).ToList();

            if (!Directory.Exists(OutputFolder))
            {
                Directory.CreateDirectory(OutputFolder);
            }

            this.GlobalStorage = this.Runtime.GetWorkspaceDocsStorage(this.Runtime.CurrentWorkspace.ID);
        }
Exemple #3
0
        public DocumentsList()
        {
            Hexpand = true;
            Vexpand = true;

            storage = GlobalDI.GetService <IDocumentsStorage>();
            storage.DocumentAdded   += (sender, args) => RefreshItems();
            storage.DocumentRemoved += (sender, args) => RefreshItems();
        }
Exemple #4
0
        protected override void InitializeWorkerMain()
        {
            if (!WorkerSettings.TryGetValue("OutputFolder", out OutputFolder))
            {
                throw new ArgumentException("Missing argument 'OutputFolder'");
            }

            if (!WorkerSettings.TryGetValue("OutputFileName", out OutputFileName))
            {
                throw new ArgumentException("Missing argument 'OutputFileName'");
            }

            if (!WorkerSettings.TryGetValue("GeneratePdf", out string GeneratePdf))
            {
                throw new ArgumentException("Missing argument 'GeneratePdf'");
            }

            this.GeneratePdf = bool.TrueString.Equals(GeneratePdf, StringComparison.InvariantCultureIgnoreCase);

            if (!WorkerSettings.TryGetValue("ConfigFileName", out string configFileName))
            {
                throw new ArgumentException("Missing argument 'ConfigFileName'");
            }

            if (!WorkerSettings.TryGetValue("PluginId", out string pluginId))
            {
                throw new ArgumentException("Missing argument 'PluginId'");
            }

            this.Fields = FieldUtils.GetFieldsFromXml(configFileName, pluginId).ToList();

            if (!Directory.Exists(OutputFolder))
            {
                Directory.CreateDirectory(OutputFolder);
            }

            this.GlobalStorage = this.Runtime.GetWorkspaceDocsStorage(this.Runtime.CurrentWorkspace.ID);
        }
Exemple #5
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);
        }
 public DocumentsController(IDocumentsStorage documentsStorage, IDocumentsRepository documentsRepository)
 {
     _documentsStorage    = documentsStorage;
     _documentsRepository = documentsRepository;
 }
 public DocumentsRepository(IDocumentsStorage documentsStorage)
 {
     _documentsStorage = documentsStorage;
 }