Esempio n. 1
0
        public static klib.Dynamic OpenFile(string title, string filter)
        {
            value = klib.Dynamic.Empty;

            Thread t = new Thread(() =>
            {
                var openFileDialog    = new OpenFileDialog();
                openFileDialog.Title  = title;
                openFileDialog.Filter = filter;
                var dr = openFileDialog.ShowDialog(new Form());

                if (dr == DialogResult.OK)
                {
                    string fileName = openFileDialog.FileName;
                    value           = new klib.Dynamic(fileName);
                }
            });          // Kick off a new thread

            t.IsBackground = true;
            t.SetApartmentState(ApartmentState.STA);
            t.Start();

            while (t.ThreadState == ThreadState.Background)
            {
                Application.DoEvents();
            }

            klib.Shell.WriteLine(R.Project.ID, LOG, $"SUI - Selected the file: {value}");

            return(value);
        }
Esempio n. 2
0
        /// <summary>
        /// Get the value selected
        /// </summary>
        /// <param name="editText">The EditText item</param>
        /// <param name="error_msg">Add a personal message in the exception</param>
        /// <returns>Values object</returns>
        public static klib.Dynamic GetValue(ref SAPbouiCOM.EditText editText, string error_msg = null)
        {
            var val = new klib.Dynamic(editText.Value);

            if (val.IsEmpty)
            {
                throw new SUIException(4, editText.Item.Description, "EditText", error_msg);
            }

            return(val);
        }