Ejemplo n.º 1
0
        public async void TryActivateProgram(string key)
        {
            ActivateButton.Dispatcher.Invoke(() =>
            {
                ActivateButton.IsEnabled       = false;
                ActivationKeyTextBox.IsEnabled = false;
            });
            if (await ActivationManager.Activate(key))
            {
                ActivateButton.Dispatcher.Invoke(() =>
                {
                    Properties.Settings.Default.Activated     = true;
                    Properties.Settings.Default.ActivationKey = key;
                    Properties.Settings.Default.Save();
                });

                MessageBox.Show("The program activated successfully.", "Success", MessageBoxButton.OK, MessageBoxImage.None);
            }
            else
            {
                MessageBox.Show("The activation key is not valid.", "Activation error", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                ActivateButton.IsEnabled       = true;
                ActivationKeyTextBox.IsEnabled = true;
            }
            RetrieveSettings();
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Activation activation = new Activation();

            this.ActivationCode.Text = activation.GetActivationCode();

            ActivationManager am = ActivationManager.GetInstance();

            this.Key.Text = am.GetKey();

            if (am.ActivationStatus())
            {
                this.lbl_left.Visibility             = Visibility.Collapsed;
                this.Key.IsEnabled                   = false;
                this.RegisterButtonsPanel.Visibility = Visibility.Collapsed;
            }
            else
            {
                int daysleft = 30 - am.CountDays();


                if (daysleft > 0)
                {
                    this.lbl_left.Content = "Unregistered version you have " + daysleft.ToString() + " days left";
                }
                else
                {
                    this.lbl_left.Content = "Please register you have used your 30 days trial period";
                }
            }
        }
Ejemplo n.º 3
0
 public void Dispose()
 {
     lock (_lock)
         if (--_initializedModuleCount == 0)
         {
             ActivationManager.Shutdown();
         }
 }
Ejemplo n.º 4
0
 protected override void OnShown(EventArgs e)
 {
     base.OnShown(e);
     txtMac.Text      = ActivationManager.ReadMacAddress();
     txtLicense.Text  = ActivationManager.activationDataMemory.License;
     txtPenDrive.Text = ActivationManager.activationDataMemory.PenDrive;
     PrepareGrid();
 }
        public void TestWebActivatorPreStartMethodsInDesignerModeGetCalled()
        {
            ActivationManager.RunPreStartMethods(designerMode: true);

            Assert.IsTrue(TestLibrary.MyStartupCode.StartCalled);
            Assert.IsFalse(TestLibrary.MyStartupCode.Start2Called);
            Assert.IsFalse(TestLibrary.MyStartupCode.CallMeAfterAppStartCalled);
        }
        public void TestWebActivatorPostStartMethodsGetCalled()
        {
            ActivationManager.RunPostStartMethods();

            Assert.IsFalse(TestLibrary.MyStartupCode.StartCalled);
            Assert.IsFalse(TestLibrary.MyStartupCode.Start2Called);
            Assert.IsTrue(TestLibrary.MyStartupCode.CallMeAfterAppStartCalled);
        }
Ejemplo n.º 7
0
 public void Init(HttpApplication context)
 {
     lock (_lock)
         if (_initializedModuleCount++ == 0)
         {
             ActivationManager.Run();
         }
 }
Ejemplo n.º 8
0
        public void TestWebActivatorPreStartMethodsGetCalled()
        {
            ActivationManager.RunPreStartMethods();

            Assert.True(MyStartupCode.StartCalled);
            Assert.True(MyStartupCode.Start2Called);
            Assert.False(MyStartupCode.CallMeAfterAppStartCalled);
        }
Ejemplo n.º 9
0
 public void Does_not_deactivate_behaviour_when_authority_is_not_lost()
 {
     ActivationManager.AddComponent(PositionComponentId);
     ActivationManager.ChangeAuthority(PositionComponentId, Authority.Authoritative);
     ActivationManager.EnableSpatialOSBehaviours();
     ActivationManager.DisableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithReader>().enabled,
                   "Behaviour should not be disabled if authority is not lost");
 }
Ejemplo n.º 10
0
        public void DeleteTest()
        {
            List <Activation> activations = ActivationManager.Load();
            Activation        activation  = activations.FirstOrDefault(a => a.ActivationCode == "aaaaa");

            int results = ActivationManager.Delete(activation.Id, true);

            Assert.IsTrue(results > 0);
        }
 public void Does_not_activate_behaviour_when_component_is_not_present()
 {
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled after EnableSpatialOSBehaviours is called" +
                    " because it has no components");
 }
