public CardEditorWindow(Settings settings, string tempDirPath, YandexSpeech yandexSpeech, Card card, bool withoutSpace)
        {
            InitializeComponent();

            Caption   = card.Title;
            Image     = SetImageFromPath(card.ImagePath);
            AudioPath = card.AudioPath;

            _yandexSpeech            = yandexSpeech;
            _tempDirPath             = tempDirPath;
            _settings                = settings;
            voiceSelect.ItemsSource  = YandexVoice.VOICES;
            voiceSelect.SelectedItem = YandexVoice.FindById(settings.VoiceId);
            acceptButton.Content     = "Изменить";

            _withoutSpace = withoutSpace;

            if (withoutSpace == true)
            {
                panelWithAudioButtons.Visibility   = Visibility.Hidden;
                infoAboutAudioTextBlock.Visibility = Visibility.Visible;
            }

            SetCardType(card.CardType);
        }
Пример #2
0
        public MainWindow(Settings settings)
        {
            StaticServer.instance.ReportEvent("startupApp");
            inputSimulator = new InputSimulator();
            InitializeComponent();

            _tempDirPath = settings.TempDirPath;

            _yandexSpeech = settings.YandexSpeech;

            _host = settings.Host;

            ChangeSettings(settings);

            _cards = new List <Card>();

            cardBoard.ClickOnCardButton  += cardButton_Click;
            cardBoard.CountPagesChanged  += CardBoard_CountPagesChanged;
            cardBoard.CurrentPageChanged += CardBoard_CurrentPageChanged;
            cardBoard.Cards = _cards;

            _words = new List <Card>();
            try
            {
                var joystick = new Joysticks();
                joystick.JoystickButtonDown += Joystick_JoystickButtonDown;
            } catch (Exception e)
            {
            }
            _player = new Player(_yandexSpeech);
        }
        public EditorWindow(string tempDirPath, YandexSpeech yandexSpeech)
        {
            InitializeComponent();

            // Создать директорию для временных файлов
            _tempDirPath = tempDirPath;

            _yandexSpeech = yandexSpeech;

            _cards = new List <Card>();

            cardBoard.Cards                = _cards;
            cardBoard.ClickOnCardButton   += ClickOnCardButton;
            cardBoard.CountPagesChanged   += CardBoard_CountPagesChanged;
            cardBoard.CurrentPageChanged  += CardBoard_CurrentPageChanged;
            cardBoard.SelectedCardChanged += CardBoard_SelectedCardChanged;
            cardBoard.Edited              += CardBoard_Edited;
        }
Пример #4
0
        public CardEditorWindow(string tempDirPath, YandexSpeech yandexSpeech, Card card, bool withoutSpace)
        {
            InitializeComponent();

            Caption   = card.Title;
            Image     = SetImageFromPath(card.ImagePath);
            AudioPath = card.AudioPath;

            _yandexSpeech = yandexSpeech;
            _tempDirPath  = tempDirPath;

            acceptButton.Content = "Изменить";

            _withoutSpace = withoutSpace;

            if (withoutSpace == true)
            {
                panelWithAudioButtons.Visibility   = Visibility.Hidden;
                infoAboutAudioTextBlock.Visibility = Visibility.Visible;
            }

            SetCardType(card.CardType);
        }
Пример #5
0
 public Player(YandexSpeech yandexSpeech)
 {
     _yandexSpeech = yandexSpeech;
 }
 public CardEditorWindow(Settings settings, string tempDirPath, YandexSpeech yandexSpeech, bool withoutSpace) : this(settings, tempDirPath, yandexSpeech, new Card(), withoutSpace)
 {
     acceptButton.Content = "Добавить";
 }
Пример #7
0
        protected override void OnStartup(StartupEventArgs e)
        {
            StaticServer.instance.CheckUpdateAsync();

            var options = new Options();

            Parser.Default.ParseArguments <Options>(e.Args)
            .WithParsed <Options>(o =>
            {
                if (o.IsEditor)
                {
                    _isEditor = o.IsEditor;
                }
                if (o.Path != null)
                {
                    _path = o.Path;
                }
            });


            // Создать директорию для временных файлов
            _tempDirPath = Path.GetTempPath() + "\\linka.looks\\temp\\";
            Directory.CreateDirectory(_tempDirPath);

            // TODO: Заменить на загрузку из конфига
            _yandexSpeech = new YandexSpeech("4e68a4e5-b590-448d-9a66-f3d8f2854348", _tempDirPath);

            // Everything starts with initializing Host, which manages connection to the
            // Tobii Engine and provides all Tobii Core SDK functionality.
            // NOTE: Make sure that Tobii.EyeX.exe is running
            _host = new Host();

            // We need to instantiate InteractorAgent so it could control lifetime of the interactors.
            _agent = _host.InitializeWpfAgent();

            // Загрузка настроек из файла
            var configFile     = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\linka.looks.config.json";
            var settingsLoader = new SettingsLoader();

            if (File.Exists(configFile) == true)
            {
                _settings = settingsLoader.LoadFromFile(configFile);
            }
            else
            {
                // Файла не существует, установим настройки по умолчанию
                _settings = new Settings();

                _settings.ConfigFilePath = configFile;

                _settings.Keys = new Dictionary <string, string>();
                _settings.Keys.Add("Left", "MoveSelectorLeft");
                _settings.Keys.Add("Right", "MoveSelectorRight");
                _settings.Keys.Add("Up", "MoveSelectorUp");
                _settings.Keys.Add("Down", "MoveSelectorDown");
                _settings.Keys.Add("Return", "Enter");
                _settings.Keys.Add("Space", "Enter");

                _settings.IsHasGazeEnabled       = true;
                _settings.IsAnimatedClickEnabled = true;
                _settings.ClickDelay             = 1;
                _settings.IsPlayAudioFromCard    = false;
                _settings.IsPageButtonVisible    = true;
                _settings.IsJoystickEnabled      = true;
                _settings.IsKeyboardEnabled      = true;
                _settings.IsMouseEnabled         = true;

                settingsLoader.SaveToFile(configFile, _settings);
            }

            _settings.SettingsLoader = settingsLoader;
            _settings.TempDirPath    = _tempDirPath;
            _settings.YandexSpeech   = _yandexSpeech;
            _settings.Host           = _host;

            if (_isEditor == true)
            {
                ShowEditorWindow(_path);
            }
            else
            {
                ShowMainWindow(_path);
            }
        }