예제 #1
0
        public void init_config(bool _bDisplayProgressBar = true)
        {
            m_psavetime = 1;

            PowerSaveTimeRecord m_rec  = null;
            AsyncWorker         worker = new AsyncWorker(Application.Current.MainWindow);

            if (_bDisplayProgressBar)
            {
                worker.InvokeMethod <PowerSaveTimeRecord>(((MainWindow)App.Current.MainWindow).statusPanelPage.m_selectedPrinter, ref m_rec, DllMethodType.GetPowerSaveTime, this);
            }
            else
            {
                m_rec = worker.GetPowerSaveTime(((MainWindow)App.Current.MainWindow).statusPanelPage.m_selectedPrinter);
            }

            if (null != m_rec && m_rec.CmdResult == EnumCmdResult._ACK)
            {
                m_psavetime = m_rec.Time;
            }

            spinnerControl1.FormattedValue = String.Format("{0}", m_psavetime);

            TextBox tb = spinnerControl1.Template.FindName("tbTextBox", spinnerControl1) as TextBox;

            tb.TextChanged      += new TextChangedEventHandler(SpinnerTextBox_TextChanged);
            tb.PreviewTextInput += new TextCompositionEventHandler(SpinnerTextBox_PreviewTextInput);
            tb.PreviewKeyDown   += new KeyEventHandler(OnPreviewKeyDown);
            // UpdateApplyBtnStatus();
        }