Esempio n. 1
0
        public static void Main(string[] args)
        {
            Application app = new Application();

            Thread.CurrentThread.CurrentUICulture = new CultureInfo("ru");

            IServiceContainer serviceContainer = new ServiceContainer();
            IEventController  eventController  = new EventController();
            IAppController    appController    = new AppController(serviceContainer, eventController);

            IMessageService messageSvc = new MessageService();
            ILogService     logSvc     = new LogService();

            IImageSupport[] imageTools = new IImageSupport[]
            {
            };

            IImageListSupport[] imageListTools = new IImageListSupport[]
            {
                new HSLFiltering(new SnapshotTuner()),
                new ColorFiltering(new SnapshotTuner()),
                new Resize(new Tuner()),
                new ExternalOverlay(new ExternalOverlayTuner()),
                new Rotation3D(new Rotation3DTuner()),
                new SpeedControl(new SnapshotTuner()),
                new Interpolation(new Tuner()),
                new Convolution(new ConvolutionTuner())
            };

            appController.ServiceContainer
            .Register <IImageEditor, ImageEditor.ImageEditor>()
            .Register <IRepository <IImageList>, RepositoryService <IImageList> >()
            .Register <ISlideshowService, SlideshowService>();

            appController.ServiceContainer
            .RegisterInstance(appController)
            .RegisterInstance(imageTools)
            .RegisterInstance(imageListTools)
            .RegisterInstance(messageSvc)
            .RegisterInstance(logSvc);

            appController.Run <ImageEditorPresenter>();

            app.Run();
        }
Esempio n. 2
0
        private void ToolPanel_Tuning(object sender, EventArgs e)
        {
            IImagePanel imagePanel = View.ImagePanels.SelectedPanel;
            string      imageKey   = View.ImagePanels.SelectedPanelKey;
            object      tool       = ((IToolPanel)sender).SelectedTool;

            ICustomFramesSupport  framesSupport = tool as ICustomFramesSupport;
            ICustomAreaSupport    areaSupport   = tool as ICustomAreaSupport;
            IAsyncApplyingSupport asyncSupport  = tool as IAsyncApplyingSupport;

            if (framesSupport != null)
            {
                framesSupport.CustomFrames = imagePanel.SelectedIcons;
            }

            if (areaSupport != null)
            {
                areaSupport.CustomArea = imagePanel.SelectedArea;
            }

            if (asyncSupport != null)
            {
                asyncSupport.AllowMultipleTasks = false;
                asyncSupport.ApplyAsync         = Settings.Default.UseAsyncMode;
                AppController.EventController.UnsubscribeAll(asyncSupport, nameof(asyncSupport.AsyncApplyingCompleted));
                AppController.EventController.Subscribe(asyncSupport, nameof(asyncSupport.AsyncApplyingCompleted),
                                                        delegate { Repository.OnItemChanged(imageKey); });
            }

            IImageListSupport imageListSupport = tool as IImageListSupport;
            IImageSupport     imageSupport     = tool as IImageSupport;

            try
            {
                if (!Originals.ContainsKey(imageKey))
                {
                    Originals.Add(imageKey, Repository[imageKey].Clone());
                }

                if (imageListSupport != null)
                {
                    imageListSupport.Apply(Originals[imageKey], Repository[imageKey]);

                    if (!Settings.Default.UseAsyncMode)
                    {
                        Repository.OnItemChanged(imageKey);
                    }
                }
                else if (imageSupport != null)
                {
                    int frame = imagePanel.SelectedIcons.ElementAtOrDefault(0);

                    imageSupport.Apply(Originals[imageKey][frame], Repository[imageKey][frame]);

                    if (!Settings.Default.UseAsyncMode)
                    {
                        Repository.OnItemChanged(imageKey);
                    }
                }
                else
                {
                    throw new Exception("Unsupported tool type");
                }
            }
            catch (OutOfMemoryException ex)
            {
                GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
                MessageService.ShowError(ex.Message);
            }
#if !DEBUG
            catch (Exception ex)
            {
                MessageService.ShowError(Resources.ApplyToolError);
                LogService.LogError(ex);
            }
#endif
        }
