Beispiel #1
0
        protected override void OnInitialize()
        {
            base.OnInitialize();

            BaseWindowTitle = "Hromadné generování PDF dokumentů";

            CanGenerate = false;

            _years  = Date.GetYears(2010, "DESC");
            _months = new List <string>(Date.Months);
            _months.Reverse();
            _months.Insert(0, "Celý rok");

            if (SelectedYear == 0)   // month can be 0 -> displays entire year
            {
                SetDefaultPeriod(DateTime.Today.Year, DateTime.Today.Month);
            }

            _defaultSettings = _settingFacade.GetDefaultSettings();

            PdfGenerationSettingsViewModel = GetViewModel <PdfGenerationSettingsViewModel>();
            PdfGenerationSettingsViewModel.OnSettingsPropertyChanged += (s, arg) => {
                ResetSettingsCommand.RaiseCanExecuteChanged();
            };
        }
Beispiel #2
0
        public SettingView GetAllSetting()
        {
            InfoSettings    infoSettings    = new InfoSettings();
            DefaultSettings generalSettings = new DefaultSettings();
            MailSettings    mailSettings    = new MailSettings();
            OtherSettings   otherSettings   = new OtherSettings();

            infoSettings    = GetInfoSettings();
            generalSettings = GetDefaultSettings();
            mailSettings    = GetMailSettings();
            otherSettings   = GetOthersSettings();
            var settingView = new SettingView();

            settingView.InfoSettingView = new InfoSettingView();
            var config = new MapperConfiguration(cfg => cfg.CreateMap <InfoSettings, InfoSettingView>());
            var mapper = config.CreateMapper();

            settingView.InfoSettingView = mapper.Map <InfoSettingView>(infoSettings);

            settingView.SystemSettingView = new SystemSettingView();
            config = new MapperConfiguration(cfg => cfg.CreateMap <DefaultSettings, SystemSettingView>());
            mapper = config.CreateMapper();
            settingView.SystemSettingView = mapper.Map <SystemSettingView>(generalSettings);

            settingView.MailSettingView = new MailSettingView();
            config = new MapperConfiguration(cfg => cfg.CreateMap <MailSettings, MailSettingView>());
            mapper = config.CreateMapper();
            settingView.MailSettingView = mapper.Map <MailSettingView>(mailSettings);

            settingView.OthersSettingView = new OthersSettingView();
            config = new MapperConfiguration(cfg => cfg.CreateMap <OtherSettings, OthersSettingView>());
            mapper = config.CreateMapper();
            settingView.OthersSettingView = mapper.Map <OthersSettingView>(otherSettings);
            return(settingView);
        }
        public async void LoadData()
        {
            IsBusy = true;

            var enquiryStatuses = await _adminDataUnit.EnquiryStatusesRepository.GetAllAsync();

            EnquiryStatuses = new ObservableCollection <EnquiryStatus>(enquiryStatuses.OrderBy(x => x.Status));

            var users = await _adminDataUnit.UsersRepository.GetUsersAsync();

            Users = new ObservableCollection <User>(users.OrderBy(x => x.FirstName));

            // Load default settigns
            _adminDataUnit.DefaultSettingsForEnquiriesRepository.Refresh();
            var settings = await _adminDataUnit.DefaultSettingsForEnquiriesRepository.GetAllAsync();

            DefaultSettings = settings.ToList();
            DefaultSetting  = DefaultSettings.FirstOrDefault() ?? new DefaultSettingsForEnquiry()
            {
                ID = Guid.NewGuid()
            };

            User          = DefaultSetting.User;
            EnquiryStatus = DefaultSetting.EnquiryStatus;
            DefaultSetting.PropertyChanged += OnPropertyChanged;

            _isDataLoadedOnce = true;

            IsBusy = false;
        }
        private void OpenFileInExternalEditor(GitSettingsFile fileType)
        {
            var fileName        = string.Empty;
            var defaultContents = string.Empty;

            switch (fileType)
            {
            case GitSettingsFile.Ignore:
                fileName        = ".gitignore";
                defaultContents = DefaultSettings.GitIgnoreText();
                break;

            case GitSettingsFile.Attributes:
                fileName        = ".gitattributes";
                defaultContents = DefaultSettings.GitAttributesText();
                break;
            }

            var repo     = Provider.CurrentRepository;
            var filePath = Path.Combine(repo.LocalLocation, fileName);

            if (!File.Exists(filePath))
            {
                File.WriteAllText(filePath, defaultContents);
            }

            Process.Start(filePath);
        }
        private void SetBackgroundImage()
        {
            switch (settings.MarsBackground)
            {
            case 0:
                BackgroundImage = "resource://XF40Demo.Resources.Mars.PIA22226-2250.webp";
                break;

            case 1:
                BackgroundImage = "resource://XF40Demo.Resources.Mars.PIA22871-1440.webp";
                break;

            case 2:
                BackgroundImage = "resource://XF40Demo.Resources.Mars.PIA23249-1440.webp";
                break;

            case 3:
                BackgroundImage = "resource://XF40Demo.Resources.Mars.PIA22736-1440.webp";
                break;

            default:
                BackgroundImage = string.Empty;
                break;
            }
            if (settings.MarsBackground > 2)
            {
                settings.MarsBackground = DefaultSettings.MarsBackground();
            }
            else
            {
                settings.MarsBackground++;
            }
        }
        public async Task <BoolMessage> UpdateDefaultCommisions(DefaultSettings settings)
        {
            try
            {
                using (var ctx = new EntityContext())
                {
                    var record = ctx.DefaultCommisions.Find(settings.RecordId);
                    record.Country     = ctx.Country.Find(settings.CountryId);
                    record.Currency    = ctx.Currency.Find(settings.CurrencyId);
                    record.PaymentType = ctx.PaymentTypes.Find(settings.PaymentType);
                    record.DefaultCommisionPercentage = 2.0F;
                    record.MaxCommissionEachPayment   = 20.0F;
                    record.MaxPaymentVolume           = 0;
                    record.MinCommissionEachPayment   = 0.5F;
                    record.MinimumPaymentVolume       = 1;
                    record.LastUpdatedBy   = 1;
                    record.LastUpdatedDate = _dateProvider.GetCurrentDateTime();

                    await ctx.SaveChangesAsync();
                }
                return(new BoolMessage {
                    Success = true, Message = "success Updated"
                });
            }
            catch (Exception e)
            {
                return(new BoolMessage {
                    Success = false, Message = "fail " + e.ToString()
                });
            }
        }