Ejemplo n.º 12
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                logger.Info("logging v2");
                ActivationManager am = new ActivationManager();
                am.PresistActivation();
                // am.IsExipred();
                logger.Info("get capture instance");
                Capture capture = Capture.GetInstance();
                logger.Info("set the device to the wpf");
                capture.SetCaptureDeviceWPFControl(videoElement);

                //folder view
                logger.Info("open the categories");
                StonesView.ViewControl = ViewControl;
                DirectoryManager dm = DirectoryManager.GetInstance();

                string path = dm.GetHomeFolder();

                FolderBrowser fb = FolderBrowser.GetInstance();
                logger.Info("set working folder");
                fb.SetFolderControl(this.FolderBrowserTree);
                fb.AddItemClickEvents();
                fb.Init(path);

                StonesView.StoneInfoDisplayControl = StoneInfo;

                StonesView.InitStonesView();
                logger.Info("Init stone view");
                StonesView.LoadImagesToImageView(path);
                logger.Info("loading images");
                if (SettingsManager.ReadBoolSetting("RunFirstTime"))
                {
                    //TODO add here things to run the first time
                    //Options options = new Options();
                    //options.Owner = this;
                    //options.Show();

                    SettingsManager.WriteBoolSetting("RunFirstTime", false);
                }



                CaptureMovieProcessFlow flow = CaptureMovieProcessFlow.GetInstance();
                flow.TextBlock     = this.MovieFlowTimerText;
                flow.CaptureFacede = capture;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                MessageBox.Show(ex.StackTrace);

                throw;
            }
        }
Ejemplo n.º 13
0
 public void Activates_behaviour_when_authority_is_present()
 {
     ActivationManager.AddComponent(PositionComponentId);
     ActivationManager.ChangeAuthority(PositionComponentId, Authority.Authoritative);
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourWithReader>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called even if authority is gained");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithReader>().enabled,
                   "Behaviour should be enabled after EnableSpatialOSBehaviours is called");
 }
 public void Does_not_deactivate_behaviour_when_authority_is_not_lost()
 {
     ActivationManager.AddComponent(ComponentId);
     ActivationManager.ChangeAuthority(ComponentId, Authority.Authoritative);
     ActivationManager.EnableSpatialOSBehaviours();
     ActivationManager.DisableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TBehaviour>().enabled,
                   "Behaviour should not be disabled if authority is not lost");
     ValidateRequirablesNotNull();
 }
        public void TestWebActivatorAllStartMethodsGetCalled()
        {
            ActivationManager.Run();

            Assert.IsTrue(TestLibrary.MyStartupCode.StartCalled);
            Assert.IsTrue(TestLibrary.MyStartupCode.Start2Called);
            Assert.IsTrue(TestLibrary.MyStartupCode.CallMeAfterAppStartCalled);
            Assert.IsTrue(TestLibrary2.MyOtherStartupCode.StartCalled);
            Assert.IsTrue(TestLibrary2.MyOtherStartupCode.Start2Called);
        }
 public void Activates_behaviour_when_component_is_not_present()
 {
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                   "Behaviour should be enabled after EnableSpatialOSBehaviours is called" +
                   " even if it has no PlayerCreator component");
     AssertRequirablesNotNull();
 }
 public void Does_not_activate_behaviour_when_authority_is_not_present()
 {
     ActivationManager.AddComponent(ComponentId);
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled after EnableSpatialOSBehaviours is called" +
                    " because authority is not present");
 }
Ejemplo n.º 18
0
        private void Window_Closed(object sender, RoutedEventArgs e)
        {
            ActivationManager am = ActivationManager.GetInstance();

            if (am.IsExipred() && !am.ActivationStatus())
            {
                MessageBox.Show("Please register you have used your 30 days trial period\nThe application will now close");
                Application.Current.Shutdown();
            }
        }
 public void Activates_behaviour_when_authority_is_present()
 {
     ActivationManager.AddComponent(ComponentId);
     ActivationManager.ChangeAuthority(ComponentId, Authority.Authoritative);
     Assert.IsFalse(TestGameObject.GetComponent <TBehaviour>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TBehaviour>().enabled,
                   "Behaviour should be enabled after EnableSpatialOSBehaviours is called");
     ValidateRequirablesNotNull();
 }
 public void Activate_behaviour_when_authority_is_not_present()
 {
     ActivationManager.AddComponent(ComponentId);
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                    "Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                   "Behaviour should be enabled after EnableSpatialOSBehaviours is called" +
                   " even if authority is not present");
     AssertRequirablesNotNull();
 }
