コード例 #1
0
ファイル: FeaturesForm.cs プロジェクト: sillsdev/CarlaLegacy
        //******************************************************************
        /// <summary>
        /// Displays the Features form so the user can view (but not edit)
        /// the features of the given SyntaxNode. The user can also modify
        /// the FavoriteListFeatures, FavoriteTreeFeatures and
        /// CopyFavoritesOnly settings. If the user clicks OK, changes are
        /// saved to the settings, and DialogResult.OK is returned.
        /// Otherwise, DialogResult.Cancel is returned and any changes are
        /// discarded.
        /// </summary>
        public static DialogResult OpenFeaturesReadOnly(SyntaxNode oNode)
        {
            //**************************************************************
            // Validate the parameters.

            if (oNode == null)
            {
                string sMessage = "Invalid argument: "
                    + "FeaturesForm.OpenFeaturesReadOnly() requires "
                    + "a SyntaxNode object that is not null.";
                throw new Exception(sMessage);
            }

            //**************************************************************
            // Create an instance of the FeaturesForm.

            FeaturesForm oForm = new FeaturesForm();

            //**************************************************************
            // Set the form's ReadOnly property to true (the user is not
            // allowed to edit features).

            oForm.ReadOnly = true;

            //**************************************************************
            // Set the form's DisplayedNode property to a copy of the node
            // specified by the oNode parameter.

            oForm.DisplayedNode = oNode.CloneNode();

            //**************************************************************
            // Show the form so the user can view (but not edit) the
            // features of the DisplayedNode.

            DialogResult iResult = oForm.ShowDialog();

            //**************************************************************
            // Return the dialog result.

            return iResult;
        }
コード例 #2
0
ファイル: FeaturesForm.cs プロジェクト: sillsdev/CarlaLegacy
        //******************************************************************
        /// <summary>
        /// Displays the Features form so the user can view and edit the
        /// features of the given SyntaxNode. The user can also modify the
        /// FavoriteListFeatures, FavoriteTreeFeatures and CopyFavoritesOnly
        /// settings. If the user clicks OK, the edits are saved to the
        /// SyntaxNode features, changes are saved to the settings, and
        /// DialogResult.OK is returned. Otherwise, DialogResult.Cancel is
        /// returned and any changes are discarded.
        /// </summary>
        public static DialogResult OpenFeatures(SyntaxNode oNode)
        {
            //**************************************************************
            // Validate the parameters.

            if (oNode == null)
            {
                string sMessage = "Invalid argument: "
                    + "FeaturesForm.OpenFeatures() requires "
                    + "a SyntaxNode object that is not null.";
                throw new Exception(sMessage);
            }

            //**************************************************************
            // Create an instance of the FeaturesForm.

            FeaturesForm oForm = new FeaturesForm();

            //**************************************************************
            // Set the form's ReadOnly property to false.

            oForm.ReadOnly = false;

            //**************************************************************
            // Set the form's DisplayedNode property to a copy of the node
            // specified by the oNode parameter.

            oForm.DisplayedNode = oNode.CloneNode();

            //**************************************************************
            // Show the form so the user can view and edit the features of
            // the DisplayedNode.

            DialogResult iResult = oForm.ShowDialog();

            //**************************************************************
            // If the user clicked OK, save the changes that the user made
            // to the features:
            //
            // Update the specified oNode by clearing its features and then
            // copying all the features from the form's DisplayedNode to the
            // oNode.Features collection.

            if (iResult == DialogResult.OK)
            {
                oNode.Features.Clear();
                foreach (SyntaxFeature oFeature in
                    oForm.DisplayedNode.Features)
                {
                    oNode.Features[oFeature.Name] = oFeature.Value;
                }
            }

            //**************************************************************
            // Return the dialog result.

            return iResult;
        }