示例#1
0
        public static async Task SendEmail(string subject, string body, List <string> recipients, string imagePath = "")
        {
            try
            {
                ExperimentalFeatures.Enable(ExperimentalFeatures.EmailAttachments, ExperimentalFeatures.ShareFileRequest);

                var message = new EmailMessage
                {
                    Subject = subject,
                    Body    = body,
                    To      = recipients
                };

                if (imagePath != "")
                {
                    message.Attachments.Add(new EmailAttachment(imagePath));
                }

                await Email.ComposeAsync(message);
            }
            catch
            {
                // Email is not supported on this device
                await App.Current.MainPage.DisplayAlert("Error", "Emailing is not support on this device", "OK");
            }
        }
示例#2
0
        public App()
        {
            ExperimentalFeatures.Enable("AppTheme_Experimental", "Shapes_Experimental");
            InitializeComponent();

            Microsoft.AppCenter.AppCenter
            .Start(Configs.AppCenter,
                   typeof(Analytics),
                   typeof(Crashes));

            ThemeControl.Update();
            //FontRegistry.RegisterFonts(FontAwesomeSolid.Font);

            this.StartInjecting()
            .SetInitialPage <SignUpPage>()


            .SetViewModelAssembly(typeof(ViewModelBase).Assembly)

            .AddHttpClient <IApiConsumer, ApiConsumer>(c
                                                       => c.BaseAddress = new Uri(Configs.Endpoint),
                                                       builder => builder.ConfigurePrimaryHttpMessageHandler <ApiHttpHandler>())

            .AddTransient <ApiHttpHandler>()
            .AddTransient <IThemeControl, ThemeControl>()

            .Build();
        }
示例#3
0
 public static void EnableExperimentalFeatures()
 {
     ExperimentalFeatures.Enable(
         ExperimentalFeatures.EmailAttachments,
         ExperimentalFeatures.ShareFileRequest,
         ExperimentalFeatures.OpenFileRequest);
 }
示例#4
0
 public RoutingModule(
     string iotHubName,
     string edgeDeviceId,
     string edgeModuleId,
     Option <string> connectionString,
     IDictionary <string, string> routes,
     bool isStoreAndForwardEnabled,
     StoreAndForwardConfiguration storeAndForwardConfiguration,
     int connectionPoolSize,
     bool useTwinConfig,
     VersionInfo versionInfo,
     Option <UpstreamProtocol> upstreamProtocol,
     TimeSpan connectivityCheckFrequency,
     int maxConnectedClients,
     TimeSpan messageAckTimeout,
     TimeSpan cloudConnectionIdleTimeout,
     bool closeCloudConnectionOnIdleTimeout,
     TimeSpan operationTimeout,
     bool useServerHeartbeat,
     Option <TimeSpan> minTwinSyncPeriod,
     Option <TimeSpan> reportedPropertiesSyncFrequency,
     bool useV1TwinManager,
     int maxUpstreamBatchSize,
     int upstreamFanOutFactor,
     bool encryptTwinStore,
     TimeSpan configUpdateFrequency,
     bool checkEntireQueueOnCleanup,
     ExperimentalFeatures experimentalFeatures,
     bool closeCloudConnectionOnDeviceDisconnect)
 {
     this.iotHubName                             = Preconditions.CheckNonWhiteSpace(iotHubName, nameof(iotHubName));
     this.edgeDeviceId                           = Preconditions.CheckNonWhiteSpace(edgeDeviceId, nameof(edgeDeviceId));
     this.connectionString                       = Preconditions.CheckNotNull(connectionString, nameof(connectionString));
     this.routes                                 = Preconditions.CheckNotNull(routes, nameof(routes));
     this.storeAndForwardConfiguration           = Preconditions.CheckNotNull(storeAndForwardConfiguration, nameof(storeAndForwardConfiguration));
     this.edgeModuleId                           = edgeModuleId;
     this.isStoreAndForwardEnabled               = isStoreAndForwardEnabled;
     this.connectionPoolSize                     = connectionPoolSize;
     this.useTwinConfig                          = useTwinConfig;
     this.versionInfo                            = versionInfo ?? VersionInfo.Empty;
     this.upstreamProtocol                       = upstreamProtocol;
     this.connectivityCheckFrequency             = connectivityCheckFrequency;
     this.maxConnectedClients                    = Preconditions.CheckRange(maxConnectedClients, 1);
     this.messageAckTimeout                      = messageAckTimeout;
     this.cloudConnectionIdleTimeout             = cloudConnectionIdleTimeout;
     this.closeCloudConnectionOnIdleTimeout      = closeCloudConnectionOnIdleTimeout;
     this.operationTimeout                       = operationTimeout;
     this.useServerHeartbeat                     = useServerHeartbeat;
     this.minTwinSyncPeriod                      = minTwinSyncPeriod;
     this.reportedPropertiesSyncFrequency        = reportedPropertiesSyncFrequency;
     this.useV1TwinManager                       = useV1TwinManager;
     this.maxUpstreamBatchSize                   = maxUpstreamBatchSize;
     this.upstreamFanOutFactor                   = upstreamFanOutFactor;
     this.encryptTwinStore                       = encryptTwinStore;
     this.configUpdateFrequency                  = configUpdateFrequency;
     this.checkEntireQueueOnCleanup              = checkEntireQueueOnCleanup;
     this.experimentalFeatures                   = experimentalFeatures;
     this.closeCloudConnectionOnDeviceDisconnect = closeCloudConnectionOnDeviceDisconnect;
 }
