Exemplo n.º 1
0
        private void deleteDesc_Click(object sender, EventArgs e)
        {
            var result = MessageBox.Show("Möchten Sie die gesamte Beschreibung für diese Smartart-Grafik unwiederruflich löschen?", "Beschreibung löschen", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == System.Windows.Forms.DialogResult.Yes)
            {
                //Delete the description from XML
                XmlWriter xmlWriter = XmlWriter.GetInstance;
                xmlWriter.DeleteSmartArtDescription(GetCategory(), GetSubCategory());
                //Call "ListAllSmartArts"-Form to reload
                ListAllSmartArts.GetInstanz.ReloadTreeView();
                //Close the window
                disposHappen = true;
                DescFormManager formManger = DescFormManager.GetInstanz;
                formManger.CloseDescForm(GetSubCategory());
                Close();
            }
        }
Exemplo n.º 2
0
        private void descSaveButton_Click(object sender, EventArgs e)
        {
            /*
             * 1. check if any textbox is empty
             * 2. check if the used placeholder right
             * 3. insert the new content
             */
            XmlWriter xmlWriter    = XmlWriter.GetInstance;
            string    errorMessage = "";

            // 1. step
            if (TextboxHasContent())
            {
                // 2. step
                if (checkUsedPlaceholder())
                {
                    // 3. step
                    if (GetFoundDescription())
                    {
                        /*
                         * Starts only if the XML contains the old description
                         */
                        if (saveStateLabel.ForeColor == System.Drawing.Color.Red)
                        {
                            if (txtShortDesc.Modified)
                            {
                                if (!(xmlWriter.ChangeShortDescInnerText(GetCategory(), GetSubCategory(), txtShortDesc.Text)))
                                {
                                    errorMessage = "Die Kurzbeschreibung konnte nicht abgespeichert werden";
                                }
                                else
                                {
                                    txtShortDesc.Modified = false;
                                }
                            }
                            if (txtLongDesc.Modified)
                            {
                                if (!(xmlWriter.ChangeLongDescInnerText(GetCategory(), GetSubCategory(), "description", txtLongDesc.Text)))
                                {
                                    errorMessage += "Die Langbeschreibung konnte nicht abgespeichert werden";
                                }
                                else
                                {
                                    txtLongDesc.Modified = false;
                                }
                            }
                            if (txtMainPointDesc.Modified)
                            {
                                if (!(xmlWriter.ChangeLongDescInnerText(GetCategory(), GetSubCategory(), "eachMainPoint", txtMainPointDesc.Text)))
                                {
                                    errorMessage += "Die Hauptpunktbeschreibung konnte nicht abgespeichert werden";
                                }
                                else
                                {
                                    txtMainPointDesc.Modified = false;
                                }
                            }
                            if (txtSubPointDesc.Modified)
                            {
                                if (!(xmlWriter.ChangeLongDescInnerText(GetCategory(), GetSubCategory(), "eachSubPoint", txtSubPointDesc.Text)))
                                {
                                    errorMessage += "Die Unterpunktbeschreibung konnte nicht abgespeichert werden";
                                }
                                else
                                {
                                    txtSubPointDesc.Modified = false;
                                }
                            }
                        }
                    }
                    else
                    {
                        /*
                         * starts only if the XML does not contains the special SmartArtDescription
                         */
                        //// Tab Shortdescription ------
                        SetShortDescription(txtShortDesc.Text);

                        //// Tab Longdescription -------
                        SetLongDescription(txtLongDesc.Text);
                        SetMainPointDescription(txtMainPointDesc.Text);
                        SetSubPointDescription(txtSubPointDesc.Text);

                        // creat a new XML part
                        if (!(xmlWriter.InsertNewSubCategory(GetCategory(), GetSubCategory(), GetShortDescription(), GetLongDescription(), GetMainPointDescription(), GetSubPointDescription())))
                        {
                            errorMessage += "Beim Anlegen der neuen XML-Knoten ist was schief gegangen";
                        }
                        txtShortDesc.Modified     = false;
                        txtLongDesc.Modified      = false;
                        txtMainPointDesc.Modified = false;
                        txtSubPointDesc.Modified  = false;
                    }
                }
                else
                {
                    errorMessage += "Mit den Platzhaltern stimmt etwas nicht. \n Bitte kontrollieren Sie ihre Eingaben.";
                }
            }
            else
            {
                errorMessage += "Sie haben nicht alle Textfelder ausgefüllt. \n Bitte füllen Sie alle Felder.";
            }
            //--------------------------------------
            if (errorMessage != "")
            {
                MessageBox.Show(errorMessage, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error);
                SaveStateLabel_Font();
            }
            else
            {
                SaveStateLabel_Font();
            }
        }