Beispiel #1
0
        private void ButtonAdd_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();

            dlg.Filter = "Font files (*.ttf)|*.ttf|All files|*.*";

            // Get the selected file name and display in a TextBox
            if (dlg.ShowDialog() == true)
            {
                // Open document
                string filename   = dlg.FileName;
                string familyname = "";
                foreach (FontFamily family in Fonts.GetFontFamilies(dlg.FileName))
                {
                    Debug.WriteLine(family.FamilyNames.Count + "   " + family);
                    foreach (KeyValuePair <XmlLanguage, string> sfamily in family.FamilyNames)
                    {
                        Debug.WriteLine(sfamily.Value);
                        familyname = sfamily.Value;
                    }
                }
                data.FontManager.Add(new Class.Save.FontPackage(File.ReadAllBytes(dlg.FileName), familyname));
            }

            FontWorker.LoadFonts(data);
            AddFonts();
        }
Beispiel #2
0
        private void DeleteFont_Click(object sender, MouseEventArgs e)
        {
            FontPackage fontp = (FontPackage)((StackPanel)((Control)sender).Tag).Tag;

            data.FontManager.Remove(fontp);

            AddFonts();
            FontWorker.LoadFonts(data);
        }
Beispiel #3
0
        public void OpenFile(string path)
        {
            try
            {
                SaveEditor save = new SaveEditor();
                data = save.LoadWithCompression(path);

                SetWorkingFileLabel(path);

                LoadFileData();
                pathtofile              = path;
                BorderWindowSize.Width  = data.CanvasW + 2;
                BorderWindowSize.Height = data.CanvasH + 2;
                CanvasW = data.CanvasW;
                CanvasH = data.CanvasH;

                FontWorker.LoadFonts(data);

                LoadCanvas();

                IMG_StackCount = Stack_TestList.Children.Count;
                IMG_Work       = false;
                IMG_Current    = 0;

                IMG_dispatcherTimer          = new DispatcherTimer();
                IMG_dispatcherTimer.Tick    += new EventHandler(IMG_dispatcherTimer_Tick);
                IMG_dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10);
                IMG_dispatcherTimer.Start();

                //UpdateCanvasIcon();

                ScrollViewer_TestList.ScrollToHome();

                MainWindow.IsChanged = false;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                MessageBox.Show(Strings.ResStrings.ErrorLoad, Strings.ResStrings.Error, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            if (!File.Exists("Data.gtchp"))
            {
                MessageBox.Show(Good_Teacher.Strings.ResStrings.ErrorRunData, Good_Teacher.Strings.ResStrings.Error);
                Application.Current.Shutdown();
            }
            else
            {
                SaveEditor save = new SaveEditor();
                data = save.LoadWithCompression("Data.gtchp");
                Good_Teacher.MainWindow.pathtofile = AppDomain.CurrentDomain.BaseDirectory + "\\Data.gtchp";

                FontWorker.LoadFonts(data);

                if (data.CacheCanvas)
                {
                    PlayCanvas.CacheMode = new BitmapCache(1);
                }

                Good_Teacher.MainWindow.GoodAnswersCount  = 0;
                Good_Teacher.MainWindow.WrongAnswersCount = 0;

                if (data.OptimizedMode)
                {
                    Good_Teacher.MainWindow.OPTIMIZEDMODE = true;
                }
                else
                {
                    Good_Teacher.MainWindow.OPTIMIZEDMODE = false;
                }

                Border_CanvasSize.Width  = data.CanvasW;
                Border_CanvasSize.Height = data.CanvasH;

                PreviewMouseMove += Window_Presentation_PreviewMouseMove;

                currentC = 0;
                maxC     = data.pages.Count;

                Label_Number.Content = "/" + maxC;
                UpdateNumberLabel();

                LoadCanvas(0);

                dispatcherTimer.Tick     -= DispatcherTimer_Tick;
                dispatcherTimer.Tick     += DispatcherTimer_Tick;
                dispatcherTimer.Interval  = new TimeSpan(0, 0, 0, 1);
                dispatcherTimer.IsEnabled = true;


                Timer_TimersLast = DateTime.Now.Ticks;

                dispatcherTimer_Timers.Tick     -= DispatcherTimer_Timers_Tick;
                dispatcherTimer_Timers.Tick     += DispatcherTimer_Timers_Tick;
                dispatcherTimer_Timers.Interval  = new TimeSpan(0, 0, 0, 0, 100);
                dispatcherTimer_Timers.IsEnabled = true;

                dispatcherTimerTransition.Tick     -= DispatcherTimerTransition_Tick;
                dispatcherTimerTransition.Tick     += DispatcherTimerTransition_Tick;
                dispatcherTimerTransition.Interval  = TimeSpan.FromMilliseconds(data.pages[LoadedPage].TransitionMove);
                dispatcherTimerTransition.IsEnabled = (data.pages[LoadedPage].transitionType != Good_Teacher.Class.Enumerators.TransitionTypeEnum.TransitionType.Manual);


                if (data.BlockPresentationInput)
                {
                    ControlPanelC.Visibility = Visibility.Collapsed;
                }

                if (data.HideInput)
                {
                    SP_InputControls.Visibility = Visibility.Collapsed;
                }


                MainGrid.Background = data.OutsideBrush;


                this.ResizeMode = ResizeMode.NoResize;

                this.WindowStyle = WindowStyle.None;

                this.WindowState = WindowState.Maximized;

                Closing += Window_Presentation_Closing;
                mediaplayer.MediaEnded += Mediaplayer_MediaEnded;

                Activate();

                ContentRendered += MainWindow_ContentRendered;
            }
        }