示例#1
0
        public void CreateListener(ConfigurationLevels level, string documentPath, Func <ConfigurationLevels, string, Task> LoadOnChangeAsyncCallback)
        {
            var document = FirestoreClient.Document(documentPath);

            ConfigurationDocuments.Add(level, document);
            document.Listen(async snapshot => await LoadOnChangeAsyncCallback(level, snapshot.Id));
        }
示例#2
0
        public async Task RemoveListener(ConfigurationLevels level)
        {
            if (ConfigurationListeners.ContainsKey(level))
            {
                await ConfigurationListeners[level].StopAsync();
            }

            if (ConfigurationDocuments.ContainsKey(level))
            {
                ConfigurationDocuments.Remove(level);
            }
        }
        public async Task <Dictionary <string, object> > GetDocumentFieldsAsync(ConfigurationLevels level)
        {
            if (ConfigurationDocuments.TryGetValue(level, out var document))
            {
                var snapshot = await document.GetSnapshotAsync();

                if (snapshot.Exists)
                {
                    return(snapshot.ToDictionary());
                }
            }
            return(new Dictionary <string, object>());
        }
        public void CreateListeners(Func <ConfigurationLevels, string, Task> loadOnChangeAsyncCallback)
        {
            ConfigurationDocuments.Add(ConfigurationLevels.Application, FirestoreClient.Document(_options.GetApplicationDocumentPath()));
            ConfigurationDocuments.Add(ConfigurationLevels.Stage, FirestoreClient.Document(_options.GetStageDocumentPath()));
            ConfigurationDocuments.Add(ConfigurationLevels.Tag, FirestoreClient.Document(_options.GetTagDocumentPath()));

            ConfigurationDocuments.ToList().ForEach(d =>
                                                    ConfigurationListeners.Add(d.Key, d.Value.Listen(async snapshot =>
            {
                await loadOnChangeAsyncCallback(d.Key, snapshot.Reference.Path);
            }))
                                                    );
        }
示例#5
0
        public void LoadDocument(TreeNode rootNode, ConfigurationDocuments confDocument)
        {
            TreeNode documentNode = rootNode.Nodes.Add(confDocument.Name, confDocument.Name);

            documentNode.Checked = true;
            documentNode.Tag     = confDocument;

            //Поля
            foreach (KeyValuePair <string, ConfigurationObjectField> ConfFields in confDocument.Fields)
            {
                string info = (ConfFields.Value.Type == "pointer" || ConfFields.Value.Type == "enum") ?
                              " -> " + ConfFields.Value.Pointer : "";

                TreeNode fieldNode = documentNode.Nodes.Add(ConfFields.Key, ConfFields.Value.Name + info);
                fieldNode.Checked = true;
                fieldNode.Tag     = ConfFields.Value;
            }

            if (confDocument.TabularParts.Count > 0)
            {
                TreeNode documentTabularPartsNode = documentNode.Nodes.Add("TabularParts", "Табличні частини");
                documentTabularPartsNode.Checked = true;

                foreach (KeyValuePair <string, ConfigurationObjectTablePart> ConfTablePart in confDocument.TabularParts)
                {
                    TreeNode documentTablePartNode = documentTabularPartsNode.Nodes.Add(ConfTablePart.Key, ConfTablePart.Value.Name);
                    documentTablePartNode.Checked = true;
                    documentTablePartNode.Tag     = ConfTablePart.Value;

                    //Поля
                    foreach (KeyValuePair <string, ConfigurationObjectField> ConfTablePartFields in ConfTablePart.Value.Fields)
                    {
                        string info = (ConfTablePartFields.Value.Type == "pointer" || ConfTablePartFields.Value.Type == "enum") ?
                                      " -> " + ConfTablePartFields.Value.Pointer : "";

                        TreeNode fieldNode = documentTablePartNode.Nodes.Add(ConfTablePartFields.Key, ConfTablePartFields.Value.Name + info);
                        fieldNode.Checked = true;
                        fieldNode.Tag     = ConfTablePartFields.Value;
                    }
                }
            }
        }
示例#6
0
        private void DirectoryForm_Load(object sender, EventArgs e)
        {
            if (ConfDocument == null)
            {
                ConfDocument      = new ConfigurationDocuments();
                textBoxTable.Text = Configuration.GetNewUnigueTableName(Program.Kernel);

                //string newUnigueNameInTable_Назва = Configuration.GetNewUnigueColumnName(Program.Kernel, ConfDocument.Table, ConfDocument.Fields);
                ConfDocument.AppendField(new ConfigurationObjectField("Назва", "docname", "string", "", "Назва", true));

                //string newUnigueNameInTable_ДатаДок = Configuration.GetNewUnigueColumnName(Program.Kernel, ConfDocument.Table, ConfDocument.Fields);
                ConfDocument.AppendField(new ConfigurationObjectField("ДатаДок", "docdate", "datetime", "", "ДатаДок", false, true));

                //string newUnigueNameInTable_НомерДок = Configuration.GetNewUnigueColumnName(Program.Kernel, ConfDocument.Table, ConfDocument.Fields);
                ConfDocument.AppendField(new ConfigurationObjectField("НомерДок", "docnomer", "string", "", "НомерДок", false, true));

                IsNewDocument = true;
            }
            else
            {
                OriginalName = ConfDocument.Name;

                textBoxName.Text  = ConfDocument.Name;
                textBoxTable.Text = ConfDocument.Table;
                textBoxDesc.Text  = ConfDocument.Desc;

                textBoxTriggersAfterSave.Text    = ConfDocument.TriggerFunctions.AfterSave;
                textBoxTriggersBeforeSave.Text   = ConfDocument.TriggerFunctions.BeforeSave;
                textBoxTriggersBeforeDelete.Text = ConfDocument.TriggerFunctions.BeforeDelete;

                textBoxSpend.Text      = ConfDocument.SpendFunctions.Spend;
                textBoxClearSpend.Text = ConfDocument.SpendFunctions.ClearSpend;

                IsNewDocument = false;
            }

            LoadFieldList();
            LoadTabularPartsList();
            LoadRegisters();
        }