示例#5
0
        public App()
        {
            InitializeComponent();

            ExperimentalFeatures.Enable(ExperimentalFeatures.ShareFileRequest);

            MainPage = new MainPage();
        }
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     Xamarin.Essentials.Platform.Init(this, savedInstanceState);
     ExperimentalFeatures.Enable(ExperimentalFeatures.EmailAttachments, ExperimentalFeatures.ShareFileRequest);
     SetContentView(Resource.Layout.activity_main);
     Initialize();
 }
示例#7
0
        public App()
        {
            InitializeComponent();

            // Required if using Xamarin.Essentials < 1.3.0
            ExperimentalFeatures.Enable(ExperimentalFeatures.ShareFileRequest);

            MainPage = new AppShell();
        }
        private async void ShareFileAsync()
        {
            ExperimentalFeatures.Enable(ExperimentalFeatures.ShareFileRequest, ExperimentalFeatures.OpenFileRequest);

            await Share.RequestAsync(new ShareFileRequest
            {
                Title = "Share Property Contract",
                File  = new ShareFile(Property.ContractFilePath)
            });
        }
        private async void OpenFileAsync()
        {
            var filePath = Property.ContractFilePath;

            ExperimentalFeatures.Enable(ExperimentalFeatures.OpenFileRequest, ExperimentalFeatures.ShareFileRequest);

            await Launcher.OpenAsync(
                new OpenFileRequest("Contract",
                                    new ReadOnlyFile(filePath)));
        }
 async private void ExportDB(object sender, EventArgs e)
 {
     ExperimentalFeatures.Enable("ShareFileRequest_Experimental");
     string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Fees20.db3");
     //open the Share panel
     await Share.RequestAsync(new ShareFileRequest
     {
         Title = Title,
         File  = new ShareFile(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Fees20.db3"))
     });
 }
示例#11
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Forms.SetFlags("CollectionView_Experimental");
            ExperimentalFeatures.Enable(ExperimentalFeatures.EmailAttachments);
            Rg.Plugins.Popup.Popup.Init();
            Plugin.InputKit.Platforms.iOS.Config.Init();

            global::Xamarin.Forms.Forms.Init();
            LoadApplication(new App());

            return(base.FinishedLaunching(app, options));
        }
示例#12
0
        public App()
        {
            InitializeComponent();

            // Enable currently experimental features
            ExperimentalFeatures.Enable(
                ExperimentalFeatures.EmailAttachments,
                ExperimentalFeatures.ShareFileRequest);

            VersionTracking.Track();

            MainPage = new NavigationPage(new HomePage());
        }
