Beispiel #1
0
 /// <summary>
 /// Force the visualiser to update its value (i.e. display the value that is stored).
 /// </summary>
 public override void Read()
 {
     SynchronisationHandler.SynchroniseUpdate(Registry, Key, CurrentValue, val =>
     {
         CurrentValue = val;
         Text         = CurrentValue.ToString();
     });
 }
Beispiel #2
0
        private async void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            await DatabaseViewModel.Initialise();

            ItemModels            = DatabaseViewModel.ItemViewModels;
            ItemsList.ItemsSource = ItemModels;
            await SynchronisationHandler.PushModifiedItemsToTheCLoud();
        }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (_filePicked != null)
            {
                var item = await SynchronisationHandler.AddTotalyNewFile(_filePicked);

                //DatabaseViewModel.UpdateAllDatabaseEntries();
                DatabaseViewModel.ItemViewModels.Add(item);
                this.Frame.Navigate(typeof(MainItemPage));
            }
        }
 /// <summary>
 /// Force the visualiser to store its value (i.e. write the value that is displayed to the registry).
 /// </summary>
 public override void Write()
 {
     try
     {
         object convertedVal = Converter.ConvertFromString(Text);
         Pending = true;
         SynchronisationHandler.SynchroniseSet(Registry, Key, convertedVal, val => Pending = false, e => Errored = true);
     }
     catch (Exception)
     {
         Errored = true;
     }
 }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (_filePicked == null)
            {
                return;
            }
            var item = await SynchronisationHandler.AddTotalyNewFile(_filePicked);

            //DatabaseViewModel.UpdateAllDatabaseEntries();
            item.Filetype = (Constants.Filetype)TypeBox.SelectionBoxItem;
            DatabaseViewModel.ItemViewModels.Add(item);
            this.Frame.Navigate(typeof(MainItemPage));
        }
        /// <summary>
        /// Force the visualiser to update its value (i.e. display the value that is stored).
        /// </summary>
        public override void Read()
        {
            object obj = SynchronisationHandler.SynchroniseGet <object>(Registry, Key);

            if (Converter == null && obj != null)
            {
                Converter = TypeDescriptor.GetConverter(obj.GetType());
            }

            if (obj != null)
            {
                CurrentValue = obj;
                Text         = obj.ToString();
            }
        }
Beispiel #7
0
        private SigmaEnvironment(string name)
        {
            Name                    = name;
            Registry                = new Registry();
            RegistryResolver        = new RegistryResolver(Registry);
            ParameterisationManager = new ParameterisationManager();
            SynchronisationHandler  = new SynchronisationHandler(this);

            SetRandomSeed((int)(DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond));

            _monitors                 = new HashSet <IMonitor>();
            _globalHooksToAttach      = new ConcurrentQueue <KeyValuePair <IHook, IOperator> >();
            _localHooksToAttach       = new ConcurrentQueue <KeyValuePair <IHook, IOperator> >();
            RunningOperatorsByTrainer = new ConcurrentDictionary <ITrainer, IOperator>();
            _trainersByName           = new ConcurrentDictionary <string, ITrainer>();
            _processQueueEvent        = new ManualResetEvent(true);
        }
Beispiel #8
0
 /// <summary>
 /// Force the visualiser to store its value (i.e. write the value that is displayed to the registry).
 /// </summary>
 public override void Write()
 {
     try
     {
         T convertedValue = (T)Converter.ConvertFromString(Text);
         Pending = true;
         SynchronisationHandler.SynchroniseSet(Registry, Key, convertedValue, val =>
         {
             Pending = false;
             Errored = false;
         }, e => Errored = true);
     }
     catch (Exception)
     {
         Errored = true;
         throw;
     }
 }
Beispiel #9
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            //await OneDriveConnectionHelper.Login();
            SynchronisationHandler.Initialise("FileItems");
            DatabaseHandler.SetupDatabase();
            DatabaseViewModel.Initialise();

            // Ensure the current window is active
            Window.Current.Activate();
        }
Beispiel #10
0
 /// <summary>
 /// Force the visualiser to store its value (i.e. write the value that is displayed to the registry).
 /// </summary>
 public override void Write()
 {
     SynchronisationHandler.SynchroniseSet(Registry, Key, (double)_values[SelectedIndex], val => Pending = false, e => Errored = true);
 }
Beispiel #11
0
 /// <summary>
 /// Force the visualiser to store its value (i.e. write the value that is displayed to the registry).
 /// </summary>
 public override void Write()
 {
     Pending = true;
     SynchronisationHandler.SynchroniseSet(Registry, Key, Object, val => Pending = false, e => Errored = true);
 }
Beispiel #12
0
 /// <summary>
 /// Force the visualiser to update its value (i.e. display the value that is stored).
 /// </summary>
 public override void Read()
 {
     SynchronisationHandler.SynchroniseUpdate(Registry, Key, Object, newObj => Dispatcher.Invoke(() => Object = newObj));
 }
Beispiel #13
0
 /// <summary>
 /// Force the visualiser to update its value (i.e. display the value that is stored).
 /// </summary>
 public override void Read()
 {
     IsChecked = SynchronisationHandler.SynchroniseGet <bool>(Registry, Key);
 }
Beispiel #14
0
 /// <summary>
 /// Force the visualiser to update its value (i.e. display the value that is stored).
 /// </summary>
 public override void Read()
 {
     SynchronisationHandler.SynchroniseUpdate(Registry, Key, Text, newVal => Text = newVal);
 }