示例#1
0
 /// <summary>
 /// Updates all properties hidden values according shown properties.
 /// </summary>
 public void UpdateAllProperties()
 {
     PresentedPropertiesManage.ChangeHiddenValuesByOtherFile(
         ref this.allShownPresentedPropertiesXmlInstance, ref this.newShownPresentedPropertiesXmlInstance);
     this.AllPropertiesDGW.DataSource = this.allShownPresentedPropertiesXmlInstance.PropertiesList;
     this.Refresh();
 }
        /// <summary>The load ts b_ click.</summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The e value.</param>
        private void LoadTsbClick(object sender, EventArgs e)
        {
            var openShown = new OpenFileDialog
            {
                InitialDirectory = string.IsNullOrEmpty(Settings.Default.FileFolder) ?
                                   this.allShownPresentedPropertiesXmlInstance.LoadSaveDirectory :
                                   Settings.Default.FileFolder
            };

            if (openShown.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    var loadedProperties = PresentedPropertiesXml.ReadPropertiesListFromFile(openShown.FileName);
                    if (loadedProperties.Count > 0)
                    {
                        this.newShownPresentedPropertiesXmlInstance.PropertiesList = loadedProperties;
                        Settings.Default.FileFolder = Path.GetDirectoryName(openShown.FileName);
                        Settings.Default.Save();
                    }

                    this.ShownPropertiesDGW.DataSource = this.newShownPresentedPropertiesXmlInstance.PropertiesList;
                    this.ShownPropertiesDGW.Refresh();

                    PresentedPropertiesManage.ChangeHiddenValuesByOtherFile(
                        ref this.allShownPresentedPropertiesXmlInstance, ref this.newShownPresentedPropertiesXmlInstance);

                    this.allShownPresentedPropertiesXmlInstance.ForceReadFile();
                }
                catch (Exception ee)
                {
                    Debug.WriteLine(ee.ToString());
                }
            }
        }
        /// <summary>Handles the Click event of the OkButton control.</summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void OkButtonClick(object sender, EventArgs e)
        {
            this.ownAllPresentedPropertiesXmlInstance.XmlWriteProperties(
                this.ownAllPresentedPropertiesXmlInstance.PropertiesList);

            PresentedPropertiesManage.MakeFileFromOtherFilesHiddenProperties(
                ref this.ownShownPresentedPropertiesXmlInstance, ref this.ownAllPresentedPropertiesXmlInstance);
        }
示例#4
0
        /// <summary>Initializes a user control for handling all properties.</summary>
        /// <param name="newParentForm">A form in relation location of this form is set.</param>
        /// <param name="allPresentedPropertiesXmlInstance">PresentedPropertiesXml instance which contains all properties.</param>
        /// <param name="shownPresentedPropertiesXmlInstance">PresentedPropertiesXml instance which contains shown properties.</param>
        /// <param name="methodToLocalize">Delegate method to use for localization.</param>
        public void InitializeAllPropertiesDialog(
            Form newParentForm,
            ref PresentedPropertiesXml allPresentedPropertiesXmlInstance,
            ref PresentedPropertiesXml shownPresentedPropertiesXmlInstance,
            LocalisationDelegate methodToLocalize)
        {
            // Add quick search
            this.quickSearchUserCntrl = new QuickSearchForDGW();
            this.quickSearchUserCntrl.SetReferenceProperties(ref this.AllPropertiesDGW);
            var quickSearchUserCntrlControlHost = new ToolStripControlHost(this.quickSearchUserCntrl)
            {
                Alignment = ToolStripItemAlignment.Right
            };

            this.quickSearchUserCntrl.Width = 140;
            this.AllPropertiesToolStrip.SuspendLayout();
            this.AllPropertiesToolStrip.Items.Add(quickSearchUserCntrlControlHost);
            this.AllPropertiesToolStrip.ResumeLayout();

            if (methodToLocalize != null)
            {
                methodToLocalize(this);
                methodToLocalize(this.contextMenuStrip1);
                this.validationErrorLabel.Text = "albl_Change_default_property_name";
                methodToLocalize(this.validationErrorLabel);
            }

            this.AllPropertiesDGW.AutoGenerateColumns = false;

            this.AllPropertiesDGW.SelectionChanged += this.ShownPropertiesDGWSelectionChanged;
            this.AllPropertiesDGW.KeyDown          += this.AllPropertiesDGWKeyDown;
            this.AllPropertiesDGW.Sorted           += this.AllPropertiesDGWSorted;

            PresentedPropertiesManage.ChangeHiddenValuesByOtherFile(
                ref allPresentedPropertiesXmlInstance, ref shownPresentedPropertiesXmlInstance);
            allPresentedPropertiesXmlInstance.ForceReadFile();
            this.newShownPresentedPropertiesXmlInstance = shownPresentedPropertiesXmlInstance;
            this.allShownPresentedPropertiesXmlInstance = allPresentedPropertiesXmlInstance;
            this.AllPropertiesDGW.DataSource            = this.allShownPresentedPropertiesXmlInstance.PropertiesList;

            this.AllPropertiesDGW.ReadOnly              = false;
            this.AllPropertiesDGW.AllowUserToAddRows    = true;
            this.AllPropertiesDGW.AllowUserToDeleteRows = true;
            this.AllPropertiesDGW.SelectionMode         = DataGridViewSelectionMode.CellSelect;
            this.AllPropertiesDGW.Columns[0].ReadOnly   = false;
        }
 /// <summary>
 /// Updates shown properties list according all properties hidden values.
 /// </summary>
 public void UpdateShownProperties()
 {
     PresentedPropertiesManage.MakeFileFromOtherFilesHiddenProperties(ref this.newShownPresentedPropertiesXmlInstance, ref this.allShownPresentedPropertiesXmlInstance);
     this.ShownPropertiesDGW.DataSource = this.newShownPresentedPropertiesXmlInstance.PropertiesList;
     this.Refresh();
 }