Ejemplo n.º 21
0
        //private void OpenDocument_ShowObject1(object sender, object e)
        //{
        //    if (e is MetroUserControl)
        //        menuControl.Show(e);
        //    else
        //        userControlHelper.ShowControl(e as Control, true, OpenControlHelper.ControlPosition.Center, this as Control);
        //}

        protected override void OnLoad(EventArgs e)
        {
            var configFound = ActivationManager.Load();

            // Mi connetto al Database
            GlobalInfo.DBaseInfo.dbManager = new SqlManager();
            if (!GlobalInfo.DBaseInfo.dbManager.CreateConnection())
            {
                this.Close();
                return;
            }

            GlobalInfo.globalPref = new PreferencesManager <GlobalPreferences>("", null).ReadPreference();
            if (GlobalInfo.globalPref.ForceLanguage)
            {
                var lang = Enum.GetName(typeof(Languages), GlobalInfo.globalPref.Language).Replace('_', '-');
                System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(lang, false);
            }
            ControlBox = GlobalInfo.globalPref.ShowControlBox;

            metroStyleManager.Style       = GlobalInfo.globalPref.CustmColor;
            StyleManager.Style            = GlobalInfo.globalPref.CustmColor;
            GlobalInfo.StyleManager.Style = GlobalInfo.globalPref.CustmColor;
            metroStyleManager.Update();

            this.StyleManager.Clone(menuControl);
            metroStyleManager.Update();

            // Carico l'attivazione
            if (!configFound)
            {
                if (!ShowRegistrationForm())
                {
                    this.Close();
                }
                return;
            }

            // Faccio la login
            // Controllo se devo saltarla
            using (var login = new loginForm())
            {
                this.StyleManager.Clone(login);
                if (!GlobalInfo.LoginInfo.RememberLastLogin || !login.CheckUser(GlobalInfo.LoginInfo.LastUser, GlobalInfo.LoginInfo.LastPassword))
                {
                    if (login.ShowDialog() != DialogResult.OK)
                    {
                        this.Close();
                        return;
                    }
                }
            }
            base.OnLoad(e);
        }
        public void TestInit()
        {
            ActivationManager.Reset();
            ExecutionLogger.ExecutedOrder           = "";
            MyStartupCode.StartCalled               = false;
            MyStartupCode.Start2Called              = false;
            MyStartupCode.CallMeAfterAppStartCalled = false;
            MyStartupCode.CallMeWhenAppEndsCalled   = false;

            MyOtherStartupCode.StartCalled  = false;
            MyOtherStartupCode.Start2Called = false;
        }
Ejemplo n.º 23
0
 public void Activates_behaviours_only_for_current_worker()
 {
     ActivationManager.AddComponent(PositionComponentId);
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourForOtherWorker>().enabled,
                    "TestBehaviourForOtherWorker should not be enabled after EnableSpatialOSBehaviours is called" +
                    " because it does not match the worker type");
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourForOtherWorkerWithReader>().enabled,
                    "TestBehaviourForOtherWorkerWithReader should not be enabled after EnableSpatialOSBehaviours is called" +
                    " even if it has the components because it does not match the worker type");
     Assert.IsNull(TestGameObject.GetComponent <TestBehaviourForOtherWorkerWithReader>().PositionReader);
 }
Ejemplo n.º 24
0
        public void Activate_behaviour_when_authority_is_not_present()
        {
            ActivationManager.AddComponent(PositionComponentId);
            var testBehaviourWithReader = TestGameObject.GetComponent <TestBehaviourWithReader>();

            Assert.IsFalse(testBehaviourWithReader.enabled,
                           "Behaviour should not be enabled before EnableSpatialOSBehaviours is called even if it has components");
            ActivationManager.EnableSpatialOSBehaviours();
            Assert.IsTrue(testBehaviourWithReader.enabled,
                          "Behaviour should be enabled after EnableSpatialOSBehaviours is called" +
                          " even if authority is not present");
            Assert.IsNotNull(testBehaviourWithReader.PositionReader);
        }
        public void TestSystemMicrosoftAndWebActivatorAssembliesAreIgnored()
        {
            ActivationManager.Run();

            // we're using reflection here to avoid changing the API just for the test
            var assemblies = (List <Assembly>) typeof(ActivationManager)
                             .GetField("_assemblies", BindingFlags.Static | BindingFlags.NonPublic)
                             .GetValue(null);

            Assert.IsFalse(assemblies.Any(a => a.GetName().Name.StartsWith("System")));
            Assert.IsFalse(assemblies.Any(a => a.GetName().Name.StartsWith("Microsoft")));
            Assert.IsFalse(assemblies.Any(a => a.GetName().Name.StartsWith("WebActivator")));
        }
 public void Does_not_deactivate_behaviour_when_authority_is_lost()
 {
     ActivationManager.AddComponent(ComponentId);
     ActivationManager.ChangeAuthority(ComponentId, Authority.Authoritative);
     ActivationManager.EnableSpatialOSBehaviours();
     ActivationManager.ChangeAuthority(ComponentId, Authority.NotAuthoritative);
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                   "Behaviour should not be disabled after DisableSpatialOSBehaviours is called" +
                   " even if authority is lost");
     ActivationManager.DisableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourWithCommandSender>().enabled,
                   "Behaviour should not be disabled after DisableSpatialOSBehaviours is called" +
                   " even if authority is lost");
     AssertRequirablesNotNull();
 }
