コード例 #1
0
        private static string AskForInput(UserInputOptions options)
        {
            var viewModel = new UserInputViewModel()
            {
                Message   = options.Message,
                Text      = options.DefaultText,
                Icon      = options.Icon,
                InputTest = options.InputTest
            };
            var window  = new System.Windows.Window();
            var control = new UserInputWindow()
            {
                window      = window,
                context     = viewModel,
                DataContext = viewModel,
            };

            window.Content               = control;
            window.Width                 = options.Width;
            window.WindowStyle           = System.Windows.WindowStyle.ThreeDBorderWindow;
            window.Height                = options.Height;
            window.Title                 = options.Title;
            window.ResizeMode            = System.Windows.ResizeMode.NoResize;
            window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            window.ShowDialog();

            return(viewModel.Text);
        }
コード例 #2
0
        protected override void OnDoWork(DoWorkEventArgs e)
        {
            UserInputWindow uiw = new UserInputWindow();

            uiw.ShowDialog();

            //uiw.

            e.Result = "";
        }
コード例 #3
0
ファイル: TablePage.xaml.cs プロジェクト: aminakhtar/LFU
        /// <summary>
        /// Add a column or columnd to the table
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddColumn_Click(object sender, RoutedEventArgs e)
        {
            UserInputWindow Uiw = new UserInputWindow("Enter column names");

            if (Uiw.ShowDialog() == true)
            {
                Log.Timer.Start();

                // get one or more strings from our generic user input dialog
                List <string> NewColumnNames = new List <string>(Uiw.Inputs);

                // call sqlite to alter table add column
                Db.Connect.AddColumns(this.TableName, NewColumnNames);

                // update the field names as displayed
                // the combobox of field names is bound to this list
                Dgv.FieldNamesAsDisplayed.AddRange(NewColumnNames);

                // until we undersand binding a little better....
                this.cmboFunctionField.ItemsSource = null;
                this.cmboFunctionField.ItemsSource = Dgv.FieldNamesAsDisplayed;

                this.cmboFunctionField.SelectedIndex = 0;
                // call sort to refresh the gridview
                this.Dgv.Sort(this.dgData, 0);

                Status("Added column"
                       + (NewColumnNames.Count == 1 ? "s " : " ")
                       + string.Join(", ", NewColumnNames)
                       + " to table "
                       + Dgv.TableName
                       + ". (" + Log.Timer.ElapsedTime().ToString()
                       + ")"
                       );
            }
        }