Example #1
0
        protected override async Task ExecuteAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Storage Worker running at: {time}", DateTimeOffset.Now);

            await foreach (var update in _storageBot.YieldUpdatesAsync())
            {
                if (cancellationToken.IsCancellationRequested)
                {
                    return;
                }
                _logger.LogInformation(update.ToString());
                using (var scope = Services.CreateScope())
                {
                    SQLiteProvider dbProvider = scope.ServiceProvider.GetRequiredService <SQLiteProvider>();
                    using (var handler = _storageBot.CreateInteractionHandler(update, context => { context.StorageItemsProvider = dbProvider; }))
                    {
                        try
                        {
                            await handler.HandleAsync(cancellationToken);
                        }
                        catch (Exception error)
                        {
                            await handler.HandleErrorAsync(error, cancellationToken);
                        }
                    }
                }
            }
        }
        // NOTE: A new EditGestureViewModel is instantiated on every call to EditGesture()
        public EditStaticGestureViewModel(MainViewModel mvm, SGClassWrapper gesture = null, bool newGesture = false)
        {
            _mvm        = mvm;
            _newGesture = newGesture;
            _provider   = _mvm.SQLiteProvider;
            _recorder   = new SGRecorder(this, _mvm);

            _recorder.RecordingSessionFinished += OnRecordingSessionFinished;

            var featureWeightsDict = new Dictionary <string, int>();

            if (newGesture)
            {
                Name               = "New Static Gesture";
                Instances          = new ObservableCollection <SGInstanceWrapper>();
                featureWeightsDict = SGClass.GetDefaultFeatureWeights();
            }
            else
            {
                Name               = gesture.Name;
                Id                 = gesture.Id;
                Instances          = _provider.GetStaticGestureInstances(gesture.Id);
                featureWeightsDict = gesture.Gesture.FeatureWeights;
            }

            setFeatureWeights(featureWeightsDict);

            Changeset = new EditStaticGestureChangeset();
        }
Example #3
0
        public MainViewModel(OpenGL gl, System.Windows.Controls.ScrollViewer scrollViewer, System.Windows.Controls.TextBox outputWindowTextBox,
                             GestureLibrary gestureLibraryControl, EditStaticGesture editStaticGestureControl, EditDynamicGesture editDynamicGestureControl,
                             RecognitionMonitor recognitionMonitorControl, Controller controller)
        {
            _gl                    = gl;
            _controller            = controller;
            _camera                = new Camera(_gl);
            _scrollViewer          = scrollViewer;
            _outputWindowTextBox   = outputWindowTextBox;
            _gestureLibraryControl = gestureLibraryControl;
            _gestureLibraryControl.SetMvm(this);
            _editStaticGestureControl = editStaticGestureControl;
            _editStaticGestureControl.SetMvm(this);
            _editDynamicGestureControl = editDynamicGestureControl;
            _editDynamicGestureControl.SetMvm(this);
            _sqliteProvider = new SQLiteProvider(Constants.SQLiteFileName);
            _config         = new LGR_Configuration(_sqliteProvider);
            _glHelper       = new SharpGLHelper(_gl, _config.BoneColors);

            UpdateStaticGestureLibrary();
            UpdateDynamicGestureLibrary();

            initMenuBar();

            // Needs to be initialized after UpdateGestureLibrary()
            _classifier = new StatisticalClassifier(StaticGestures, DynamicGestures);

            _recognitionMonitorControl    = recognitionMonitorControl;
            _recognitionMonitorControl.VM = new RecognitionMonitorViewModel(_classifier);

            FrameReceived += _recognitionMonitorControl.VM.OnFrameReceived;
        }
Example #4
0
 public ZVendorHelper()
 {
     _importExcel        = new ImportExcel();
     _convertDataZVendor = new ConvertDataZVendor();
     _provider           = new Provider();
     _dungSaiNCCHelper   = new DungSaiNCCHelper();
     _sQLiteProvider     = new SQLiteProvider();
 }
Example #5
0
        public void Prepare()
        {
            var path = @"c:\temp\test.sqlite";

            if (File.Exists(path))
            {
                File.Delete(path);
            }
            provider = new SQLiteProvider(path);
        }
Example #6
0
 public SessionTrackerMain()
 {
     InitializeComponent();
     m_dbProvider = new SQLiteProvider();
     m_dbProvider.Open(Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), DBFileName));
     session.StateChanged       += Session_StateChanged;
     bsource.DataSource          = this.tracks;
     dgvTrackDataView.DataSource = bsource;
     toolStripMenuItem3.Checked  = IsApplicationFromStartup();
     ListDayCounter();
 }
Example #7
0
        public IDBProvider Connection()
        {
            var    sqliteFilename = "mydb.db3";
            string documentsPath  = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal); // Documents folder
            var    path           = Path.Combine(documentsPath, sqliteFilename);

            Console.WriteLine(path);
            if (!File.Exists(path))
            {
                File.Create(path);
            }
            var conn = new SQLiteProvider(path);

            return(conn);
        }
        public EditDynamicGestureViewModel(MainViewModel mvm, DGClassWrapper gesture = null, bool newGesture = false)
        {
            _mvm        = mvm;
            _newGesture = newGesture;
            _provider   = _mvm.SQLiteProvider;
            _recorder   = new DGRecorder(_mvm);

            if (newGesture)
            {
                Name      = "New Dynamic Gesture";
                Instances = new ObservableCollection <DGInstanceWrapper>();
            }
            else
            {
                Name      = gesture.Name;
                Id        = gesture.Id;
                Instances = _provider.GetDynamicGestureInstances(gesture.Id);
            }

            Changeset = new EditDynamicGestureChangeset();
        }
Example #9
0
 public VatTuHelper()
 {
     _sQLiteProvider = new SQLiteProvider();
 }
Example #10
0
 internal DataHelper(SQLiteProvider db)
 {
     dbProvider = db;
 }
Example #11
0
 public DungSaiNCCHelper()
 {
     _sQLiteProvider = new SQLiteProvider();
 }