示例#13
0
        public App()
        {
            ExperimentalFeatures.Enable(ExperimentalFeatures.ShareFileRequest);

            Resources = new ResourceDictionary();
            Resources.Add("primaryGreen", Color.FromHex("91CA47"));
            Resources.Add("primaryDarkGreen", Color.FromHex("6FA22E"));
            var nav = new NavigationPage(new TodoListPage());

            nav.BarBackgroundColor = (Color)App.Current.Resources["primaryGreen"];
            nav.BarTextColor       = Color.White;

            MainPage = nav;
        }
示例#14
0
        public App()
        {
            ExperimentalFeatures.Enable("Shapes_Experimental", "SwipeView_Experimental");

            AppCenter.Start(Config.AppCenter, typeof(Crashes), typeof(Analytics));

            InitializeComponent();

            this.StartInjecting()
            .AddHttpClient <BerryClient>(c => {
                c.BaseAddress = new Uri(Config.Endpoint);
            })
            .Build();
        }
示例#15
0
 public TwinConfigSourceModule(
     string iotHubHostname,
     string deviceId,
     IConfiguration config,
     VersionInfo versionInfo,
     TimeSpan configRefreshFrequency,
     bool enableStreams,
     TimeSpan requestTimeout,
     ExperimentalFeatures experimentalFeatures)
 {
     this.iotHubHostName         = Preconditions.CheckNonWhiteSpace(iotHubHostname, nameof(iotHubHostname));
     this.deviceId               = Preconditions.CheckNonWhiteSpace(deviceId, nameof(deviceId));
     this.configuration          = Preconditions.CheckNotNull(config, nameof(config));
     this.versionInfo            = Preconditions.CheckNotNull(versionInfo, nameof(versionInfo));
     this.configRefreshFrequency = configRefreshFrequency;
     this.enableStreams          = enableStreams;
     this.requestTimeout         = requestTimeout;
     this.experimentalFeatures   = experimentalFeatures;
 }
示例#16
0
        public App()
        {
            InitializeComponent();

            // Enable currently experimental features
            ExperimentalFeatures.Enable(
                ExperimentalFeatures.EmailAttachments,
                ExperimentalFeatures.ShareFileRequest,
                ExperimentalFeatures.OpenFileRequest);

            VersionTracking.Track();

            if (DeviceInfo.Idiom == DeviceIdiom.Watch)
            {
                MainPage = new NavigationPage(new CircleHomePage());
            }
            else
            {
                MainPage = new NavigationPage(new HomePage());
            }
        }
        public void SetValueWorksProperly()
        {
            // In the test setup, this setting always starts out empty (the default value).
            Assert.AreEqual("", ExperimentalFeatures.TokensOfEnabledFeatures);
            Assert.IsFalse(ExperimentalFeatures.IsFeatureEnabled("testing"));

            ExperimentalFeatures.SetValue("testing", true);
            Assert.IsTrue(ExperimentalFeatures.IsFeatureEnabled("testing"));
            Assert.AreEqual("testing", ExperimentalFeatures.TokensOfEnabledFeatures);

            // setting more than once should not change the stored value
            ExperimentalFeatures.SetValue("testing", true);
            Assert.IsTrue(ExperimentalFeatures.IsFeatureEnabled("testing"));
            Assert.AreEqual("testing", ExperimentalFeatures.TokensOfEnabledFeatures);

            ExperimentalFeatures.SetValue("testing", false);
            Assert.IsFalse(ExperimentalFeatures.IsFeatureEnabled("testing"));
            Assert.AreEqual("", ExperimentalFeatures.TokensOfEnabledFeatures);

            ExperimentalFeatures.SetValue(ExperimentalFeatures.kExperimentalSourceBooks, true);
            ExperimentalFeatures.SetValue(ExperimentalFeatures.kTeamCollections, true);
            ExperimentalFeatures.SetValue(ExperimentalFeatures.kExperimentalSourceBooks, true);
            ExperimentalFeatures.SetValue(ExperimentalFeatures.kTeamCollections, true);
            Assert.IsTrue(ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kExperimentalSourceBooks));
            Assert.IsTrue(ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections));
            Assert.AreEqual(ExperimentalFeatures.kExperimentalSourceBooks + "," + ExperimentalFeatures.kTeamCollections,
                            ExperimentalFeatures.TokensOfEnabledFeatures);

            ExperimentalFeatures.SetValue(ExperimentalFeatures.kExperimentalSourceBooks, false);
            Assert.IsFalse(ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kExperimentalSourceBooks));
            Assert.IsTrue(ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections));
            Assert.AreEqual(ExperimentalFeatures.kTeamCollections, ExperimentalFeatures.TokensOfEnabledFeatures);

            ExperimentalFeatures.SetValue(ExperimentalFeatures.kTeamCollections, false);
            Assert.IsFalse(ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kExperimentalSourceBooks));
            Assert.IsFalse(ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections));
            Assert.AreEqual("", ExperimentalFeatures.TokensOfEnabledFeatures);
        }
