Ejemplo n.º 1
0
 public void ZoomFit()
 {
     if (ImageSource != null)
     {
         ZoomService.ZoomFit(FrameworkElement.ActualWidth, FrameworkElement.ActualHeight, _imageSource.Width, _imageSource.Height);
     }
 }
Ejemplo n.º 2
0
        public ImageViewModel(
            GrabService grabService,
            ZoomService zoomService,
            InspectService inspectService,
            StateStore stateStore,
            CoreConfig coreConfig,
            CancellationToken token)
        {
            StateStore  = stateStore;
            _coreConfig = coreConfig;

            SubResults = new ObservableCollection <SubResultWrapper>();
            BindingOperations.EnableCollectionSynchronization(SubResults, new object());

            grabService.ImageGrabbed += ImageGrabbed;

            ZoomService = zoomService;

            ZoomFitCommand = new DelegateCommand(ZoomFit);
            ZoomInCommand  = new DelegateCommand(ZoomIn);
            ZoomOutCommand = new DelegateCommand(ZoomOut);

            inspectService.Inspected += Inspected;

            _pipeLine = new SinglePipeLine <GrabInfo>(info => DrawImage(info), -1, true);
            _pipeLine.Run(token);
        }
Ejemplo n.º 3
0
        static async Task Main(string[] args)
        {
            string baseDir    = AppDomain.CurrentDomain.BaseDirectory;
            string configPath = AppDomain.CurrentDomain.BaseDirectory + "settings.json";

            if (args.Length > 0)
            {
                configPath = args[0];
            }


            Console.WriteLine("Using settings path: " + configPath);
            if (!File.Exists(configPath))
            {
                Console.WriteLine("Error: Config file cannot be found in the specified path.");
                Console.ReadLine();
                return;
            }

            //setup
            var config = JsonConvert.DeserializeObject <AppSettings>(File.ReadAllText(configPath));

            //check/create logs folder
            if (!Directory.Exists(AppDomain.CurrentDomain.BaseDirectory + Logs.LogFolderName))
            {
                Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + Logs.LogFolderName);
            }

            //services
#if DEBUG
            var logs = Console.Out; //TODO: move to file
#else
            var logs = File.CreateText(baseDir + Logs.LogFolderName + '/' + DateTime.Now.ToString(Logs.LogNameFormat) + Logs.LogFileExtension);
#endif
            var cap   = new AppointmentDBContext(config.CAPDBPath);
            var zoom  = new ZoomService(config.ZoomAPIKey, config.ZoomAPISecret);
            var cache = new MeetingCache(config.CacheFilePath);
            PhoneService.Init(config.TwilioAccountSID, config.TwilioAuthToken);

            //main functionality
            var sync = new MeetingSync(cap, zoom, cache, logs, config);


#if DEBUG
            //test date
            var syncDate = new DateTime(2021, 5, 31);

            //sync appointments
            await sync.SyncAppointments(syncDate, DateTime.MaxValue);
#else
            var syncDate = DateTime.Now.Subtract(DateTime.Now.TimeOfDay);

            //sync appointments
            await sync.SyncAppointments(syncDate, DateTime.MaxValue);
#endif
            //save cache
            cache.RemoveBefore(syncDate.AddDays(-7));
            cache.Dispose();
        }
Ejemplo n.º 4
0
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            var x = Math.Round(ZoomService.GetMaxScale() - (PercentageZoom / 100.0), 2);

            if (SVGControl.Scale != x)
            {
                SVGControl.Scale = x;
                await SVGControlChanged.InvokeAsync(SVGControl);
            }
        }
Ejemplo n.º 5
0
        private static int ListUsers(ListUsersOptions opts)
        {
            var zoomService = new ZoomService(opts.ApiKey, opts.ApiSecret);
            var users       = zoomService.ListUsers().ConfigureAwait(false).GetAwaiter().GetResult();

            foreach (var user in users)
            {
                Console.WriteLine($"Id: {user.Id}; First name: {user.FirstName}; Last name: {user.LastName}; eMail: {user.Email}");
            }
            return(0);
        }