Beispiel #7
0
 public Server(ILogger <Server> logger, SharedLibraryCore.Interfaces.ILogger deprecatedLogger,
               ServerConfiguration config, IManager mgr, IRConConnectionFactory rconConnectionFactory,
               IGameLogReaderFactory gameLogReaderFactory, IServiceProvider serviceProvider)
 {
     Password                  = config.Password;
     IP                        = config.IPAddress;
     Port                      = config.Port;
     Manager                   = mgr;
     Logger                    = deprecatedLogger;
     ServerConfig              = config;
     EventProcessing           = new SemaphoreSlim(1, 1);
     Clients                   = new List <EFClient>(new EFClient[64]);
     Reports                   = new List <Report>();
     ClientHistory             = new Queue <PlayerHistory>();
     ChatHistory               = new List <ChatInfo>();
     NextMessage               = 0;
     CustomSayEnabled          = Manager.GetApplicationSettings().Configuration().EnableCustomSayName;
     CustomSayName             = Manager.GetApplicationSettings().Configuration().CustomSayName;
     this.gameLogReaderFactory = gameLogReaderFactory;
     RConConnectionFactory     = rconConnectionFactory;
     ServerLogger              = logger;
     DefaultSettings           = serviceProvider.GetRequiredService <DefaultSettings>();
     InitializeTokens();
     InitializeAutoMessages();
 }
Beispiel #8
0
        public void Reset()
        {
            ISettings settings = new DefaultSettings {
                AttachToBrowserTimeOut = 111
            };

            var autoCloseDialogs = !settings.AutoCloseDialogs;

            settings.AutoCloseDialogs = autoCloseDialogs;
            settings.HighLightColor   = "strange color";
            var highLightElement = !settings.HighLightElement;

            settings.HighLightElement       = highLightElement;
            settings.WaitForCompleteTimeOut = 222;
            settings.WaitUntilExistsTimeOut = 333;
            settings.SleepTime = 444;

            var settingsClone = settings.Clone();

            Assert.AreEqual(111, settingsClone.AttachToBrowserTimeOut, "Unexpected AttachToBrowserTimeOut");
            Assert.AreEqual(autoCloseDialogs, settingsClone.AutoCloseDialogs, "Unexpected AutoCloseDialogs");
            Assert.AreEqual("strange color", settingsClone.HighLightColor, "Unexpected HighLightColor");
            Assert.AreEqual(highLightElement, settingsClone.HighLightElement, "Unexpected HighLightElement");
            Assert.AreEqual(222, settingsClone.WaitForCompleteTimeOut, "Unexpected WaitForCompleteTimeOut");
            Assert.AreEqual(333, settingsClone.WaitUntilExistsTimeOut, "Unexpected WaitUntilExistsTimeOut");
            Assert.AreEqual(444, settingsClone.SleepTime, "Unexpected SleepTime");

            settingsClone.Reset();
            AssertDefaults(settingsClone);
        }