示例#18
0
        public override Task OnLaunchAsync(Bundle savedInstanceState)
        {
            Platform.Init(this, savedInstanceState);
            ExperimentalFeatures.Enable(ExperimentalFeatures.ShareFileRequest);

            BoilerManager.Initialize();
            MeasurementManager.Initialize();

            Messenger.Default.Register <TitleMessage>(this, (message) => SupportActionBar.Title = message.Title);
            Messenger.Default.Register <NotificationMessage>(this, (notification) =>
            {
                Toast
                .MakeText(this, notification.Notification, ToastLength.Long)
                .Show();
            });

            SetupDrawerView();

            navigationService = NavigationService;
            NavigationService.NavigateTo("Home");

            return(Task.CompletedTask);
        }
示例#19
0
        public async Task SendEmail(string subject, string body, List <string> recipients, string filepath)
        {
            try
            {
                ExperimentalFeatures.Enable("EmailAttachments_Experimental"); // required to allow attachment in email
                List <EmailAttachment> emailAttachments = new List <EmailAttachment>();
                EmailAttachment        attachment       = new EmailAttachment(filepath);
                emailAttachments.Add(attachment);

                var message = new EmailMessage
                {
                    Subject     = subject,
                    Body        = body,
                    To          = recipients,
                    Attachments = emailAttachments
                };
                await Email.ComposeAsync(message);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
示例#20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.SetTheme(Resource.Style.MainTheme);
            base.OnCreate(bundle);
            AppContext = ApplicationContext;

            Forms.SetFlags("CollectionView_Experimental");

            //Xamarin.FormsMaps.Init(this, bundle);
            HtmlLabelRenderer.Initialize();
            CrossMediaManager.Current.Init(this);
            CrossCurrentActivity.Current.Init(this, bundle);
            Popup.Init(this, bundle);
            Forms.Init(this, bundle);
            FormsMaterial.Init(this, bundle);
            ExperimentalFeatures.Enable(ExperimentalFeatures.EmailAttachments);

            //CachedImageRenderer.Init(enableFastRenderer: true);

            LoadApplication(new App());

            Window.SetStatusBarColor(Android.Graphics.Color.White);
            Window.SetTitleColor(Android.Graphics.Color.Black);
        }
        private async void SendEmailAsync(Vendor vendor)
        {
            var folder             = FileSystem.CacheDirectory;
            var attachmentFilePath = Path.Combine(folder, "draft-contract.pdf");

            using (var packageStream = await FileSystem.OpenAppPackageFileAsync("contract.pdf"))
            {
                using (var fileStream = File.OpenWrite(attachmentFilePath))
                {
                    await packageStream.CopyToAsync(fileStream);
                }
            }

            ExperimentalFeatures.Enable(ExperimentalFeatures.EmailAttachments);

            try
            {
                await Email.ComposeAsync(new EmailMessage
                {
                    To = new List <string> {
                        vendor.Email
                    },
                    Subject     = $"Re: {Property.Address}",
                    BodyFormat  = EmailBodyFormat.PlainText,
                    Body        = $"Hi {vendor.FirstName}, \n\n",
                    Attachments = new List <EmailAttachment>
                    {
                        new EmailAttachment(attachmentFilePath)
                    }
                });
            }
            catch (FeatureNotSupportedException ex)
            {
                await DialogService.ShowAlertAsync("Your device does not support this feature", "Feature Not Supported");
            }
        }
示例#22
0
        public App()
        {
            ExperimentalFeatures.Enable(new string[] {
                "SwipeView_Experimental",
                "Shapes_Experimental",
                "Expander_Experimental"
            });


            InitializeComponent();

            AppCenter.Start(Config.AppCenter,
                            typeof(Analytics), typeof(Crashes));

            CurrentProvider = this.StartInjecting()

                              .SetInitialPage <SettingsPage>()

                              .AddHttpClient <RaspberryClient>(client => {
                client.BaseAddress = new Uri(Config.Endpoint);
            })

                              .Build();
        }
示例#23
0
        public CollectionSettingsDialog(CollectionSettings collectionSettings,
                                        QueueRenameOfCollection queueRenameOfCollection, PageRefreshEvent pageRefreshEvent,
                                        TeamCollectionManager tcManager, XMatterPackFinder xmatterPackFinder)
        {
            _collectionSettings      = collectionSettings;
            _queueRenameOfCollection = queueRenameOfCollection;
            _pageRefreshEvent        = pageRefreshEvent;
            _xmatterPackFinder       = xmatterPackFinder;
            InitializeComponent();

            _language1Name.UseMnemonic = false;             // Allow & to be part of the language display names.
            _language2Name.UseMnemonic = false;             // This may be unlikely, but can't be ruled out.
            _language3Name.UseMnemonic = false;             // See https://issues.bloomlibrary.org/youtrack/issue/BL-9919.

            PendingFontSelections[0] = _collectionSettings.LanguagesZeroBased[0].FontName;
            PendingFontSelections[1] = _collectionSettings.LanguagesZeroBased[1].FontName;
            var have3rdLanguage = _collectionSettings.LanguagesZeroBased[2] != null;

            PendingFontSelections[2] = have3rdLanguage ?
                                       _collectionSettings.LanguagesZeroBased[2].FontName :
                                       "";
            PendingNumberingStyle = _collectionSettings.PageNumberStyle;
            PendingXmatter        = _collectionSettings.XMatterPackName;
            CollectionSettingsApi.DialogBeingEdited = this;

            if (_collectionSettings.IsSourceCollection)
            {
                _language1Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language1InSourceCollection", "Language 1", "In a local language collection, we say 'Local Language', but in a source collection, Local Language has no relevance, so we use this different label");
                _language2Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language2InSourceCollection", "Language 2", "In a local language collection, we say 'Language 2 (e.g. National Language)', but in a source collection, National Language has no relevance, so we use this different label");
                _language3Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language3InSourceCollection", "Language 3", "In a local language collection, we say 'Language 3 (e.g. Regional Language)', but in a source collection, National Language has no relevance, so we use this different label");
            }

            _showExperimentalBookSources.Checked  = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kExperimentalSourceBooks);
            _allowTeamCollection.Checked          = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections);
            _allowSpreadsheetImportExport.Checked = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kSpreadsheetImportExport);

            if (!ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections) && tcManager.CurrentCollectionEvenIfDisconnected == null)
            {
                this._tab.Controls.Remove(this._teamCollectionTab);
            }
            // Don't allow the user to disable the Team Collection feature if we're currently in a Team Collection.
            _allowTeamCollection.Enabled = !(_allowTeamCollection.Checked && tcManager.CurrentCollectionEvenIfDisconnected != null);

            // AutoUpdate applies only to Windows: see https://silbloom.myjetbrains.com/youtrack/issue/BL-2317.
            if (SIL.PlatformUtilities.Platform.IsWindows)
            {
                _automaticallyUpdate.Checked = Settings.Default.AutoUpdate;
            }
            else
            {
                _automaticallyUpdate.Hide();
            }

            // Without this, PendingDefaultBookshelf stays null unless the user changes it.
            // The result is the bookshelf selection gets cleared when other collection settings are saved. See BL-10093.
            PendingDefaultBookshelf = _collectionSettings.DefaultBookshelf;

            CollectionSettingsApi.BrandingChangeHandler = ChangeBranding;

            TeamCollectionApi.TheOneInstance.SetCallbackToReopenCollection(() =>
            {
                _restartRequired = true;
                ReactDialog.CloseCurrentModal();             // close the top Create dialog
                _okButton_Click(null, null);                 // close this dialog
            });

            UpdateDisplay();

            if (CollectionSettingsApi.FixEnterpriseSubscriptionCodeMode)
            {
                _tab.SelectedTab = _enterpriseTab;
            }

            if (tcManager.CurrentCollectionEvenIfDisconnected == null)
            {
                _noRenameTeamCollectionLabel.Visible = false;
            }
            else
            {
                _bloomCollectionName.Enabled = false;
            }
        }