Ejemplo n.º 6
0
        private static int ListParticipants(ListParticipantsOptions opts)
        {
            var zoomService  = new ZoomService(opts.ApiKey, opts.ApiSecret);
            var participants = zoomService.ListParticipants(opts.MeetingId).ConfigureAwait(false).GetAwaiter().GetResult();

            foreach (var participant in participants)
            {
                Console.WriteLine($"Id: {participant.UserId}; UserName: {participant.UserName}");
            }

            return(0);
        }
Ejemplo n.º 7
0
 public MeetingSync(AppointmentDBContext CAP, ZoomService Zoom, MeetingCache Cache, TextWriter Logger, AppSettings config)
 {
     this.log        = Logger;
     this.db         = CAP;
     this.zoom       = Zoom;
     this.cache      = Cache;
     this.employees  = config.Employees;
     this.createdMsg = config.MeetingCreatedMsg;
     this.updatedMsg = config.MeetingUpdateMsg;
     this.deletedMsg = config.MeetingDeletedMsg;
     this.fromPhone  = config.TwilioFromPhone;
 }
Ejemplo n.º 8
0
        IDragHandler IDragDropService.GetDragHandler(System.Windows.Forms.IDataObject data)
        {
            TreeListNode node = GetNode(data);

            if (node != null && !data.GetDataPresent(typeof(DragDataObject)))
            {
                XRControl[]    controls = GetTemplateControlsFromData(node);
                DragDataObject obj      = CreateDragData(controls, ZoomService.GetInstance(DesignerHost));
                data.SetData(typeof(DragDataObject), obj);
                return(new MyControlDragHandler(DesignerHost));
            }
            return(base.GetDragHandler(data));
        }
Ejemplo n.º 9
0
        protected override async void OnStartup(StartupEventArgs e)
        {
            // Create app services
            IApplicationSettings appSettings        = new ApplicationSettings();
            ILogService          logService         = new DebugLogService();
            ICredentialsService  credentialsService = new CredentialsService();

            IZoomService zoomService = new ZoomService(logService);

            // Create and show MainWindow
            var mainWindow    = new MainWindow();
            var mainViewModel = new MainViewModel(zoomService, credentialsService);

            mainWindow.DataContext = mainViewModel;
            mainWindow.ShowDialog();
        }
Ejemplo n.º 10
0
        DragDataObject CreateDragData(XRControl[] controls, ZoomService zoomService)
        {
            controls = controls.OrderBy <XRControl, float>(item => item.BoundsF.X).ToArray <XRControl>();
            XRControl baseControl = controls[0];

            RectangleF[] controlRects = new RectangleF[controls.Length];
            RectangleF   baseRect     = baseControl.BoundsF;

            for (int i = 0; i < controls.Length; i++)
            {
                RectangleF rect = controls[i].BoundsF;
                rect.Offset(-baseRect.X, -baseRect.Y);
                controlRects[i] = zoomService.ToScaledPixels(rect, controls[i].Dpi);
            }
            return(new DragDataObject(controls, baseControl, controlRects, PointF.Empty));
        }
Ejemplo n.º 11
0
 public async Task OnScroll(WheelEventArgs e)
 {
     if (e.DeltaY > 0)
     {
         if (ZoomService.ZoomOut(SVGControl))
         {
             await SVGControlChanged.InvokeAsync(SVGControl);
         }
     }
     else if (e.DeltaY < 0)
     {
         if (ZoomService.ZoomIn(SVGControl))
         {
             await SVGControlChanged.InvokeAsync(SVGControl);
         }
     }
 }
