Exemplo n.º 1
0
        public string AddDocument(string title)
        {
            var doc = new Document();

            doc.Title.Value = title;
            DocumentsSource.Add(doc);
            return(doc.Id.Value);
        }
Exemplo n.º 2
0
        public async Task LoadDataAsync()
        {
            if (!await LocalObjectStorageHelper.FileExistsAsync("docs.json"))
            {
                return;
            }

            DataChangedDisposable.Disposable = Disposable.Empty;
            var docs = await LocalObjectStorageHelper.ReadFileAsync("docs.json", Enumerable.Empty <Document>());

            foreach (var doc in docs)
            {
                DocumentsSource.Add(doc);
            }
            StartObserveDataChanged();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add a layout item to this instance.
        /// </summary>
        /// <param name="item">The item to dock.</param>
        /// <param name="setAsActive">Set the item as the currenly active content.</param>
        public void AddLayoutItem(ILayoutItemViewModel item, bool setAsActive)
        {
            switch (item)
            {
            case IToolViewModel tool:
                AnchorablesSource.Add(tool);
                break;

            case IDocumentViewModel document:
                DocumentsSource.Add(document);
                break;

            default:
                return;
            }
            if (setAsActive)
            {
                ActiveContent = item;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Adds a new Document. Optionally adds a Command or Workflow
        /// </summary>
        /// <param name="title"></param>
        public DocumentViewModel AddDocument(string title)
        {
            //FIXME handle better?
            string ContentId = "workspace_" + (this.DocumentsSource.Count + 1).ToString();

            DocumentViewModel document = new DocumentViewModel(DialogService, ConfigService)
            {
                Title           = title,
                ContentId       = ContentId,
                ParentViewModel = this,
                Settings        = new WF_Settings(ConfigService, Logger) //FIXME
            };

            DocumentsSource.Add(document);

            //FIXME bugged?
            DocumentViewModel currentDoc = this.DocumentsSource.FirstOrDefault(x => x.ContentId == ContentId);

            return(document);
        }