示例#24
0
 private void _allowTeamCollection_CheckedChanged(object sender, EventArgs e)
 {
     ExperimentalFeatures.SetValue(ExperimentalFeatures.kTeamCollections, _allowTeamCollection.Checked);
     ChangeThatRequiresRestart();
 }
示例#25
0
 private void _allowSpreadsheetImportExport_CheckedChanged(object sender, EventArgs e)
 {
     ExperimentalFeatures.SetValue(ExperimentalFeatures.kSpreadsheetImportExport, _allowSpreadsheetImportExport.Checked);
     ChangeThatRequiresRestart();
 }
示例#26
0
 private void _showExperimentalBookSources_CheckedChanged(object sender, EventArgs e)
 {
     ExperimentalFeatures.SetValue(ExperimentalFeatures.kExperimentalSourceBooks, _showExperimentalBookSources.Checked);
     ChangeThatRequiresRestart();
 }
示例#27
0
        public void Register(ContainerBuilder builder)
        {
            const int ConnectionPoolSize = 10;

            string edgeHubConnectionString = $"{this.configuration[EdgeHubConstants.ConfigKey.IotHubConnectionString]};ModuleId=$edgeHub";
            IotHubConnectionStringBuilder iotHubConnectionStringBuilder = IotHubConnectionStringBuilder.Create(edgeHubConnectionString);
            var topics = new MessageAddressConversionConfiguration(this.inboundTemplates, this.outboundTemplates);

            builder.RegisterModule(new LoggingModule());

            var mqttSettingsConfiguration = new Mock <IConfiguration>();

            mqttSettingsConfiguration.Setup(c => c.GetSection(It.IsAny <string>())).Returns(Mock.Of <IConfigurationSection>(s => s.Value == null));

            var experimentalFeatures = new ExperimentalFeatures(true, false, false, true);

            builder.RegisterBuildCallback(
                c =>
            {
                // set up loggers for dotnetty
                var loggerFactory = c.Resolve <ILoggerFactory>();
                InternalLoggerFactory.DefaultFactory = loggerFactory;

                var eventListener = new LoggerEventListener(loggerFactory.CreateLogger("ProtocolGateway"));
                eventListener.EnableEvents(CommonEventSource.Log, EventLevel.Informational);
            });

            var versionInfo   = new VersionInfo("v1", "b1", "c1");
            var metricsConfig = new MetricsConfig(true, new MetricsListenerConfig());
            var backupFolder  = Option.None <string>();

            string      storageFolder = string.Empty;
            StoreLimits storeLimits   = null;

            if (!int.TryParse(this.configuration["TimeToLiveSecs"], out int timeToLiveSecs))
            {
                timeToLiveSecs = -1;
            }

            if (long.TryParse(this.configuration["MaxStorageBytes"], out long maxStorageBytes))
            {
                storeLimits = new StoreLimits(maxStorageBytes);
            }

            var storeAndForwardConfiguration = new StoreAndForwardConfiguration(timeToLiveSecs, storeLimits);

            if (bool.TryParse(this.configuration["UsePersistentStorage"], out bool usePersistentStorage) && usePersistentStorage)
            {
                storageFolder = GetOrCreateDirectoryPath(this.configuration["StorageFolder"], EdgeHubConstants.EdgeHubStorageFolder);
            }

            if (bool.TryParse(this.configuration["EnableNonPersistentStorageBackup"], out bool enableNonPersistentStorageBackup))
            {
                backupFolder = Option.Some(this.configuration["BackupFolder"]);
            }

            var    testRoutes   = this.routes;
            string customRoutes = this.configuration["Routes"];

            if (!string.IsNullOrWhiteSpace(customRoutes))
            {
                testRoutes = JsonConvert.DeserializeObject <IDictionary <string, string> >(customRoutes);
            }

            builder.RegisterModule(
                new CommonModule(
                    string.Empty,
                    iotHubConnectionStringBuilder.HostName,
                    iotHubConnectionStringBuilder.DeviceId,
                    iotHubConnectionStringBuilder.ModuleId,
                    string.Empty,
                    Option.None <string>(),
                    AuthenticationMode.CloudAndScope,
                    Option.Some(edgeHubConnectionString),
                    false,
                    usePersistentStorage,
                    storageFolder,
                    Option.None <string>(),
                    Option.None <string>(),
                    TimeSpan.FromHours(1),
                    false,
                    this.trustBundle,
                    string.Empty,
                    metricsConfig,
                    enableNonPersistentStorageBackup,
                    backupFolder,
                    Option.None <ulong>(),
                    Option.None <StorageLogLevel>()));

            builder.RegisterModule(
                new RoutingModule(
                    iotHubConnectionStringBuilder.HostName,
                    iotHubConnectionStringBuilder.DeviceId,
                    iotHubConnectionStringBuilder.ModuleId,
                    Option.Some(edgeHubConnectionString),
                    testRoutes,
                    true,
                    storeAndForwardConfiguration,
                    ConnectionPoolSize,
                    false,
                    versionInfo,
                    Option.Some(UpstreamProtocol.Amqp),
                    TimeSpan.FromSeconds(5),
                    101,
                    TimeSpan.FromSeconds(30),
                    TimeSpan.FromSeconds(3600),
                    true,
                    TimeSpan.FromSeconds(20),
                    false,
                    Option.None <TimeSpan>(),
                    Option.None <TimeSpan>(),
                    false,
                    10,
                    10,
                    false,
                    TimeSpan.FromHours(1),
                    experimentalFeatures));

            builder.RegisterModule(new HttpModule());
            builder.RegisterModule(new MqttModule(mqttSettingsConfiguration.Object, topics, this.serverCertificate, false, false, false, this.sslProtocols));
            builder.RegisterModule(new AmqpModule("amqps", 5671, this.serverCertificate, iotHubConnectionStringBuilder.HostName, true, this.sslProtocols));
        }
