Esempio n. 1
0
 private void VmOnDataChanged()
 {
     if (!_updatingUI)
     {
         ViewModel.SaveBoard(ExchangeEditor.GetSelectedExchange());
     }
 }
Esempio n. 2
0
        private void BoardSelector_OnSelectionChanged(object sender, EventArgs e)
        {
            var cb = (ComboBox)sender;

            if (cb.IsDropDownOpen || ViewModel == null || _updatingUI)
            {
                return;
            }

            if (cb.SelectedItem != null)
            {
                var curText = cb.SelectedValue as string;
                if (!curText.IsEmpty())
                {
                    SetBoardCode(curText);
                }
            }
            else
            {
                var curText = cb.Text.Trim();
                if (curText.IsEmpty())
                {
                    return;
                }

                ExchangeEditor.SetExchange(null);
                SetBoardCode(curText);
            }
        }
Esempio n. 3
0
        public ExchangeEditorViewModel(ExchangeEditor editor, IExchangeInfoProvider provider)
        {
            if (editor == null)
            {
                throw new ArgumentNullException("editor");
            }

            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            _editor   = editor;
            _provider = provider;
            _isNew    = true;
        }
Esempio n. 4
0
        private void ResetBoardEditor()
        {
            _updatingUI = true;

            try
            {
                ViewModel.SetBoard(null);
                SetSaveError(null);
                CbBoardCode.Text = string.Empty;
                ExchangeEditor.SetExchange(null);
            }
            finally
            {
                _updatingUI = false;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// To set the board for editing.
        /// </summary>
        /// <param name="boardCode">The editing board code. The board for editing is loaded by the code from EntityRegistry.</param>
        public void SetBoardCode(string boardCode)
        {
            _updatingUI = true;

            try
            {
                if (boardCode.IsEmpty())
                {
                    ResetBoardEditor();
                    ExchangeEditor.SetExchange(null);
                    return;
                }

                ViewModel.SetBoard(boardCode);
                CbBoardCode.SelectedItem = Boards.FirstOrDefault(b => b.Code == ViewModel.BoardCode);
                ExchangeEditor.SetExchange(ViewModel.Board == null ? null : ViewModel.Board.Exchange.Name);
            }
            finally
            {
                _updatingUI = false;
            }
        }
Esempio n. 6
0
 private void ButtonClear_Click(object sender, RoutedEventArgs e)
 {
     ResetBoardEditor();
     ExchangeEditor.SetExchange(null);
 }