/// <summary>
        /// Load the command set from its JSON file.
        /// </summary>
        ///
        /// The command set is the list of CommandTemplate objects available for the user to
        /// add to a route.
        ///
        /// <param name="filepath">The filename</param>
        /// <returns>Returns true if the file was loaded successfully, otherwise false is returned.</returns>
        private bool LoadCommandSet(String filepath)
        {
            bool retval = false;

            try
            {
                CommandSet = CommandTemplate.LoadCommandSet(filepath);
                retval     = true;
            }
            catch (Exception ex)
            {
                String msg = String.Format("Unable to load file {0}\n", filepath);
                MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            return(retval);
        }
Example #2
0
        /// <summary>
        /// Load the command set from its JSON file.
        /// </summary>
        ///
        /// The command set is the list of CommandTemplate objects available for the user to
        /// add to a route.
        ///
        /// <param name="filepath">The filename</param>
        /// <returns>Returns true if the file was loaded successfully, otherwise false is returned.</returns>
        private bool LoadCommandSet(String filepath)
        {
            bool retval = false;

            try
            {
                CommandSet = CommandTemplate.LoadCommandSet(filepath);
                retval     = true;
            }
            catch (Exception ex)
            {
                //don't show this error when xaml editor is trying to render or debugging
                if (!DesignerProperties.GetIsInDesignMode(this))
                {
                    String msg = String.Format("Unable to load file {0}\n", filepath);
                    MessageBox.Show(msg, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }

            return(retval);
        }