Exemplo n.º 1
0
 private void VmOnDataChanged()
 {
     if (!_updatingUI)
     {
         ViewModel.SaveBoard(ExchangeEditor.GetSelectedExchange());
     }
 }
Exemplo 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);
            }
        }
Exemplo 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;
        }
Exemplo n.º 4
0
        private void ResetBoardEditor()
        {
            _updatingUI = true;

            try
            {
                ViewModel.SetBoard(null);
                SetSaveError(null);
                CbBoardCode.Text = string.Empty;
                ExchangeEditor.SetExchange(null);
            }
            finally
            {
                _updatingUI = false;
            }
        }
Exemplo 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;
            }
        }
Exemplo n.º 6
0
 private void ButtonClear_Click(object sender, RoutedEventArgs e)
 {
     ResetBoardEditor();
     ExchangeEditor.SetExchange(null);
 }