Ejemplo n.º 27
0
 public void Activate_only_reader_behaviour_when_authority_is_not_present()
 {
     ActivationManager.AddComponent(PositionComponentId);
     Assert.IsFalse(TestGameObject.GetComponent <ReaderBehaviour>().enabled,
                    "Reader Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     Assert.IsFalse(TestGameObject.GetComponent <WriterBehaviour>().enabled,
                    "Writer Behaviour should not be enabled before EnableSpatialOSBehaviours is called");
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <ReaderBehaviour>().enabled,
                   "Reader Behaviour should be enabled after EnableSpatialOSBehaviours is called" +
                   " even if authority is not present");
     Assert.IsFalse(TestGameObject.GetComponent <WriterBehaviour>().enabled,
                    "Writer Behaviour should not be enabled after EnableSpatialOSBehaviours is called" +
                    " because authority is not present");
 }
Ejemplo n.º 28
0
        public void InsertTest()
        {
            List <Question> questions  = QuestionManager.Load();
            Question        ques       = questions.FirstOrDefault(q => q.Text == "What color is #DFFF52");
            Activation      activation = new Activation();

            activation.Id             = Guid.NewGuid();
            activation.QuestionId     = ques.Id;
            activation.StartDate      = DateTime.Now;
            activation.EndDate        = DateTime.Now;
            activation.ActivationCode = "eeeee";
            int results = ActivationManager.Insert(activation, true);

            Assert.IsTrue(results > 0);
        }
Ejemplo n.º 29
0
        private bool SaveSerial()
        {
            ActivationManager.Clear();
            ActivationManager.License  = txtLicense.Text;
            ActivationManager.PenDrive = txtPenDrive.Text;

            serialTable.Rows.Cast <DataRow>().ToList().ForEach(row =>
            {
                var module      = ActivationManager.Module(row.GetValue <string>(EF_Serial.Code));
                module.SerialNo = row.GetValue <string>(EF_Serial.Serial);
                module.State    = row.GetValue <ActivationState>(EF_Serial.Active);
                module.Enabled  = row.GetValue <bool>(EF_Serial.Enable);
            });

            return(ActivationManager.Save());
        }
Ejemplo n.º 30
0
 public void Does_not_alter_component_dependent_activation()
 {
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourForCurrentWorker>().enabled,
                   "TestBehaviourForCurrentWorker should be enabled after EnableSpatialOSBehaviours is called" +
                   " because it matches the worker type");
     Assert.IsFalse(TestGameObject.GetComponent <TestBehaviourForCurrentWorkerWithReader>().enabled,
                    "TestBehaviourForCurrentWorkerWithReader should not be enabled after EnableSpatialOSBehaviours is called" +
                    " even if it matches the worker type because it has no components");
     Assert.IsNull(TestGameObject.GetComponent <TestBehaviourForCurrentWorkerWithReader>().PositionReader);
     ActivationManager.AddComponent(PositionComponentId);
     ActivationManager.EnableSpatialOSBehaviours();
     Assert.IsTrue(TestGameObject.GetComponent <TestBehaviourForCurrentWorkerWithReader>().enabled,
                   "TestBehaviourForCurrentWorkerWithReader should be enabled after EnableSpatialOSBehaviours is called" +
                   " because it has the right components");
     Assert.IsNotNull(TestGameObject.GetComponent <TestBehaviourForCurrentWorkerWithReader>().PositionReader);
 }
Ejemplo n.º 31
0
		static void InitializeDefault()
		{
			

#if(NETMF)
            var typeDiscoverer = new TypeDiscoverer();
            var typeSystem = new TypeSystem();
#else
			var assemblyLocator = new AssemblyLocator();
			var typeDiscoverer = new TypeDiscoverer(assemblyLocator);
            var typeSystem = new TypeSystem(typeDiscoverer);
#endif


            _current = new Container(typeSystem);

			var bindingManager = new BindingManager(typeSystem);
			var strategyActivator = new StrategyActivator(_current);
			var activationManager = new ActivationManager(typeDiscoverer, strategyActivator);
			var bindingDiscoverer = new BindingDiscoverer(_current, activationManager, typeSystem, typeDiscoverer);

			_current.Initialize(bindingManager, bindingDiscoverer, activationManager);
		}