Ejemplo n.º 1
0
        /// <summary>
        /// Last edit by EC on 2017-10-05
        /// Imports Concentration data via toolbar icon
        /// </summary>
        /// <param name="filename">
        /// filename of dataset which should be imported
        /// </param>
        /// <returns>
        /// true, if file was imported successfully; false, if an error occurred
        /// </returns>
        public bool Run(string filename)
        {
            if ((new OpenImport()).ViaIcon() == false)
            {
                Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Cannot open Import Dialog");
                return(false);
            }

            // Last Edit by EC on 2017-10-05
            // Workaround für Import Message Box
            // Kann gelöscht werden sobald die Message Box aus Concentration verschwindet
            Execution.OpenFileBrowser.Cancel();
            Log.Warn(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Close Message Box with information for import.");

            if (Execution.OpenFileBrowser.Load(filename) == false)
            {
                Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Cannot load " + filename);
                return(false);
            }

            string userNotification = new GUI.StatusArea.Usermessages.UserMessagesElements().UserNotification;

            const string SuccessNotification = "Success";
            const string InfoNotification    = "Info";

            if (userNotification.StartsWith(SuccessNotification) || userNotification.StartsWith(InfoNotification))
            {
                Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), filename + " has been imported");
                return(true);
            }

            Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Importing {0} results in user notification: {1}", filename, userNotification));
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Imports Viscosity data via toolbar icon
        /// </summary>
        /// <param name="filename">
        /// filename (and path)of dataset which should be imported
        /// </param>
        /// <returns>
        /// true, if file was imported successfully; false, if an error occurred
        /// </returns>
        public bool Run(string filename)
        {
            try
            {
                if (Execution.OpenImport.ViaIcon() == false)
                {
                    Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Cannot open Import Dialog");
                    return(false);
                }

                if (OperatingSystemLoader.Functions.Dialogs.Execution.OpenFileBrowser.Load(filename) == false)
                {
                    Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Cannot load " + filename);
                    return(false);
                }

                string userNotification = new GUI.StatusArea.Usermessages.UserMessagesElements().UserNotificationMessage;

                const string SuccessNotification = "Success";
                const string InfoNotification    = "Info";

                if (userNotification.StartsWith(SuccessNotification) || userNotification.StartsWith(InfoNotification))
                {
                    Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), filename + " has been imported");
                    return(true);
                }

                Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Importing {0} results in user notification: {1}", filename, userNotification));
                return(false);
            }
            catch (Exception e)
            {
                Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), e.Message);
                return(false);
            }
        }