コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();

            Library.FFmpegDirectory = Environment.CurrentDirectory;
            RestoreWindowHandler.Activate(this, RestoreWindowSettings.GetDefault());

            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += Timer_Tick;
            timer.Start();
        }
コード例 #2
0
        public MainWindow()
        {
            InitializeComponent();

            RestoreWindowHandler.Activate(this, RestoreWindowSettings.GetDefault());

            viewModel = (ViewModel)DataContext;
            viewModel.BackgroundColor = Background is SolidColorBrush brush ? brush.Color : Colors.White;
            viewModel.ViewControls    = false;

            viewModel.Sources = Environment.GetCommandLineArgs().Skip(1).ToArray();
        }
コード例 #3
0
        public MainWindow()
        {
            allPlaylists = new ObservableCollection <IPlaylist>();

            InitializeComponent();

            RestoreWindowHandler.Activate(this, RestoreWindowSettings.GetDefault());

            serviceBuilder = new ServiceBuilder(new ServiceBuilderHelper());
            hotKeysBuilder = new HotKeysBuilder();

            DataContext = viewModel = new ViewModel();

            DependencyPropertyDescriptor dpd = DependencyPropertyDescriptor
                                               .FromProperty(ItemsControl.ItemsSourceProperty, typeof(ListBox));

            dpd.AddValueChanged(lbxSongs, OnItemsSourceChanged);

            SystemEvents.PowerModeChanged += OnPowerChange;
        }
コード例 #4
0
        public MainWindow()
        {
            InitializeComponent();

            RestoreWindowSettings restoreSettings = RestoreWindowSettings.GetDefault(triggerType: StorePropertiesTriggerType.Manuel);

            restoreHandler = RestoreWindowHandler.Activate(this, restoreSettings);

            Option showOpt   = new Option("h", "hide", "Do hide window on startup.", false, 0);
            Option sourceOpt = new Option("s", "source", "The application sources.", true, -1, 1);
            Option keyOpt    = new Option("k", "searchKey", "SearchKey set on startup", false, 1, 1);
            Option hkOpt     = new Option("hk", "hotKey", "HotKey the show window", true, -1, 1);

            OptionParseResult result = new Options(showOpt, sourceOpt, keyOpt, hkOpt)
                                       .Parse(Environment.GetCommandLineArgs().Skip(1));

            string       searchKey = string.Empty;
            OptionParsed p;

            if (result.TryGetFirstValidOptionParseds(showOpt, out p))
            {
                hideOnStartup = true;
            }
            if (result.TryGetFirstValidOptionParseds(keyOpt, out p))
            {
                searchKey = p.Values[0];
            }

            sources    = result.GetValidOptionParseds(sourceOpt).SelectMany(o => o.Values).ToArray();
            showHotKey = GetHotKey(result.GetValidOptionParseds(hkOpt).First().Values);

            DataContext = viewModel = new ViewModel()
            {
                SearchKey = searchKey
            };

            showHotKey.Pressed += ShowHotKey_PressedAsync;

            UpdateAllApps();
        }