Exemplo n.º 1
0
        public MainWindow()
        {
            information = new InformationProp();
            //Load Interface
            mwh = new MainWindowhelper();
            mwh.SetWindow(this);
            InitializeComponent();
            HideStartContent();
            text_on_image = new List <LabelHelper>();

            //Initialize Scroller
            cnt_scrollviewer.ScrollChanged             += Oncnt_scrollviewerScrollChanged;
            cnt_scrollviewer.MouseLeftButtonUp         += OnMouseRightButtonUp;
            cnt_scrollviewer.PreviewMouseRightButtonUp += OnMouseRightButtonUp;
            cnt_scrollviewer.PreviewMouseWheel         += OnPreviewMouseWheel;

            cnt_scrollviewer.PreviewMouseRightButtonDown += OnMouseRightButtonDown;
            cnt_scrollviewer.MouseMove += OnMouseMove;

            //Initialize Label Creator
            cnt_image.PreviewMouseLeftButtonDown += ImageLeftMosueButtonDown;
            cnt_image.PreviewMouseLeftButtonUp   += ImageLeftMosueButtonUp;
            cnt_image.MouseLeftButtonUp          += ImageLeftMosueButtonUp;

            cnt_grd_parent.PreviewMouseMove += Label_OnPreviewMouseMove;

            cnt_slider.ValueChanged += OnSliderValueChanged;

            //Initialize Notification Manager
            notificationManager = new NotificationManager();

            //Get all available fonts
            GetFonts();
            StartAnimationofFadeText();
        }
Exemplo n.º 2
0
        private void hed_main_btn_load_click(object sender, RoutedEventArgs e)
        {
            Reset();
            information = mwh.LoadFile();
            BitmapImage image = mwh.GetImage(information.ImageUri);

            currentBitmap          = BitmapImage2Bitmap(image);
            ft_tb_currentpath.Text = image.UriSource.ToString();
            cnt_image.Height       = image.Height;
            cnt_image.Width        = image.Width;
            cnt_image.Source       = image;
            information.ImageUri   = image.UriSource.ToString();
            currentSave            = image.UriSource.LocalPath.ToString();
            foreach (Text item in information.Texts)
            {
                LabelHelper lbl = new LabelHelper();
                lbl.label.Name       = item.Name;
                lbl.label.Content    = item.Content;
                lbl.label.Margin     = new Thickness(item.Margin.Left, item.Margin.Top, item.Margin.Left, item.Margin.Top);
                lbl.label.Foreground = Brushes.Black;
                lbl.label.FontSize   = item.FontSize;
                System.Windows.Media.FontFamily font = new System.Windows.Media.FontFamily(item.Font);
                lbl.label.FontFamily = font;

                lbl.label.PreviewMouseDown += Label_OnPreviewMouseDown;
                lbl.label.PreviewMouseMove += Label_OnPreviewMouseMove;
                lbl.label.PreviewMouseUp   += Label_OnPreviewMouseUp;
                lbl.label.MouseEnter       += Label_OnMouseHoverEnter;
                lbl.label.MouseLeave       += Label_OnMouseHoverLeave;
                lbl.label.KeyUp            += Label_OnKeyUp;
                cnt_labels.Children.Add(lbl.label);
                text_on_image.Add(lbl);
            }
            ShowHiddenStartContent();
        }
Exemplo n.º 3
0
        public InformationProp LoadFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "SCOLL files (*.leet)|*.leet|All files (*.*)|*.*";
            if (openFileDialog.ShowDialog() == true)
            {
                Uri fileUri = new Uri(openFileDialog.FileName);
                try
                {
                    IFormatter      formatter = new BinaryFormatter();
                    Stream          stream    = new FileStream(openFileDialog.FileName, FileMode.Open, FileAccess.Read);
                    InformationProp objnew    = (InformationProp)formatter.Deserialize(stream);
                    return(objnew);
                }
                catch (System.NotSupportedException ex)
                {
                    errorHandler.ShowNotification(Notifications.Wpf.NotificationType.Error, "Unsopported Filetype", "Couldn't load the file. Filetype is not supported by this program.");
                }
            }
            return(null);
        }