Exemple #1
0
        private void eseguireRicercaButton_Click(object sender, RoutedEventArgs e)
        {
            // Se è cambiato lo stato del flag di ricerca, lo memorizzo nei last-used
            if (checkBoxCollassaFiltri.IsChecked != Configurazione.LastUsedConfigLumen.collassaFiltriInRicercaGallery)
            {
                Configurazione.LastUsedConfigLumen.collassaFiltriInRicercaGallery = (bool)checkBoxCollassaFiltri.IsChecked;
                try {
                    Configurazione.SalvaLastUsedConfig();
                } catch (Exception) {
                }
            }

            if (checkBoxCollassaFiltri.IsChecked == true)
            {
                expanderFiltriRicerca.IsExpanded = false;
            }
        }
        /// <summary>
        /// Controllo che la geometria della finestra sia posizionabile in un monitor.
        /// </summary>
        private void gestisciPosizione()
        {
            // Per prima cosa, provo a posizionare la finestra nella posizione indicata in configurazione
            // Mi copio in locale la geometria della finestra per poterla modificare con lo spostamento
            geoCurrent = (GeometriaFinestra)Configurazione.UserConfigLumen.geometriaFinestraSlideShow.Clone();


            WpfScreen scrn = WpfScreen.GetScreenFrom(geoCurrent.deviceEnum);

            if (scrn == null)
            {
                scrn = WpfScreen.GetFirstScreen();                  // Prendo quello di default
            }
            // this.WindowStartupLocation = WindowStartupLocation.Manual;

            _giornale.Debug("SlideShow Primary Device Info:\n " + WpfScreen.Primary.ToDebugString());

            _giornale.Debug("SlideShow Configuration Device Info:\n " + scrn.ToDebugString());



            if (geoCurrent.deviceEnum != scrn.deviceEnum)
            {
                _giornale.Debug("Il monitor impostato non è stato trovato!!!");

                geoCurrent.deviceEnum = WpfScreen.Primary.deviceEnum;
            }

            if (!verificaProiettabile(scrn, geoCurrent))
            {
                _giornale.Debug("I valori calcolati non sono ammissibili utilizzo quelli di default");

                this.geoCurrent = Configurazione.creaGeometriaSlideShowDefault();
            }

            //Se ho messo il full screen resetto i Top e Left
            if (geoCurrent.fullScreen)
            {
                Screen s = (Screen)Screen.AllScreens.GetValue(geoCurrent.deviceEnum);
                System.Drawing.Rectangle r = s.WorkingArea;
                geoCurrent.Top  = r.Top;
                geoCurrent.Left = r.Left;
            }
            else if (geoCurrent.screenHeight != (int)scrn.WorkingArea.Height || geoCurrent.screenWidth != (int)scrn.WorkingArea.Width)
            {
                _giornale.Debug("Ricalcolo la geometria dello slideShow in base al nuovo monitor");
                _giornale.Debug("*** VALORI VECCHI ***");
                _giornale.Debug(geoCurrent.ToDebugString());

                geoCurrent.Top  = geoCurrent.Top <= 0 ? 0 : (int)(geoCurrent.Top * scrn.WorkingArea.Height / geoCurrent.screenHeight);
                geoCurrent.Left = geoCurrent.Left <= 0 ? 0 : (int)(geoCurrent.Left * scrn.WorkingArea.Width / geoCurrent.screenWidth);

                geoCurrent.Height = (int)(geoCurrent.Height * scrn.WorkingArea.Height / geoCurrent.screenHeight);
                geoCurrent.Width  = (int)(geoCurrent.Width * scrn.WorkingArea.Width / geoCurrent.screenWidth);

                Screen s = (Screen)Screen.AllScreens.GetValue(geoCurrent.deviceEnum);
                System.Drawing.Rectangle r = s.WorkingArea;

                geoCurrent.screenHeight = (int)scrn.WorkingArea.Height;
                geoCurrent.screenWidth  = (int)scrn.WorkingArea.Width;

                _giornale.Debug("*** VALORI RICALCOLATI ***");
                _giornale.Debug(geoCurrent.ToDebugString());
            }

            GestoreFinestrePubbliche.risposizionaFinestra(this, geoCurrent);

            // Il salvataggio della posizione, lo farei solo su richiesta esplicita dell'utente

            if (salvaNuoviValori)
            {
                _giornale.Debug("Devo salvare i nuovi valori ricalcolati");
                _giornale.Debug("Devo salvare la configurazione utente su file xml");
                UserConfigSerializer.serializeToFile(cfg);
                _giornale.Info("Salvata la configurazione utente su file xml");
            }
        }
Exemple #3
0
        /**
         * Faccio un controllo che tutto sia a posto e che il programma possa partire
         */
        private void avviaConfigurazione(bool autoSistema)
        {
            _configurazione = new Configurazione(autoSistema);

            _servizioFactory = new ServizioFactory();
        }