Esempio n. 3
0
        public AuthenticDocPage(SignalProcess _process, IThreadingCrossPlatform _IThreading, IDevice _currentDevice, IMediaPicker _mediaPicker = null, IImageSupport _imageSupport = null, IFileSupport _fileSupport = null)
        {
            string[] testURls = { "http://www.atmospheric-research.com/websops/Scanned%20Documents/Document%20(37).jpg",
                                  "http://www.bcot1.com/test1.bmp" };
            model          = new AuthenticDocModel(_process, _IThreading, _currentDevice, _mediaPicker, _imageSupport, _fileSupport, testURls);
            BindingContext = model;

            InitializeComponent();

            foreach (var sUrl in testURls)
            {
                URLEntryPicker.Items.Add(sUrl);
            }
            URLEntry.Text      = URLEntryPicker.Items[0];
            URLEntry.TextColor = Color.Black;

            //openGLView.HasRenderLoop = true;
            //openGLView.HeightRequest = 300;
            //openGLView.WidthRequest = 300;
            //openGLView.OnDisplay = r =>
            //{
            //    Random rnd = new Random();
            //    OpenTK.Graphics.ES20.GL.ClearColor((float)rnd.NextDouble(), (float)rnd.NextDouble(), (float)rnd.NextDouble(), 0.7f);
            //    GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            //};
            //testButton.Clicked += (s, a) => { this.openGLView.Display(); };
            //openGLView.OnDisplay = display;
            //testButton.Clicked += clicked;

            //this.m_cancellationToken = new CancellationTokenSource();
            //Timer is Stopped
            //TimerRunning(this.m_cancellationToken.Token);
            //m_rect = new Rectangle(100, 100, 300, 300);

            //GL.Viewport(100, 100, 500, 500);
            //display(m_rect);
            URLEntryPicker.SelectedIndexChanged += (s, a) => { URLEntry.Text = testURls[URLEntryPicker.SelectedIndex]; };
        }
Esempio n. 4
0
        public App(IThreadingCrossPlatform _IThreading, IDevice _currentDevice, SignalProcess _process = null, IMediaPicker _mediaPicker = null, IImageSupport _imageSupport = null, IFileSupport _fileSupport = null)
        {
            var navPage =
                new NavigationPage(
                    new AuthenticDocPage(_process, _IThreading, _currentDevice, _mediaPicker, _imageSupport, _fileSupport)
            {
                Title = "AuthenticDoc"
            })
            {
                BarBackgroundColor = Color.FromHex("547799")
            };

            MainPage = navPage;
        }
Esempio n. 5
-2
        public AuthenticDocModel(SignalProcess _process, IThreadingCrossPlatform _IThreading, IDevice _currentDevice, IMediaPicker _mediaPicker, IImageSupport _imageSupport, IFileSupport _fileSupport, string[] _testURls)
        {
            m_IThreading    = _IThreading;
            m_IFileSupport  = _fileSupport;
            m_IImageSupport = _imageSupport;
            m_testURls      = _testURls;

            SetupMedia(_currentDevice, _mediaPicker);

            buttonCameraName = "Camera";

            //urlEntryText = directory;
            TakePictureFromCameraCommand = new RelayCommand(TakePictureFromCameraRelay, param => this.canExecute);
            LoadImageFromFileCommand     = new RelayCommand(LoadImageFromFileCommandRelay, param => this.canExecute);
            LoadImageFromURLCommand      = new RelayCommand(LoadImageFromURLCommandRelay, param => this.canExecute);
            TestButtonCommand            = new RelayCommand(TestButtonCommandRelay, param => this.canExecute);
            ProcessCommand = new RelayCommand(ProcessCommandRelay, param => this.CanExecuteProcess);
            URLEntryPickerChangedCommand = new RelayCommand(urlEntryPickerChangedCommandRelay, param => this.canExecute);
            updateImageEvent            += new EventHandler <ImageSource>((o, s) => { imageSource = s; });
            imageSource = new UriImageSource
            {
                Uri            = new Uri("https://grandprix20.files.wordpress.com/2012/11/317757_423537204379996_1874288384_n-1.png"),
                CachingEnabled = false
            };
            processImage = new ProcessingImage(_process);
        }