示例#28
0
        public CollectionSettingsDialog(CollectionSettings collectionSettings, XMatterPackFinder xmatterPackFinder, QueueRenameOfCollection queueRenameOfCollection, PageRefreshEvent pageRefreshEvent, TeamCollectionManager tcManager)
        {
            _collectionSettings      = collectionSettings;
            _xmatterPackFinder       = xmatterPackFinder;
            _queueRenameOfCollection = queueRenameOfCollection;
            _pageRefreshEvent        = pageRefreshEvent;
            InitializeComponent();
            // moved from the Designer where it was deleted if the Designer was touched
            _xmatterList.Columns.AddRange(new[] { new ColumnHeader()
                                                  {
                                                      Width = 250
                                                  } });

            _language1Name.UseMnemonic              = false;    // Allow & to be part of the language display names.
            _language2Name.UseMnemonic              = false;    // This may be unlikely, but can't be ruled out.
            _language3Name.UseMnemonic              = false;    // See https://issues.bloomlibrary.org/youtrack/issue/BL-9919.
            _language1FontLabel.UseMnemonic         = false;
            _language2FontLabel.UseMnemonic         = false;
            _language3FontLabel.UseMnemonic         = false;
            CollectionSettingsApi.DialogBeingEdited = this;

            if (_collectionSettings.IsSourceCollection)
            {
                _language1Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language1InSourceCollection", "Language 1", "In a local language collection, we say 'Local Language', but in a source collection, Local Language has no relevance, so we use this different label");
                _language2Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language2InSourceCollection", "Language 2", "In a local language collection, we say 'Language 2 (e.g. National Language)', but in a source collection, National Language has no relevance, so we use this different label");
                _language3Label.Text = LocalizationManager.GetString("CollectionSettingsDialog.LanguageTab.Language3InSourceCollection", "Language 3", "In a local language collection, we say 'Language 3 (e.g. Regional Language)', but in a source collection, National Language has no relevance, so we use this different label");
            }

            _showExperimentalBookSources.Checked = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kExperimentalSourceBooks);
            _allowTeamCollection.Checked         = ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections);
            if (!ExperimentalFeatures.IsFeatureEnabled(ExperimentalFeatures.kTeamCollections) && tcManager.CurrentCollectionEvenIfDisconnected == null)
            {
                this._tab.Controls.Remove(this._teamCollectionTab);
            }
            // Don't allow the user to disable the Team Collection feature if we're currently in a Team Collection.
            _allowTeamCollection.Enabled = !(_allowTeamCollection.Checked && tcManager.CurrentCollectionEvenIfDisconnected != null);

            // AutoUpdate applies only to Windows: see https://silbloom.myjetbrains.com/youtrack/issue/BL-2317.
            if (SIL.PlatformUtilities.Platform.IsWindows)
            {
                _automaticallyUpdate.Checked = Settings.Default.AutoUpdate;
            }
            else
            {
                _automaticallyUpdate.Hide();
            }

            // Without this, PendingDefaultBookshelf stays null unless the user changes it.
            // The result is the bookshelf selection gets cleared when other collection settings are saved. See BL-10093.
            PendingDefaultBookshelf = _collectionSettings.DefaultBookshelf;