Beispiel #9
0
        /// <summary>
        /// Sets defaults to known good values based on the known DefaultSettings enum.
        /// </summary>
        public void SetDefaults(DefaultSettings settings)
        {
            AllowAmbiguities    = false;
            OutputSequenceCount = 1000;
            switch (settings)
            {
            case DefaultSettings.PyroSequencing:
                DepthOfCoverage  = 35;
                SequenceLength   = 150;
                LengthVariation  = 50;
                ErrorFrequency   = 0.03f;
                DistributionType = (int)Distribution.Normal;
                ReverseHalf      = false;
                break;

            case DefaultSettings.SangerDideoxy:
                DepthOfCoverage  = 10;
                SequenceLength   = 750;
                LengthVariation  = 250;
                ErrorFrequency   = 0.00001f;
                DistributionType = (int)Distribution.Normal;
                ReverseHalf      = false;
                break;

            case DefaultSettings.ShortRead:
                DepthOfCoverage  = 100;
                SequenceLength   = 37;
                LengthVariation  = 12;
                ErrorFrequency   = 0.0103f;
                DistributionType = (int)Distribution.Uniform;
                ReverseHalf      = false;
                break;
            }
        }
Beispiel #10
0
 public ClientStatisticsController(IManager manager,
                                   IResourceQueryHelper <StatsInfoRequest, AdvancedStatsInfo> queryHelper,
                                   IConfigurationHandler <DefaultSettings> configurationHandler) : base(manager)
 {
     _queryHelper   = queryHelper;
     _defaultConfig = configurationHandler.Configuration();
 }
Beispiel #11
0
 public form_FileSelection(UIApplication uiapp)
 {
     m_app            = uiapp;
     settings         = new DefaultSettings(m_app);
     dbInfoDictionary = settings.DBInfoDictionary;
     InitializeComponent();
 }
Beispiel #12
0
        static void Main()
        {
            var userInterface = new EmptyUserInterface {Flow = ExecutionFlow.BreakExecution};
            var settings = new DefaultSettings {HandleProcessCorruptedStateExceptions = true, UserInterface = userInterface};
            settings.Sender = new LocalSender();
            //Adding screenshot plugin
            settings.Plugins.Add(new ScreenShotWriter());
            var reporter = new ErrorReporter(settings);
            reporter.HandleExceptions = true;

            // Sample NCrash configuration for console applications
            AppDomain.CurrentDomain.UnhandledException += reporter.UnhandledException;
            TaskScheduler.UnobservedTaskException += reporter.UnobservedTaskException;

            Console.WriteLine("Press E for current thread exception, T for task exception, X for exit");
            ConsoleKey key;
            do
            {
                key = Console.ReadKey().Key;
                Console.WriteLine();
                if (key == ConsoleKey.E)
                {
                    Console.WriteLine("Throwing exception in current thread");
                    throw new Exception("Test exception in main thread");
                }
                if (key == ConsoleKey.T)
                {
                    Console.WriteLine("Throwing exception in task thread");
                    var task = new Task(MakeExceptionInTask);
                    task.Start();
                    task.Wait();
                }
            } while (key != ConsoleKey.X);
        }
Beispiel #13
0
        public void Reset()
        {
            _defaultSetting = _settingFacade.GetDefaultSettings();

            PdfSetting = CreateNewPdfSetting(_defaultSetting.Pdfsetting);

            if (_workedTimeViewModel == null)
            {
                _workedTimeViewModel = new WorkedTimeSettingViewModel(_defaultSetting.Time, _defaultSetting.Time, _defaultSetting.TimeTickInMinutes);
                _workedTimeViewModel.OnTimeChanged += (object sender, WorkedTimeEventArgs args) =>
                {
                    CancelChangesCommand.RaiseCanExecuteChanged();
                    SaveSettingsCommand.RaiseCanExecuteChanged();
                };
                _workedTimeViewModel.OnTimeTickChanged += (object sender, EventArgs args) =>
                {
                    CancelChangesCommand.RaiseCanExecuteChanged();
                    SaveSettingsCommand.RaiseCanExecuteChanged();
                };
            }
            _workedTimeViewModel.SetTime(_defaultSetting.Time);
            _workedTimeViewModel.SelectedTimeTickInMinutes = _defaultSetting.TimeTickInMinutes;

            ImportDataResultMessage = null;
        }
 public async Task <BoolMessage> SetDefaultCommisions(DefaultSettings settings)
 {
     try
     {
         using (var ctx = new EntityContext())
         {
             var newCommission = new DefaultCommisions
             {
                 Country     = ctx.Country.Find(settings.CountryId),
                 Currency    = ctx.Currency.Find(settings.CurrencyId),
                 PaymentType = ctx.PaymentTypes.Find(settings.PaymentType),
                 DefaultCommisionPercentage = 2.0F,
                 MaxCommissionEachPayment   = 20.0F,
                 MaxPaymentVolume           = 0,
                 MinCommissionEachPayment   = 0.5F,
                 MinimumPaymentVolume       = 1,
                 LastUpdatedBy   = 1,
                 LastUpdatedDate = _dateProvider.GetCurrentDateTime(),
             };
             ctx.DefaultCommisions.Add(newCommission);
             await ctx.SaveChangesAsync();
         }
         return(new BoolMessage {
             Success = true, Message = "success bitch"
         });
     }
     catch (Exception e)
     {
         return(new BoolMessage {
             Success = false, Message = "fail " + e.ToString()
         });
     }
 }
