Ejemplo n.º 1
0
        /// <summary>
        /// Opens the specified file name.
        /// Read the address space data set from an external dictionary file.
        /// </summary>
        /// <param name="FileName">Name of the file.</param>
        /// <param name="AdditionalResult">The additional result.</param>
        /// <returns>
        /// if FileName parameter is empty, it opens the file dialog to choose the file
        /// </returns>
        public bool Open(string FileName, out AdditionalResultInfo AdditionalResult)
        {
            m_OpenFileDialog.InitialDirectory = CAS.Lib.CodeProtect.InstallContextNames.ApplicationDataPath;
            if (string.IsNullOrEmpty(FileName))
            {
                if (m_OpenFileDialog.ShowDialog() != DialogResult.OK)
                {
                    AdditionalResult = AdditionalResultInfo.Cancel;
                    return(false);
                }
            }
            else
            {
                m_OpenFileDialog.FileName = FileName;
            }
            Cursor myPreviousCursor = Cursor.Current;

            try
            {
                Cursor.Current            = Cursors.WaitCursor;
                Application.UseWaitCursor = true;
                ReadConfiguration(m_OpenFileDialog.FileName);
                m_Empty = false;
                UpdateCurrentDirectoryInConfigurationFile(m_OpenFileDialog);
                AdditionalResult = AdditionalResultInfo.OK;
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show
                    (ex.Message + Environment.NewLine + m_OpenFileDialog.FileName,
                    Properties.Resources.SessionFileOpenError, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                m_OpenFileDialog.FileName = "";
                AdditionalResult          = AdditionalResultInfo.Exception;
                return(false);
            }
            finally
            {
                Application.UseWaitCursor = false;
                Cursor.Current            = myPreviousCursor;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Read the address space data set from an external dictionary file.
 /// </summary>
 /// <returns>it opens the file dialog to choose the file</returns>
 public bool Open(out AdditionalResultInfo AdditionalResult)
 {
     return(Open(string.Empty, out AdditionalResult));
 } /// <summary>