//		    _showSendReceive.CheckStateChanged += (sender, args) =>
//		                                              {
//		                                                  Settings.Default.ShowSendReceive = _showSendReceive.CheckState ==
//		                                                                                     CheckState.Checked;
//
//                                                          _restartRequired = true;
//		                                                  UpdateDisplay();
//		                                              };

            CollectionSettingsApi.BrandingChangeHandler = ChangeBranding;

            SetupEnterpriseBrowser();

            TeamCollectionApi.TheOneInstance.SetCallbackToReopenCollection(() =>
            {
                _restartRequired = true;
                ReactDialog.CloseCurrentModal();             // close the top Create dialog
                _okButton_Click(null, null);                 // close this dialog
            });

            UpdateDisplay();

            if (CollectionSettingsApi.FixEnterpriseSubscriptionCodeMode)
            {
                _tab.SelectedTab = _enterpriseTab;
            }

            if (tcManager.CurrentCollectionEvenIfDisconnected == null)
            {
                _noRenameTeamCollectionLabel.Visible = false;
            }
            else
            {
                _bloomCollectionName.Enabled = false;
            }

            // This code would mostly more naturally go in Designer. Unfortunately we can't run designer
            // until we get back in a state where all our dependencies are sufficiently consistent.

            _defaultBookshelfControl = ReactControl.Create("defaultBookshelfControlBundle");

            tabPage2.Controls.Add(_defaultBookshelfControl);
            _defaultBookshelfControl.Location = new Point(_xmatterDescription.Left, _xmatterDescription.Bottom + 30);
            // We'd like it to be as big as possible, not just big enough for the immediate content.
            // Until React takes over at least the whole tab, the pull-down part of the combo can't
            // stretch outside the Gecko control.
            _defaultBookshelfControl.Size = new Size(_xmatterList.Width, 200);
        }
示例#29
0
 public ShareFileRequest(FileBase file)
 {
     ExperimentalFeatures.VerifyEnabled(ExperimentalFeatures.ShareFileRequest);
     File = new ShareFile(file);
 }
示例#30
0
 public ShareFile(string fullPath)
     : base(fullPath)
 {
     ExperimentalFeatures.VerifyEnabled(ExperimentalFeatures.ShareFileRequest);
 }