public void DataChanged()
        {
            currentCategories = dbAdapter.GetCategoriesNames();
            int currentIndex = cbCategories.Active;

            GtkHelper.FillComboBox(cbCategories, currentCategories);
            cbCategories.Active = currentIndex;
        }
        protected override void HookEditTreeRow(TreeView treeView, RowActivatedArgs args, object tabData)
        {
            this.day = (int)tabData;

            CurrText = (string)currTreeStore
                       .GetValue(currTreeIter, (int)ProgrammColumnID.Text);
            string typString = (string)currTreeStore
                               .GetValue(currTreeIter, (int)ProgrammColumnID.Typ);
            string timeString;

            if (IsParent(args))
            {
                // Parent Node, just set flags
                currParentIter     = currTreeIter;
                timeBox.IsEditable = true;
            }
            else
            {
                // Child Node, get Parent iter, set flags
                TreeIter parentIter;
                currTreeStore.IterParent(out parentIter, currTreeIter);
                currParentIter = parentIter;

                timeBox.IsEditable = false;
                CurrText           = API_Contract.ConvertTreeViewToEditView(CurrText);
            }
            // Time is depending from parentIter
            timeString = (string)currTreeStore
                         .GetValue(currParentIter, (int)ProgrammColumnID.Uhrzeit);

            // Set Type Arrays
            if (IsParent(args))
            {
                // Termin is parent
                GtkHelper.FillComboBox(cbTyp, API_Contract.ProgrammTerminTypVal);
                cbTyp.Active = API_Contract.ProgrammTerminTypCR[typString];
            }
            else
            {
                GtkHelper.FillComboBox(cbTyp, API_Contract.ProgrammDescrTypVal);
                cbTyp.Active = API_Contract.ProgrammDescrTypCR[typString];
            }

            // Set new values
            timeBox.Time = timeString;
            // Set default values
            origTyp = cbTyp.Active;
        }
        public void PrepareComboBoxes()
        {
            // Get Databse data
            dbAdapter.GetToolbarData(out dataKrzl, out dataVeranstaltung, out dataVeranstaltungIds,
                                     out dataSprache, out dataInstanz);

            if (dataVeranstaltung.Length != 0)               // CurrDatabase is not Empty
            // Temporay dataArray to make it human readable

            {
                String[] dataVeranstaltungSummary = new String[dataVeranstaltung.Length];
                for (int i = 0; i < dataVeranstaltung.Length; i++)
                {
                    dataVeranstaltungSummary[i] = "'" + dataKrzl[i] +
                                                  "' - '" + dataVeranstaltung[i] + "' - '" + dataSprache[i] + "'";
                }

                GtkHelper.FillComboBox(cbVeranstaltung, dataVeranstaltung);
                GtkHelper.FillComboBox(cbInstanz, dataInstanz[0]);

                // Set default box value and register callbacks
                cbVeranstaltung.Active   = cbInstanz.Active = 0;
                cbVeranstaltung.Changed += OnVeranstaltungsBoxChanged;
                cbInstanz.Changed       += OnInstanzBoxChanged;

                // Set DbAdapter default values
                activeVeranstaltung             = dataVeranstaltungIds[0];
                dbAdapter.Curr_veranstaltungsId = dataVeranstaltungIds[0];
                dbAdapter.Curr_lang             = dataSprache[0];
                dbAdapter.Curr_instanzId        = int.Parse(dataInstanz[0][0].Substring(0, dataInstanz[0][0].IndexOf(":")));

                // Draw frames
                editAdapter.Refresh();
                listAdapter.Refresh();
            }
            else                 // Create empty boxes
            {
                activeVeranstaltung = -1;
                dbAdapter.NoActiveVeranstaltung();
                cbVeranstaltung.Changed -= OnVeranstaltungsBoxChanged;
                cbInstanz.Changed       -= OnInstanzBoxChanged;

                cbInstanz.Clear();
                cbVeranstaltung.Clear();
            }
        }
示例#4
0
        protected override void EditTreeRow(TreeView treeView, RowActivatedArgs args, object tabData)
        {
            this.tabName = (string)tabData;

            string typString = (string)currTreeStore.GetValue(currTreeIter, (int)CategorieColumnID.Typ);

            origDbText = (string)currTreeStore.GetValue(currTreeIter, (int)CategorieColumnID.Text);
            origRang   = int.Parse((string)currTreeStore.GetValue(currTreeIter, (int)CategorieColumnID.Rang));
            int activeTyp;

            // Get ParentIter and Type
            if (IsParent(args))
            {
                // Parent Node, just get values
                currParentIter = currTreeIter;

                GtkHelper.FillComboBox(cbTyp, API_Contract.CategorieTextTypParentVal);
                activeTyp = API_Contract.CategorieTextParentTypCR[typString];
            }
            else
            {
                // Child Node, get parent and values
                TreeIter parentIter;
                currTreeStore.IterParent(out parentIter, currTreeIter);
                currParentIter = parentIter;

                GtkHelper.FillComboBox(cbTyp, API_Contract.CategorieTextTypChildVal);
                activeTyp = API_Contract.CategorieTextChildTypCR[typString];
            }

            // Set new values
            cbTyp.Active = activeTyp;
            textEntry.Buffer.Clear();
            var buff = textEntry.Buffer;

            API_Contract.ConvertDatabaseToEditCategorie(origDbText, ref buff);

            // Set default values
            origText          = buff.Text;
            origTyp           = activeTyp;
            boldButton.Active = italicButton.Active = false;
        }
        private void UpdateValues()
        {
            currentCategories = dbAdapter.GetCategoriesNames();

            if (currentCategories.Length != 0)
            {
                GtkHelper.FillComboBox(cbCategories, currentCategories);

                cbCategories.Active   = 0;
                cbCategories.Changed += OnCategorieChanged;

                dbAdapter.Curr_categorie = currentCategories[0];
            }
            else
            {
                cbCategories.Clear();
                cbCategories.Changed -= OnCategorieChanged;
                dbAdapter.NoActiveCategorie();
            }
        }
        private void OnVeranstaltungsBoxChanged(object sender, EventArgs args)
        {
            int newVal = cbVeranstaltung.Active;

            activeVeranstaltung = newVal;
            if (newVal >= 0)
            {
                // Set DatabaseAdapter values
                dbAdapter.Curr_lang             = dataSprache[newVal];
                dbAdapter.Curr_veranstaltungsId = dataVeranstaltungIds[newVal];

                // Prepare InstanzBox
                GtkHelper.FillComboBox(cbInstanz, dataInstanz[newVal]);
                cbInstanz.Active = 0;
            }
            else
            {
                dbAdapter.Curr_veranstaltungsId = -1;
            }
            OnInstanzBoxChanged(null, null);             // implicit redraws frames
        }