Ejemplo n.º 12
0
        private static int ListMeetings(ListMeetingsOptions opts)
        {
            var zoomService = new ZoomService(opts.ApiKey, opts.ApiSecret);
            var allMeetings = new List <Meeting>();
            var users       = zoomService.ListUsers().ConfigureAwait(false).GetAwaiter().GetResult();

            foreach (var user in users)
            {
                var meetings = zoomService.ListMeetings(user.Id, MeetingState.Scheduled).ConfigureAwait(false).GetAwaiter().GetResult();
                allMeetings.AddRange(meetings);
            }

            foreach (var meeting in allMeetings)
            {
                Console.WriteLine($"Id: {meeting.Id}; Topic: {meeting.Topic}; Host: {meeting.HostId}; Start: {meeting.StartTime}; JoinUrl: {meeting.JoinUrl}");
            }
            return(0);
        }
Ejemplo n.º 13
0
 protected override void OnParametersSet()
 {
     PercentageZoom = ZoomService.GetPercentage(SVGControl.Scale);
     if (Filter == "")
     {
         FilterNodes.Clear();
         foreach (Node node in Nodes)
         {
             FilterNodes.Add(node);
         }
     }
     if (ActiveGraph.Nodes.Count == 1 && FilterNodes.Contains(ActiveGraph.Nodes[0]))
     {
         Counter = FilterNodes.IndexOf(ActiveGraph.Nodes[0]);
     }
     for (int i = FilterNodes.Count - 1; i >= 0; i--)
     {
         if (!Nodes.Contains(FilterNodes[i]))
         {
             FilterNodes.RemoveAt(i);
         }
     }
 }
Ejemplo n.º 14
0
        public async Task Select(MenuEventArgs <MenuItem> e)
        {
            switch (e.Item.Text)
            {
            case "Copy":
                Copy();
                break;

            case "Paste":
                await Paste();

                break;

            case "Left":
            case "Center":
            case "Right":
            case "Top":
            case "Middle":
            case "Bottom":
                NodeService.Align(ActiveGraph.Nodes, e.Item.Text);
                break;

            case "Delete":
                await DeleteActive.InvokeAsync("all");

                break;

            case "Edit":
            case "Nodes":
            case "Edges":
                await ChangeMenu.InvokeAsync(NavChoice.Design);

                break;

            case "All Nodes":
                await Activate("nodes");

                break;

            case "All Edges":
                await Activate("edges");

                break;

            case "Everything":
                await Activate("all");

                break;

            case "Insert Edge":
                await InsertEdge();

                break;

            case "Insert Node":
                NodeService.AddNode(Graph.Nodes, Options.Default, origin[0] * SVGControl.Scale + SVGControl.Xaxis, origin[1] * SVGControl.Scale + SVGControl.Yaxis);
                await GraphChanged.InvokeAsync(Graph);

                break;

            case "Stop Algorithm":
                if (StartAlgorithm.Done)
                {
                    StartAlgorithm.Clear = true;
                }
                else
                {
                    await Reset();
                }
                break;

            case "Zoom In":
                if (ZoomService.ZoomIn(SVGControl))
                {
                    await SVGControlChanged.InvokeAsync(SVGControl);
                }
                break;

            case "Zoom Out":
                if (ZoomService.ZoomOut(SVGControl))
                {
                    await SVGControlChanged.InvokeAsync(SVGControl);
                }
                break;
            }
        }
Ejemplo n.º 15
0
 public void ZoomOut()
 {
     ZoomService.ZoomOut(FrameworkElement.ActualWidth, FrameworkElement.ActualHeight);
 }
Ejemplo n.º 16
0
 public SessionRepository(ILogger <SessionRepository> logger, IOptions <ZoomCredentials> zoomCredentials, ConfiguredMeetings configuredMeetings)
 {
     this.logger             = logger;
     this.configuredMeetings = configuredMeetings;
     zoomService             = new ZoomService(zoomCredentials.Value.ApiKey, zoomCredentials.Value.Secret);
 }
Ejemplo n.º 17
0
 protected override void UpdateSales()
 {
     ZoomService.ZoomTo(ViewModel.GetSalesStores(ViewModel.Period).Select(s => s.Address));
     PieChartDataAdapter.DataSource = ViewModel.GetSales(ViewModel.Period).ToList();
 }