private async Task HandleSelectPhoto(PictureMode mode)
        {
            bool notFound = false;

            MediaFile image = null;

            try
            {
                if (mode == PictureMode.Camera)
                {
                    image = await this.GetImageFromCamera();
                }
                else if (mode == PictureMode.Gallery)
                {
                    image = await this.GetImageFromGallery();
                }
            }
            catch
            {
                notFound = true;
            }

            if (notFound)
            {
                throw new Exception("Image Not Found");
            }

            this.ImageFile = image;
        }
Пример #2
0
 public void ChangePictureMode(PictureMode targetPictureMode)
 {
     if (PictureMode != targetPictureMode)
     {
         PictureMode = targetPictureMode;
     }
 }
Пример #3
0
 public Picture CreatePicture(int width, int height, PictureMode mode)
 {
     if (mode == PictureMode.Hardware)
     {
         return(new PictureGDIPlus(width, height));
     }
     else
     {
         return(new PictureWinRGB(width, height));
     }
 }
Пример #4
0
 public Picture CreatePicture(Stream src, PictureMode mode)
 {
     if (mode == PictureMode.Hardware)
     {
         return(new PictureGDIPlus(src));
     }
     else
     {
         return(new PictureWinRGB(src));
     }
 }
Пример #5
0
        public static Picture CreatePicture(string filename, PictureMode mode = PictureMode.Hardware)
        {
            Picture    res;
            FileStream fs = File.OpenRead(filename);

            try
            {
                res = CreatePicture(fs, mode);
            }
            finally
            {
                fs.Close();
            }
            return(res);
        }
Пример #6
0
        public CPicture(Color canvColor, PictureBox pb, CTwoDFigureFactory factory, PictureMode startMode, CFiguresGroupManager groupManager, string filepath)
        {
            figures             = new List <CTwoDFigure>(loadPicture(filepath));
            points              = new List <Point>();
            figuresGroupManager = groupManager;

            currentColor    = Color.Black;
            BackgroundColor = canvColor;
            currentFigure   = factory;
            pointsAmo       = 0;
            mode            = startMode;

            curPicture = pb;
            buffer     = new Bitmap(curPicture.Width, curPicture.Height);
            gCanvas    = Graphics.FromImage(buffer);

            Redraw(gCanvas);
        }
Пример #7
0
        public frmMain()
        {
            InitializeComponent();

            curBtnX   = 8;
            curBtnY   = 260;
            locationX = 0;
            locationY = 0;
            currentPictureBackgroundColor = STANDART_CANVAS_COLOR;

            figuresBtns    = new List <Button>();
            userInterface  = new CViewer(this);
            projectManager = new CProjectInfo(userInterface);
            figuresLoader  = new CFiguresLoader(userInterface);
            paramsXML      = new CParamsXML();

            figuresLoader.LoadFigures();
            CTwoDFigureFactory.LoadedFactories = figuresLoader.LoadedMethods;
            CTwoDFigure.KnownTypes             = figuresLoader.LoadedTypes;
            figuresGroupManager = new CFiguresGroupManager(userInterface, figuresLoader);

            CTwoDFigureFactory factory = CTwoDFigureFactory.GetFactory(0);

            if (factory != null)
            {
                picture = new CPicture(currentPictureBackgroundColor, PictureBox, factory, PictureMode.pmEdit, figuresGroupManager);
            }

            standartBtnColor = Color.White;
            pressedBtnColor  = Color.Bisque;
            prevMode         = PictureMode.pmEdit;
            this.SetStyle(ControlStyles.ResizeRedraw, true);

            setStandartSettings();
            updateWindowCaption();
        }
Пример #8
0
 private void tsmiNewGroup_Click(object sender, EventArgs e)
 {
     prevMode     = picture.Mode;
     picture.Mode = PictureMode.pmGroup;
 }
Пример #9
0
 public static Picture CreatePicture(int width, int height, PictureMode mode = PictureMode.Hardware)
 {
     return(Driver.CreatePicture(width, height, mode));
 }
Пример #10
0
 public static Picture CreatePicture(Stream source, PictureMode mode = PictureMode.Hardware)
 {
     return(Driver.CreatePicture(source, mode));
 }
Пример #11
0
 // Checking iv renderer is already running, if it's not, linking
 // video object with renderer and starting both
 public void SwitchPicModeToVideo()
 {
     if (pic.IsRunning) return;
     if (pictureMode != PictureMode.Video) pictureMode = PictureMode.Video;
     pic.VideoObject = video;
     video.Start();
     pic.Start();
 }
Пример #12
0
            public void SwitchPicModeToAvatar()
            {
                if (pictureMode != PictureMode.Avatar) pictureMode = PictureMode.Avatar;

                if (pic.IsRunning) pic.Stop();

                SktContact contact;
                contact = skypeRef.GetContact(P_IDENTITY);
                UpdateAvatar(contact);
            }
Пример #13
0
        //public event Action LayoutChangedEvent;

        private CurrentLayoutInfo()
        {
            PictureMode = PictureMode.AverageMode;
            ClassMode   = ClassMode.InteractionMode;
        }