Beispiel #15
0
        protected override void OnActivate()
        {
            base.OnActivate();

            _defaultSettings = _settingFacade.GetDefaultSettings();
            ResetSettings();
        }
Beispiel #16
0
        public static async Task CreateDatabase()
        {
            try
            {
                var client     = new MongoClient("mongodb://127.0.0.1:27017/");
                var database   = client.GetDatabase("_YoneDefault");
                var collection = database.GetCollection <DefaultSettings>("DefaultSettings");
                await collection.Indexes.CreateOneAsync(Builders <DefaultSettings> .IndexKeys.Ascending(_ => _.Id));

                var settings = new DefaultSettings
                {
                    botToken          = "nothing",
                    ipHub             = "nothing",
                    discordBotOrg     = "nothing",
                    kitsuClientId     = "nothing",
                    kitsuClientSecret = "nothing",
                    twitchClientId    = "nothing",
                    FirstRun          = true
                };
                await collection.InsertManyAsync(new[] { settings });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
            public PlanetSettings(CelestialBody body)
                : this()
            {
                GeeASL     = body.GeeASL;
                ocean      = body.ocean;
                atmosphere = body.atmosphere;
                atmosphereContainsOxygen       = body.atmosphereContainsOxygen;
                atmosphereDepth                = body.atmosphereDepth;
                atmosphereTemperatureSeaLevel  = body.atmosphereTemperatureSeaLevel;
                atmosphereTemperatureLapseRate = body.atmosphereTemperatureLapseRate;
                atmospherePressureSeaLevel     = body.atmospherePressureSeaLevel;
                atmDensityASL = body.atmDensityASL;
                atmosphereGasMassLapseRate             = body.atmosphereGasMassLapseRate;
                atmosphereMolarMass                    = body.atmosphereMolarMass;
                atmosphereAdiabaticIndex               = body.atmosphereAdiabaticIndex;
                radiusAtmoFactor                       = body.radiusAtmoFactor;
                atmosphereUsePressureCurve             = body.atmosphereUsePressureCurve;
                atmospherePressureCurveIsNormalized    = body.atmospherePressureCurveIsNormalized;
                atmospherePressureCurve                = body.atmospherePressureCurve;
                atmosphereUseTemperatureCurve          = body.atmosphereUseTemperatureCurve;
                atmosphereTemperatureCurveIsNormalized = body.atmosphereTemperatureCurveIsNormalized;
                atmosphereTemperatureCurve             = body.atmosphereTemperatureCurve;
                atmosphereTemperatureSunMultCurve      = body.atmosphereTemperatureSunMultCurve;
                rotates         = body.rotates;
                rotationPeriod  = body.rotationPeriod;
                initialRotation = body.initialRotation;
                tidallyLocked   = body.tidallyLocked;
                orbit           = body.orbitDriver?.orbit.Clone();

                if (DefaultSettings.ContainsKey(body.bodyName) == false)
                {
                    DefaultSettings.Add(body.bodyName, this);
                }
            }
Beispiel #18
0
        private static void Configure(ContainerBuilder containerBuilder)
        {
            containerBuilder.RegisterType <ClientOptionsService>().As <IClientOptionsService>();
            containerBuilder.RegisterType <GzipCompressionService>().As <ICompressionService>();

            // swap these definitions if you want use simple process instead of parallel
            containerBuilder.RegisterType <ParallelCompressionOrchestrationService>().As <ICompressionOrchestrationService>();
            //containerBuilder.RegisterType<SimpleCompressionOrchestrationService>().As<ICompressionOrchestrationService>();

            containerBuilder.RegisterType <DestinationStreamWriter>().As <IDestinationWriter>();
            containerBuilder.RegisterType <StreamToQueueReader>().As <ISourceReader>();
            containerBuilder.RegisterType <ParallelCompressionService>().As <IParallelCompressionService>();
            containerBuilder.RegisterType <ConsoleStatusUpdateService>().As <IStatusUpdateService>();
            containerBuilder.RegisterType <OutcomeService>().As <IOutcomeService>();
            containerBuilder.RegisterType <FileService>().As <IFileService>();
            containerBuilder.RegisterType <FileSourceService>().As <ISourceStreamService>();
            containerBuilder.RegisterType <StreamUtilsService>().As <IStreamUtilsService>();
            containerBuilder.RegisterType <FileDestinationService>().As <IDestinationStreamService>();
            containerBuilder.RegisterType <ThreadService>().As <IThreadService>();

            var settings = new DefaultSettings();

            containerBuilder.RegisterInstance(settings).As <IInputOverflowControlSettings>();
            containerBuilder.RegisterInstance(settings).As <IOutputOverflowControlSettings>();
            containerBuilder.RegisterInstance(settings).As <ICompressionSettings>();
        }
Beispiel #19
0
        public override async void MapViewTapped(MapView mapView, MapViewInputEventArgs e, bool drawing)
        {
            if (drawing)
            {
                DeleteGraphic(DRAFT);
            }

            ClearHilight();

            var graphic = await GraphicsLayer.HitTestAsync(mapView, e.Position);

            if (graphic != null)
            {
                if (_layerInfo.MarkerType == EventMarkerType.Proportional)
                {
                    (graphic.Symbol as SimpleMarkerSymbol).Color = DefaultSettings.GetColor(GeoStatus.Hilight);
                }
                else
                {
                    graphic.Symbol = _layerInfo.GetSymbol(GeoStatus.Hilight);
                }

                OnPointTapped(graphic.Geometry as MapPoint);
            }
            else
            {
                if (drawing)
                {
                    AddGraphic(e.Location, DRAFT, 1, GeoStatus.Hilight);
                }

                OnPointTapped((MapPoint)GeometryEngine.Project(e.Location, SpatialReferences.Wgs84));
            }
        }
Beispiel #20
0
        private bool CollectProjectItem(ZeusModule parent, string projectPath, string templatePath)
        {
            bool complete    = false;
            int  moduleIndex = projectPath.LastIndexOf('/');

            if (moduleIndex >= 0)
            {
                string modulePath = projectPath.Substring(0, moduleIndex),
                       objectName = projectPath.Substring(moduleIndex + 1);

                ZeusModule m = FindModule(parent, modulePath);
                if (m != null)
                {
                    ZeusTemplate    template = new ZeusTemplate(templatePath);
                    DefaultSettings settings = DefaultSettings.Instance;

                    SavedTemplateInput savedInput = null;
                    if (m.SavedObjects.Contains(objectName))
                    {
                        savedInput = m.SavedObjects[objectName];
                    }
                    else
                    {
                        savedInput = new SavedTemplateInput();
                        savedInput.SavedObjectName = objectName;
                    }


                    ZeusContext context = new ZeusContext();
                    context.Log = this._log;

                    savedInput.TemplateUniqueID = template.UniqueID;
                    savedInput.TemplatePath     = template.FilePath + template.FileName;

                    settings.PopulateZeusContext(context);
                    if (m != null)
                    {
                        m.PopulateZeusContext(context);
                        m.OverrideSavedData(savedInput.InputItems);
                    }

                    if (template.Collect(context, settings.ScriptTimeout, savedInput.InputItems))
                    {
                        //this._lastRecordedSelectedNode = this.SelectedTemplate;
                    }


                    if (this._argmgr.InternalUseOnly)
                    {
                        this._log.Write("[BEGIN_RECORDING]");

                        this._log.Write(savedInput.XML);

                        this._log.Write("[END_RECORDING]");
                    }
                    complete = true;
                }
            }
            return(complete);
        }
Beispiel #21
0
        private void EnsureSettingsCreated()
        {
            int changes = 0;

            if (DefaultSettings.HistoryUsers == null)
            {
                DefaultSettings.HistoryUsers = new SerializableDictionary <string, string>();
                ++changes;
            }
            if (DefaultSettings.Pop3Settings == null)
            {
                DefaultSettings.Pop3Settings = new Pop3Settings();
                ++changes;
            }
            if (DefaultSettings.ImapSettings == null)
            {
                DefaultSettings.ImapSettings = new ImapSettings();
                ++changes;
            }
            if (DefaultSettings.Pop3Settings == null)
            {
                DefaultSettings.SmtpSettings = new SmtpSettings();
                ++changes;
            }
            if (changes > 0)
            {
                DefaultSettings.Save();
            }
        }
Beispiel #22
0
        private void LoadTemplates()
        {
            this.treeViewTemplates.Nodes.Clear();

            DefaultSettings settings = new DefaultSettings();

            string defaultTemplatePath = settings.DefaultTemplateDirectory;
            string exePath             = Directory.GetCurrentDirectory();

            if (!Directory.Exists(defaultTemplatePath))
            {
                defaultTemplatePath = exePath;
            }

            ArrayList     templates = new ArrayList();
            DirectoryInfo rootInfo  = new DirectoryInfo(defaultTemplatePath);

            buildChildren(rootInfo, templates);

            RootTreeNode rootNode = new RootTreeNode("Zeus Templates by Namespace");

            this.treeViewTemplates.Nodes.Add(rootNode);

            foreach (ZeusTemplate template in templates)
            {
                if (template.NamespacePathString.Trim() == string.Empty)
                {
                    rootNode.AddSorted(new TemplateTreeNode(template));
                }
                else
                {
                    SortedTreeNode parentNode = rootNode;

                    foreach (string ns in template.NamespacePath)
                    {
                        bool isFound = false;
                        foreach (SortedTreeNode tmpNode in parentNode.Nodes)
                        {
                            if (tmpNode.Text == ns)
                            {
                                parentNode = tmpNode;
                                isFound    = true;
                                break;
                            }
                        }

                        if (!isFound)
                        {
                            FolderTreeNode ftn = new FolderTreeNode(ns);
                            parentNode.AddSorted(ftn);
                            parentNode = ftn;
                        }
                    }

                    parentNode.AddSorted(new TemplateTreeNode(template));
                }
            }

            rootNode.Expand();
        }
Beispiel #23
0
        private void LoadTemplatesByFile()
        {
            this.treeViewTemplates.Nodes.Clear();

            DefaultSettings settings = new DefaultSettings();

            string defaultTemplatePath = settings.DefaultTemplateDirectory;
            string exePath             = Directory.GetCurrentDirectory();

            if (!Directory.Exists(defaultTemplatePath))
            {
                defaultTemplatePath = exePath;
            }

            ArrayList     templates = new ArrayList();
            DirectoryInfo rootInfo  = new DirectoryInfo(defaultTemplatePath);

            RootTreeNode rootNode = new RootTreeNode("Zeus Templates by File");

            this.treeViewTemplates.Nodes.Add(rootNode);

            buildChildren(rootNode, rootInfo);

            rootNode.Expand();
        }
Beispiel #24
0
        private IPackageRepository GetPackagesRepository()
        {
            string solutionDir  = GetSolutionDir();
            string defaultValue = DefaultSettings.GetRepositoryPath();

            string target = null;

            if (!String.IsNullOrEmpty(solutionDir))
            {
                string configValue = GetPackagesPath(solutionDir);
                // solution dir exists, no default packages folder specified anywhere,
                // default to hardcoded "packages" folder under solution
                if (string.IsNullOrEmpty(configValue) && string.IsNullOrEmpty(defaultValue))
                {
                    configValue = PackagesFolder;
                }

                if (!string.IsNullOrEmpty(configValue))
                {
                    target = Path.Combine(solutionDir, configValue);
                }
            }

            if (string.IsNullOrEmpty(target))
            {
                target = defaultValue;
            }

            if (!string.IsNullOrEmpty(target) && Directory.Exists(target))
            {
                return(new SharedPackageRepository(target));
            }

            return(null);
        }
        public void Reset()
        {
            ISettings settings = new DefaultSettings {AttachToBrowserTimeOut = 111};

            var autoCloseDialogs = !settings.AutoCloseDialogs;
            settings.AutoCloseDialogs = autoCloseDialogs;
            settings.HighLightColor = "strange color";
            var highLightElement = !settings.HighLightElement;
            settings.HighLightElement = highLightElement;
            settings.WaitForCompleteTimeOut = 222;
            settings.WaitUntilExistsTimeOut = 333;
            settings.SleepTime = 444;

            var settingsClone = settings.Clone();
            Assert.AreEqual(111, settingsClone.AttachToBrowserTimeOut, "Unexpected AttachToBrowserTimeOut");
            Assert.AreEqual(autoCloseDialogs, settingsClone.AutoCloseDialogs, "Unexpected AutoCloseDialogs");
            Assert.AreEqual("strange color", settingsClone.HighLightColor, "Unexpected HighLightColor");
            Assert.AreEqual(highLightElement, settingsClone.HighLightElement, "Unexpected HighLightElement");
            Assert.AreEqual(222, settingsClone.WaitForCompleteTimeOut, "Unexpected WaitForCompleteTimeOut");
            Assert.AreEqual(333, settingsClone.WaitUntilExistsTimeOut, "Unexpected WaitUntilExistsTimeOut");
            Assert.AreEqual(444, settingsClone.SleepTime, "Unexpected SleepTime");

            settingsClone.Reset();
            AssertDefaults(settingsClone);
        }
		private void LoadTemplates() 
		{
			this.treeViewTemplates.Nodes.Clear();

			DefaultSettings settings = new DefaultSettings();

			string defaultTemplatePath = settings.DefaultTemplateDirectory;
			string exePath = Directory.GetCurrentDirectory();
			
			if (!Directory.Exists(defaultTemplatePath)) 
			{
				defaultTemplatePath = exePath;
			}

			ArrayList templates = new ArrayList();
			DirectoryInfo rootInfo = new DirectoryInfo(defaultTemplatePath);

			buildChildren(rootInfo, templates);

			RootTreeNode rootNode = new RootTreeNode("Zeus Templates by Namespace");
			this.treeViewTemplates.Nodes.Add(rootNode);

			foreach (ZeusTemplate template in templates) 
			{
				if (template.NamespacePathString.Trim() == string.Empty) 
				{
					rootNode.AddSorted(new TemplateTreeNode(template));
				}
				else 
				{
					SortedTreeNode parentNode = rootNode;

					foreach (string ns in template.NamespacePath) 
					{
						bool isFound = false;
						foreach (SortedTreeNode tmpNode in parentNode.Nodes) 
						{
							if (tmpNode.Text == ns) 
							{
								parentNode = tmpNode;
								isFound = true;
								break;
							}
						}

						if (!isFound) 
						{
							FolderTreeNode ftn = new FolderTreeNode(ns);
							parentNode.AddSorted(ftn);
							parentNode = ftn;
						}
					}

					parentNode.AddSorted(new TemplateTreeNode(template));
				}
			}

			rootNode.Expand();
		}
Beispiel #27
0
        protected internal Assembly GetAssembly(Type type)
        {
            ProxySettings settings = DefaultSettings.Clone();

            settings.ServiceType    = type;
            settings.DownloadClient = false;
            return(GetAssembly(settings));
        }
Beispiel #28
0
 public WebPagesDownloader(IWorkerState State, DefaultSettings Settings)
 {
     _State              = State;
     _Settings           = Settings;
     _WebClient.Proxy    = _Settings.Proxy;
     _WebClient.Encoding = Encoding.UTF8;
     LastState           = "";
 }
Beispiel #29
0
        public void Ctor_AppSettingsContainsValues_CreatesProperInstance()
        {
            var sut = new DefaultSettings(ConfigurationBuilder.Build());

            sut.SchemeOwnerUrl.Should().Be("https://scheme.isharetest.net");
            sut.Eori.Should().Be("EU.EORI.NL000000001");
            sut.GetType().GetProperties().Length.Should().Be(2);
        }
 private void OnExpressSettingClicked(object sender, EventArgs e)
 {
     DefaultSettings setting = new DefaultSettings();
     SettingsDlg dlg = new SettingsDlg("快递单设置", setting);
     if (dlg.ShowDialog() == DialogResult.OK)
     {
         Settings.Default.Save();
     }
 }
Beispiel #31
0
        public async Task TimerAsync(DefaultSettings aSettings)
        {
            while (true)
            {
                await TickSecondPageTimerAsync(aSettings);

                UpdatePageTimerTextSync();
            }
        }
Beispiel #32
0
 public void LoadAll()
 {
     _wifiOnly      = Preferences.Get("wifiOnly", DefaultSettings.WifiOnly(), sharedName);
     _newsCacheTime = Preferences.Get("newsCacheTime", DefaultSettings.NewsCacheTime(), sharedName);
     _themeOption   = (Theme)Preferences.Get("themeOption", DefaultSettings.ThemeOption(), sharedName);
     _onlyShowNextCycleWhenImminent = Preferences.Get("onlyShowNextCycleWhenImminent", DefaultSettings.OnlyShowNextCycleWhenImminent(), sharedName);
     _marsBackground   = Preferences.Get("marsBackground", DefaultSettings.MarsBackground(), sharedName);
     _temperatureScale = (TemperatureScale)Preferences.Get("temperatureScale", DefaultSettings.TemperatureScale(), sharedName);
 }
        public void GenerateNodeDataTest()
        {
            var           settings    = new DefaultSettings();
            var           nodeBuilder = new NodeBuilder(settings, new CoinBuilder(settings));
            var           mazeNodeDataBuilderbuilder = new MazeNodeDataBuilder(new FakeMazeNodeDataBuilderSettings(5, 3), new Randomizer(), nodeBuilder);
            IMazeNodeData data = mazeNodeDataBuilderbuilder.GenerateNodeData(12345);

            Assert.NotNull(data);
        }
Beispiel #34
0
        protected override void OnActivate()
        {
            base.OnActivate();

            LoadListings(SelectedYear, SelectedMonth);

            _defaultSettings = _settingFacade.GetDefaultSettings();
            ResetSettings();
        }
        public void ChangeSettingInCloneShouldNotChangeOriginalSetting()
        {
            ISettings settings = new DefaultSettings {AttachToBrowserTimeOut = 111};

            var settingsClone = settings.Clone();
            Assert.AreEqual(111, settingsClone.AttachToBrowserTimeOut, "Unexpected clone 1");

            settingsClone.AttachToBrowserTimeOut = 222;

            Assert.AreEqual(111, settings.AttachToBrowserTimeOut, "Unexpected original");
            Assert.AreEqual(222, settingsClone.AttachToBrowserTimeOut, "Unexpected clone 2");
        }
Beispiel #36
0
        public MainWindow()
        {
            InitializeComponent();

            var userInterface = new NormalWpfUserInterface();
            var settings = new DefaultSettings { HandleProcessCorruptedStateExceptions = true, UserInterface = userInterface };
            settings.Sender = new LocalSender();
            //Adding screenshot plugin
            settings.Plugins.Add(new ScreenShotWriter());
            var reporter = new ErrorReporter(settings);
            reporter.HandleExceptions = true;

            AppDomain.CurrentDomain.UnhandledException += reporter.UnhandledException;
            TaskScheduler.UnobservedTaskException += reporter.UnobservedTaskException;
            Application.Current.DispatcherUnhandledException += reporter.DispatcherUnhandledException;
        }
Beispiel #37
0
        static void Main()
        {
            // set NCrash handlers
            var userInterface = new NormalWinFormsUserInterface();
            var settings = new DefaultSettings { UserInterface = userInterface };
            settings.Sender = new LocalSender();
            //Adding screenshot plugin
            settings.Plugins.Add(new ScreenShotWriter());
            var reporter = new ErrorReporter(settings);
            reporter.HandleExceptions = true;

            AppDomain.CurrentDomain.UnhandledException += reporter.UnhandledException;
            Application.ThreadException += reporter.ThreadException;
            System.Threading.Tasks.TaskScheduler.UnobservedTaskException += reporter.UnobservedTaskException;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
		private void LoadTemplatesByFile() 
		{
			this.treeViewTemplates.Nodes.Clear();

			DefaultSettings settings = new DefaultSettings();

			string defaultTemplatePath = settings.DefaultTemplateDirectory;
			string exePath = Directory.GetCurrentDirectory();
			
			if (!Directory.Exists(defaultTemplatePath)) 
			{
				defaultTemplatePath = exePath;
			}

			ArrayList templates = new ArrayList();
			DirectoryInfo rootInfo = new DirectoryInfo(defaultTemplatePath);

			RootTreeNode rootNode = new RootTreeNode("Zeus Templates by File");
			this.treeViewTemplates.Nodes.Add(rootNode);

			buildChildren(rootNode, rootInfo);

			rootNode.Expand();
		}
        public void Defaults()
        {
            ISettings settings = new DefaultSettings();

            AssertDefaults(settings);
        }
		public void ExecuteTemplate(ZeusTemplate template) 
		{
			this.Cursor = Cursors.WaitCursor;

			DefaultSettings settings = new DefaultSettings();
			
			ZeusInput zin = new ZeusInput();
			ZeusOutput zout = new ZeusOutput();
			Hashtable objects = new Hashtable();
			ZeusGuiContext guicontext;
			ZeusTemplateContext bodycontext = null;

			dbRoot myMeta = new dbRoot();

			// Set the global variables for the default template/output paths
			zin["defaultTemplatePath"] = settings.DefaultTemplateDirectory;
			zin["defaultOutputPath"] = settings.DefaultOutputDirectory;

			string driver, connectionString;

			//if there is a connection string set, it in the input section here.
			if (settings.DbDriver != string.Empty) 
			{
				driver = settings.DbDriver;
				connectionString = settings.ConnectionString;

				zin["dbDriver"] = driver;
				zin["dbConnectionString"] = connectionString;
				
				try 
				{
					// Try to connect to the DB with MyMeta (using default connection info)
					myMeta.Connect(settings.DbDriver, settings.ConnectionString);
					
					// Set DB global variables and also input variables

					if (settings.DbTarget != string.Empty)				
						myMeta.DbTarget	= settings.DbTarget;

					if (settings.DbTargetMappingFile != string.Empty)
						myMeta.DbTargetMappingFileName = settings.DbTargetMappingFile;

					if (settings.LanguageMappingFile != string.Empty)
						myMeta.LanguageMappingFileName = settings.LanguageMappingFile;

					if (settings.DbTarget != string.Empty)
						myMeta.DbTarget	= settings.DbTarget;

					if (settings.Language != string.Empty)
						myMeta.Language = settings.Language;

					if (settings.UserMetaDataFileName != string.Empty)
						myMeta.UserMetaDataFileName = settings.UserMetaDataFileName;
				}
				catch 
				{
					// Give them an empty MyMeta
					myMeta = new dbRoot();
				}
			}

			bool exceptionOccurred = false;

			bool result = false;
			try 
			{
				// Add any objects here that need to be embedded in the script.
				objects.Add("MyMeta", myMeta);

				guicontext = new ZeusGuiContext(zin, new GuiController(), objects);

				template.GuiSegment.ZeusScriptingEngine.Executioner.ScriptTimeout = settings.ScriptTimeout;
				template.GuiSegment.ZeusScriptingEngine.Executioner.SetShowGuiHandler(new ShowGUIEventHandler(DynamicGUI_Display));
				result = template.GuiSegment.Execute(guicontext); 

				if (result) 
				{
					bodycontext = new ZeusTemplateContext(guicontext);
					result = template.BodySegment.Execute(bodycontext);
				}
			}
			catch (Exception ex)
			{
				ZeusDisplayError formError = new ZeusDisplayError(ex);
				formError.SetControlsFromException();			
				formError.ShowDialog(this);

				exceptionOccurred = true;
			}

			if (!exceptionOccurred && result)
			{
				MessageBox.Show("Successfully rendered template: " + template.Title);
			}

			this.Cursor = Cursors.Default;
		}
		public void SetIESettings()
		{
            // GIVEN
			Assert.AreNotEqual(111, Settings.AttachToBrowserTimeOut, "Pre condition failed");

            ISettings settings = new DefaultSettings {AttachToBrowserTimeOut = 111};

            // WHEN
		    Settings.Instance = settings;
			
            // THEN
            Assert.AreEqual(111, Settings.AttachToBrowserTimeOut);
		}