コード例 #1
0
        private void RenameableToggleButton_Checked(object sender, RoutedEventArgs e)
        {
            RenameableToggleButton toggleButton = sender as RenameableToggleButton;

            //Обработка переключения до цикла!

            //FLog.Log("ChB_Config_N_Checked");
            if (!noEvents)
            {
                try
                {
                    //Timer_camera_checker.Stop();
                    Config_tag = ((sender as RenameableToggleButton).Tag as string); //Вычленяем номер конфигурации

                    if (mainViewModel.ScaleAuto)
                    {
                        CalculateZoomFactor((int)Host.ActualWidth, (int)Host.ActualHeight, IMG_W_now, IMG_H_now);
                    }
                    else
                    {
                        AdaptViewportControl();
                    }

                    mainViewModel.SaveCurrentCameraConfig();
                    mainViewModel.ConfigKey = Config_tag;

                    //LastConfig_tag = Config_tag; // присваиваем последнему загруженному тегу тот, который загружен сейчас

                    //Timer_camera_checker.Start();
                    //WhenDeviceOpened();
                }
                catch (Exception exc)
                {
                    FLog.Log("Ошибка при переключении конфигураций");
                }
            }

            //Uncheck prvious
            for (int i = 0; i < renameableButtonsConfigs.Count; i++)
            {
                if (renameableButtonsConfigs[i] != toggleButton && renameableButtonsConfigs[i].toggleButon.IsChecked == true)
                {
                    renameableButtonsConfigs[i].toggleButon.IsChecked = false;
                }
            }
        }
コード例 #2
0
        public void Init_ListOf_CheckButtons()
        {
            noEvents = true;
            RenameableToggleButton rtb = null;

            for (int i = 0; i < stackPanelPhacoButtons.Children.Count; i++)
            {
                rtb = stackPanelPhacoButtons.Children[i] as RenameableToggleButton;
                renameableButtonsConfigs.Add(rtb);
                rtb.Text = mainViewModel.ConfigsDictionary[rtb.Tag as string].ConfigName;
                if ((string)rtb.Tag == mainViewModel.ConfigKey)
                {
                    rtb.IsChecked = true;
                    tabPhaco.Focus();
                }
            }

            for (int i = 0; i < stackPanelVitreoButtons.Children.Count; i++)
            {
                rtb = stackPanelVitreoButtons.Children[i] as RenameableToggleButton;
                renameableButtonsConfigs.Add(rtb);
                rtb.Text = mainViewModel.ConfigsDictionary[rtb.Tag as string].ConfigName;
                if ((string)rtb.Tag == mainViewModel.ConfigKey)
                {
                    rtb.IsChecked = true;
                    tabVitreo.Focus();
                }
            }

            for (int i = 0; i < stackPanelUserConfigs.Children.Count; i++)
            {
                rtb = stackPanelUserConfigs.Children[i] as RenameableToggleButton;
                renameableButtonsConfigs.Add(rtb);
                rtb.Text = mainViewModel.ConfigsDictionary[rtb.Tag as string].ConfigName;
                if ((string)rtb.Tag == mainViewModel.ConfigKey)
                {
                    rtb.IsChecked = true;
                    tabUser.Focus();
                }
            }
            noEvents = false;
        }