private void UploadJobForm_Load(object sender, EventArgs e) { Cancelled = false; //Few changes based on form mode (create or edit) Text = UploadJobDetail == null ? Resources.Add_upload_job : string.Format(Resources.Edit_job_0, UploadJobDetail.Key.Name); addToolStripButton.Text = UploadJobDetail == null ? Resources.Add_to_schedule : Resources.Edit_job; jobName.Enabled = UploadJobDetail == null; jobGroupComboBox.DataSource = Properties.Settings.Default.JobGroups; jobGroupComboBox.ValueMember = null; jobGroupComboBox.DisplayMember = "Name"; jobGroupComboBox.Enabled = UploadJobDetail == null; instanceComboBox.DataSource = Properties.Settings.Default.Instances; instanceComboBox.ValueMember = null; instanceComboBox.DisplayMember = "Name"; appRegistrationComboBox.DataSource = Properties.Settings.Default.AadApplications.Where(x => x.AuthenticationType == AuthenticationType.User).ToList(); appRegistrationComboBox.ValueMember = null; appRegistrationComboBox.DisplayMember = "Name"; userComboBox.DataSource = Properties.Settings.Default.Users; userComboBox.ValueMember = null; userComboBox.DisplayMember = "Login"; dataJobComboBox.DataSource = Properties.Settings.Default.DataJobs.Where(x => x.Type == DataJobType.Upload).ToList(); dataJobComboBox.ValueMember = null; dataJobComboBox.DisplayMember = "Name"; orderByComboBox.DataSource = Enum.GetValues(typeof(OrderByOptions)); upJobStartAtDateTimePicker.Value = DateTime.Now; procJobStartAtDateTimePicker.Value = DateTime.Now; inputFolderTextBox.Text = Properties.Settings.Default.UploadInputFolder; uploadSuccessFolderTextBox.Text = Properties.Settings.Default.UploadSuccessFolder; uploadErrorsFolderTextBox.Text = Properties.Settings.Default.UploadErrorsFolder; processingSuccessFolderTextBox.Text = Properties.Settings.Default.ProcessingSuccessFolder; processingErrorsFolderTextBox.Text = Properties.Settings.Default.ProcessingErrorsFolder; if ((UploadJobDetail != null) && (UploadTrigger != null)) { jobName.Text = UploadJobDetail.Key.Name; var jobGroup = ((IEnumerable <JobGroup>)jobGroupComboBox.DataSource).FirstOrDefault(x => x.Name == UploadJobDetail.Key.Group); jobGroupComboBox.SelectedItem = jobGroup; jobDescription.Text = UploadJobDetail.Description; useStandardSubfolder.Checked = false; inputFolderTextBox.Text = UploadJobDetail.JobDataMap.GetString(SettingsConstants.InputDir); uploadSuccessFolderTextBox.Text = UploadJobDetail.JobDataMap.GetString(SettingsConstants.UploadSuccessDir); uploadErrorsFolderTextBox.Text = UploadJobDetail.JobDataMap.GetString(SettingsConstants.UploadErrorsDir); legalEntityTextBox.Text = UploadJobDetail.JobDataMap.GetString(SettingsConstants.Company); isDataPackageCheckBox.Checked = UploadJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.IsDataPackage); statusFileExtensionTextBox.Text = UploadJobDetail.JobDataMap.GetString(SettingsConstants.StatusFileExtension) ?? ".Status"; numericUpDownIntervalUploads.Value = UploadJobDetail.JobDataMap.GetInt(SettingsConstants.DelayBetweenFiles); serviceAuthRadioButton.Checked = UploadJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.UseServiceAuthentication); if (!serviceAuthRadioButton.Checked) { User axUser = null; if (!UploadJobDetail.JobDataMap.GetString(SettingsConstants.UserName).IsNullOrWhiteSpace()) { axUser = ((IEnumerable <User>)userComboBox.DataSource).FirstOrDefault(x => x.Login == UploadJobDetail.JobDataMap.GetString(SettingsConstants.UserName)); } if (axUser == null) { axUser = new User { Login = UploadJobDetail.JobDataMap.GetString(SettingsConstants.UserName), Password = UploadJobDetail.JobDataMap.GetString(SettingsConstants.UserPassword) }; Properties.Settings.Default.Users.Add(axUser); userComboBox.DataSource = Properties.Settings.Default.Users; } userComboBox.SelectedItem = axUser; } var application = ((IEnumerable <AadApplication>)appRegistrationComboBox.DataSource).FirstOrDefault(app => app.ClientId == UploadJobDetail.JobDataMap.GetString(SettingsConstants.AadClientId)); if (application == null) { if (!serviceAuthRadioButton.Checked) { application = new AadApplication { ClientId = UploadJobDetail.JobDataMap.GetString(SettingsConstants.AadClientId) ?? Guid.Empty.ToString(), Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}", AuthenticationType = AuthenticationType.User }; } else { application = new AadApplication { ClientId = UploadJobDetail.JobDataMap.GetString(SettingsConstants.AadClientId) ?? Guid.Empty.ToString(), Secret = UploadJobDetail.JobDataMap.GetString(SettingsConstants.AadClientSecret) ?? String.Empty, Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}", AuthenticationType = AuthenticationType.Service }; } Properties.Settings.Default.AadApplications.Add(application); appRegistrationComboBox.DataSource = Properties.Settings.Default.AadApplications; } appRegistrationComboBox.SelectedItem = application; var dataJob = ((IEnumerable <DataJob>)dataJobComboBox.DataSource).FirstOrDefault(dj => dj.ActivityId == UploadJobDetail.JobDataMap.GetString(SettingsConstants.ActivityId)); if (dataJob == null) { dataJob = new DataJob { ActivityId = UploadJobDetail.JobDataMap.GetString(SettingsConstants.ActivityId), EntityName = UploadJobDetail.JobDataMap.GetString(SettingsConstants.EntityName), Type = DataJobType.Upload, Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}" }; Properties.Settings.Default.DataJobs.Add(dataJob); dataJobComboBox.DataSource = Properties.Settings.Default.DataJobs.Where(x => x.Type == DataJobType.Upload).ToList(); } dataJobComboBox.SelectedItem = dataJob; var axInstance = ((IEnumerable <Instance>)instanceComboBox.DataSource).FirstOrDefault(x => (x.AosUri == UploadJobDetail.JobDataMap.GetString(SettingsConstants.AosUri)) && (x.AadTenant == UploadJobDetail.JobDataMap.GetString(SettingsConstants.AadTenant)) && (x.AzureAuthEndpoint == UploadJobDetail.JobDataMap.GetString(SettingsConstants.AzureAuthEndpoint))); if (axInstance == null) { axInstance = new Instance { AosUri = UploadJobDetail.JobDataMap.GetString(SettingsConstants.AosUri), AadTenant = UploadJobDetail.JobDataMap.GetString(SettingsConstants.AadTenant), AzureAuthEndpoint = UploadJobDetail.JobDataMap.GetString(SettingsConstants.AzureAuthEndpoint), UseADAL = UploadJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.UseADAL), Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}" }; Properties.Settings.Default.Instances.Add(axInstance); instanceComboBox.DataSource = Properties.Settings.Default.Instances; } instanceComboBox.SelectedItem = axInstance; searchPatternTextBox.Text = UploadJobDetail.JobDataMap.GetString(SettingsConstants.SearchPattern) ?? "*.*"; orderByComboBox.DataSource = Enum.GetValues(typeof(OrderByOptions)); var selectedOrderBy = OrderByOptions.FileName; if (!UploadJobDetail.JobDataMap.GetString(SettingsConstants.OrderBy).IsNullOrWhiteSpace()) { selectedOrderBy = (OrderByOptions)Enum.Parse(typeof(OrderByOptions), UploadJobDetail.JobDataMap.GetString(SettingsConstants.OrderBy)); } orderByComboBox.SelectedItem = selectedOrderBy; orderDescendingRadioButton.Checked = UploadJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.ReverseOrder); pauseIndefinitelyCheckBox.Checked = UploadJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.IndefinitePause); if (UploadTrigger.GetType() == typeof(SimpleTriggerImpl)) { var localTrigger = (SimpleTriggerImpl)UploadTrigger; upJobSimpleTriggerRadioButton.Checked = true; upJobHoursDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; upJobMinutesDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; upJobStartAtDateTimePicker.Value = localTrigger.StartTimeUtc.UtcDateTime.ToLocalTime(); } else if (UploadTrigger.GetType() == typeof(CronTriggerImpl)) { var localTrigger = (CronTriggerImpl)UploadTrigger; upJobCronTriggerRadioButton.Checked = true; upJobCronExpressionTextBox.Text = localTrigger.CronExpressionString; } retriesCountUpDown.Value = UploadJobDetail.JobDataMap.GetInt(SettingsConstants.RetryCount); retriesDelayUpDown.Value = UploadJobDetail.JobDataMap.GetInt(SettingsConstants.RetryDelay); pauseOnExceptionsCheckBox.Checked = UploadJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.PauseJobOnException); verboseLoggingCheckBox.Checked = UploadJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.LogVerbose); Properties.Settings.Default.Save(); } if ((ProcessingJobDetail != null) && (ProcessingTrigger != null)) { useMonitoringJobCheckBox.Checked = true; processingSuccessFolderTextBox.Text = ProcessingJobDetail.JobDataMap.GetString(SettingsConstants.ProcessingSuccessDir); processingErrorsFolderTextBox.Text = ProcessingJobDetail.JobDataMap.GetString(SettingsConstants.ProcessingErrorsDir); delayBetweenStatusCheckNumericUpDown.Value = ProcessingJobDetail.JobDataMap.GetInt(SettingsConstants.DelayBetweenStatusCheck); getExecutionErrorsCheckBox.Checked = ProcessingJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.GetExecutionErrors); if (ProcessingTrigger.GetType() == typeof(SimpleTriggerImpl)) { var localTrigger = (SimpleTriggerImpl)ProcessingTrigger; procJobSimpleTriggerRadioButton.Checked = true; procJobHoursDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; procJobMinutesDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; procJobStartAtDateTimePicker.Value = localTrigger.StartTimeUtc.UtcDateTime.ToLocalTime(); } else if (ProcessingTrigger.GetType() == typeof(CronTriggerImpl)) { var localTrigger = (CronTriggerImpl)ProcessingTrigger; procJobCronTriggerRadioButton.Checked = true; procJobCronExpressionTextBox.Text = localTrigger.CronExpressionString; } } FormsHelper.SetDropDownsWidth(this); }
private Dialog SetupYouveGotItDialog() { Dialog dialog = new Dialog(new Size(App.ScreenWidth - 30, _challenge.Solution != null ? 430 : 340)) { DialogBackgroundColor = _configuration.Theme.BackgroundColor, EnableCloseButton = false, }; Grid dialogLayout = new Grid() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowSpacing = 20, }; dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(60, GridUnitType.Absolute) }); if (_challenge.Solution != null) { dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); } dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(40, GridUnitType.Absolute) }); dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(70, GridUnitType.Absolute) }); dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(70, GridUnitType.Absolute) }); int row = 0; var summaryIcon = FormsHelper.ConfigureImageButton("timestopped.png"); dialogLayout.Children.Add(summaryIcon, 0, row); row++; if (_challenge.Solution != null) { dialogLayout.Children.Add(new AutoFontSizeLabel() { Text = $"Solución: { _challenge.Solution }", HorizontalTextAlignment = TextAlignment.Center }, 0, row); row++; } dialogLayout.Children.Add(new Label() { Text = $"¿Lo has conseguido?", HorizontalTextAlignment = TextAlignment.Center, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, }, 0, row); row++; dialogLayout.Children.Add(new FrameButton("SÍ", (e, s) => { ShowResultSummary(false, true); }) { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = _configuration.Theme.SecondaryBackgroundColor, TextColor = Color.FromHex("#000078"), Margin = new Thickness(35, 0), }, 0, row); row++; dialogLayout.Children.Add(new FrameButton("NO", (e, s) => { ShowResultSummary(false, false); }) { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = _configuration.Theme.SecondaryBackgroundColor, TextColor = Color.FromHex("#000078"), Margin = new Thickness(35, 0), }, 0, row); row++; dialog.Content = dialogLayout; return(dialog); }
private Dialog SetupFinalResultSummaryDialog() { Dialog dialog = new Dialog(new Size(App.ScreenWidth - 30, 540)) { DialogBackgroundColor = _configuration.Theme.SecondaryBackgroundColor, EnableCloseButton = false, }; Grid dialogLayout = new Grid() { VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, RowSpacing = 10, Padding = new Thickness(15), }; dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(200, GridUnitType.Absolute) }); dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(40, GridUnitType.Absolute) }); dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(40, GridUnitType.Absolute) }); dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(100, GridUnitType.Absolute) }); int row = 0; var prizeIcon = FormsHelper.ConfigureImageButton("ivegotit.png"); dialogLayout.Children.Add(prizeIcon, 0, row); row++; var title = new Label() { Text = "Has acumulado", HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) + 4, }; dialogLayout.Children.Add(title, 0, row); row++; _finalResultSummaryDialogPoints = new Label() { HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.Red, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) + 4, }; dialogLayout.Children.Add(_finalResultSummaryDialogPoints, 0, row); row++; _finalResultSummaryDialogRanking = new Label() { HorizontalTextAlignment = TextAlignment.Center, //TextColor = Color.Red, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), }; dialogLayout.Children.Add(_finalResultSummaryDialogRanking, 0, row); row++; dialog.Content = dialogLayout; return(dialog); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); CachedImageRenderer.Init(); // Initializing FFImageLoading AnimationViewRenderer.Init(); // Initializing Lottie UXDivers.Artina.Shared.GrialKit.Init(new ThemeColors(), "RoboScout.iOS.GrialLicense"); #if !DEBUG // Reminder to update the project license to production mode before publishing if (!UXDivers.Artina.Shared.License.IsProductionLicense()) { BeginInvokeOnMainThread(() => { try { var alert = UIAlertController.Create( "Grial UI Kit Reminder", "Before publishing this App remember to change the license file to PRODUCTION MODE so it doesn't expire.", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Default, null)); var root = UIApplication.SharedApplication.KeyWindow.RootViewController; var controller = root.PresentedViewController ?? root.PresentationController.PresentedViewController; controller.PresentViewController(alert, animated: true, completionHandler: null); } catch { } }); } #endif // Code for starting up the Xamarin Test Cloud Agent #if ENABLE_TEST_CLOUD Xamarin.Calabash.Start(); #endif FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects)); FormsHelper.ForceLoadingAssemblyContainingType <UXDivers.Effects.iOS.CircleEffect>(); FormsHelper.ForceLoadingAssemblyContainingType <TabItem>(); FormsHelper.ForceLoadingAssemblyContainingType <Repeater>(); FormsHelper.ForceLoadingAssemblyContainingType <FFImageLoading.Transformations.BlurredTransformation>(); ReferenceCalendars(); #if GORILLA LoadApplication( UXDivers.Gorilla.iOS.Player.CreateApplication( new UXDivers.Gorilla.Config("Good Gorilla") // Shared.Base .RegisterAssemblyFromType <UXDivers.Artina.Shared.NegateBooleanConverter>() // Shared .RegisterAssemblyFromType <UXDivers.Artina.Shared.CircleImage>() // Tab Control .RegisterAssembly(GorillaSdkHelper.TabControlType.Assembly) // Repeater Control .RegisterAssembly(GorillaSdkHelper.RepeaterControlType.Assembly) // Effects .RegisterAssembly(typeof(UXDivers.Effects.Effects).Assembly) // // FFImageLoading.Transformations .RegisterAssemblyFromType <FFImageLoading.Transformations.BlurredTransformation>() // FFImageLoading.Forms .RegisterAssemblyFromType <FFImageLoading.Forms.CachedImage>() // Grial Application PCL .RegisterAssembly(typeof(RoboScout.App).Assembly) .RegisterAssembly(typeof(Lottie.Forms.AnimationView).Assembly) )); #else LoadApplication(new App()); #endif return(base.FinishedLaunching(app, options)); }
protected override Layout SetupContentLayout() { Layout layout = base.SetupContentLayout(); //challengeTypeIcon = FormsHelper.ConfigureImageButton($"{ challenge.Type.ToString().ToLower() }.png", null, SelectChallengeTypePage.ChallengeTypeIconSize); //_mainLayout.Children.Add(challengeTypeIcon, new Rectangle(0.5, 130 - 50, SelectChallengeTypePage.ChallengeTypeIconSize.Width, SelectChallengeTypePage.ChallengeTypeIconSize.Height), AbsoluteLayoutFlags.XProportional); SetupHintDialog(); //SetupSkip3Dialog(); SetupSkipChallengeLimitDialog(); Grid optionsLayout = new Grid() { Margin = new Thickness(0, 10), //BackgroundColor = Color.Yellow, VerticalOptions = LayoutOptions.FillAndExpand, RowSpacing = 15, }; optionsLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); optionsLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); if (_showActionButtons) { optionsLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); } var row = 0; _clockLabel = new AutoFontSizeLabel() { HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, }; optionsLayout.Children.Add(_clockLabel, 0, row); row++; UpdateClock(); _stopButton = FormsHelper.ConfigureImageButton("stop.png", (s, e) => { StopChallenge(); }); _stopButton.WidthRequest = 100; _stopButton.HorizontalOptions = LayoutOptions.Center; _stopButton.VerticalOptions = LayoutOptions.FillAndExpand; _stopButton.Aspect = Aspect.AspectFit; optionsLayout.Children.Add(_stopButton, 0, row); row++; if (_showActionButtons) { Grid actionButtons = new Grid() { VerticalOptions = LayoutOptions.Center, ColumnSpacing = 10, Margin = new Thickness(0), Padding = new Thickness(0), }; _hintButton = new FrameButton("Pista", (e, s) => ShowHint()) { BackgroundColor = Configuration.Theme.SelectedBackgroundColor, TextColor = Configuration.Theme.SelectedTextColor, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) - 2, //Margin = new Thickness(10, 0), }; if (_challenge.Hint != "") { actionButtons.Children.Add(_hintButton, 0, 0); } _skipButton = new FrameButton("Saltar prueba", (e, s) => SkipChallenge()) { BackgroundColor = Configuration.Theme.SelectedBackgroundColor, TextColor = Configuration.Theme.SelectedTextColor, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)) - 2, //Margin = new Thickness(10, 0), }; actionButtons.Children.Add(_skipButton, 1, 0); optionsLayout.Children.Add(actionButtons, 0, row); row++; } _bottomContent.Children.Add(optionsLayout); /*var grid = new Grid * { * VerticalOptions = LayoutOptions.Fill, * HorizontalOptions = LayoutOptions.Fill, * Padding = new Thickness(0, 0, 0, 0), * BackgroundColor = Color.Transparent, * }; * * grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }); * grid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); * * * grid.Children.Add(new BoxView { Color = Color.Blue }, 0, 0); * grid.Children.Add(layout); * * _mainLayout.Children.Add(grid, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);*/ _bottomContent.Margin = new Thickness(0); _youveGotItDialog = SetupYouveGotItDialog(); _resultSummaryDialog = SetupResultSummaryDialog(); _finalResultSummaryDialog = SetupFinalResultSummaryDialog(); _skip3Dialog = SetupSkip3Dialog(); _noMoreChallengesDialog = SetupnoMoreChallengesDialog(); _mainLayout.Children.Add(_youveGotItDialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); _mainLayout.Children.Add(_resultSummaryDialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); _mainLayout.Children.Add(_finalResultSummaryDialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); _mainLayout.Children.Add(_skip3Dialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); _mainLayout.Children.Add(_noMoreChallengesDialog, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); var grid = new Grid { BackgroundColor = Color.Transparent, RowSpacing = 30 }; var gridButton = new Button { Text = "1!" }; gridButton.VerticalOptions = LayoutOptions.End; gridButton.Clicked += OnImageButtonClicked; var gridButton2 = new Button { Text = "2" }; gridButton2.VerticalOptions = LayoutOptions.End; gridButton2.Clicked += OnImageButtonClicked; var imageButton = new ImageButton { BackgroundColor = Color.Transparent, Padding = 10, Source = "home.png", //HorizontalOptions = LayoutOptions.End, //VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; imageButton.Clicked += OnImageButtonClicked; var imageButton2 = new ImageButton { BackgroundColor = Color.Transparent, Padding = 10, Source = "info.png", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; imageButton2.Clicked += OnImageButtonClicked2; var imageButton3 = new ImageButton { BackgroundColor = Color.Transparent, Padding = 10, Source = "list.png", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; imageButton3.Clicked += OnImageButtonClicked3; var imageButton4 = new ImageButton { BackgroundColor = Color.Transparent, Padding = 10, Source = "person.png", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; imageButton4.Clicked += OnImageButtonClicked4; grid.Children.Add(imageButton, 0, 0); grid.Children.Add(imageButton2, 1, 0); grid.Children.Add(imageButton3, 2, 0); grid.Children.Add(imageButton4, 3, 0); grid.VerticalOptions = LayoutOptions.End; _mainLayout.Children.Add(grid, new Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All); return(layout); }
protected override void OnCreate(Bundle bundle) { // Changing to App's theme since we are OnCreate and we are ready to // "hide" the splash base.Window.RequestFeature(WindowFeatures.ActionBar); base.SetTheme(Resource.Style.AppTheme); FormsAppCompatActivity.ToolbarResource = Resource.Layout.Toolbar; FormsAppCompatActivity.TabLayoutResource = Resource.Layout.Tabs; base.OnCreate(bundle); // Initializing FFImageLoading CachedImageRenderer.Init(enableFastRenderer: false); global::Xamarin.Forms.Forms.Init(this, bundle); UXDivers.Artina.Shared.GrialKit.Init(this, "RoboScout.Droid.GrialLicense"); #if !DEBUG // Reminder to update the project license to production mode before publishing if (!UXDivers.Artina.Shared.License.IsProductionLicense()) { try { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Grial UI Kit Reminder"); alert.SetMessage("Before publishing this App remember to change the license file to PRODUCTION MODE so it doesn't expire."); alert.SetPositiveButton("OK", (sender, e) => { }); var dialog = alert.Create(); dialog.Show(); } catch { } } #endif FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects)); _locale = Resources.Configuration.Locale; ReferenceCalendars(); #if GORILLA LoadApplication( UXDivers.Gorilla.Droid.Player.CreateApplication( this, new UXDivers.Gorilla.Config("Good Gorilla") // Shared.Base .RegisterAssemblyFromType <UXDivers.Artina.Shared.NegateBooleanConverter>() // Shared .RegisterAssemblyFromType <UXDivers.Artina.Shared.CircleImage>() // Tab Control .RegisterAssembly(GorillaSdkHelper.TabControlType.Assembly) // Repeater Control .RegisterAssembly(GorillaSdkHelper.RepeaterControlType.Assembly) // Effects .RegisterAssembly(typeof(UXDivers.Effects.Effects).Assembly) // // FFImageLoading.Transformations .RegisterAssemblyFromType <FFImageLoading.Transformations.BlurredTransformation>() // FFImageLoading.Forms .RegisterAssemblyFromType <FFImageLoading.Forms.CachedImage>() // Grial Application PCL .RegisterAssembly(typeof(RoboScout.App).Assembly) .RegisterAssembly(typeof(Lottie.Forms.AnimationView).Assembly) )); #else LoadApplication(new App()); #endif }
private void tbNewDetailName_Enter(object sender, EventArgs e) { FormsHelper.HideErrorMessage(labelRenameDetailError); }
public static ImageElement FindImageElement(Bitmap smallBmp, double accuracy, IAutomationEngineInstance engine, DateTime timeToEnd, bool isCaptureTest = false) { FormsHelper.HideAllForms(); var lastRecordedTime = DateTime.Now; dynamic element = null; double tolerance = 1.0 - accuracy; Bitmap bigBmp = ImageMethods.Screenshot(); Bitmap smallTestBmp = new Bitmap(smallBmp); Bitmap bigTestBmp = new Bitmap(bigBmp); Graphics bigTestGraphics = Graphics.FromImage(bigTestBmp); BitmapData smallData = smallBmp.LockBits(new Rectangle(0, 0, smallBmp.Width, smallBmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); BitmapData bigData = bigBmp.LockBits(new Rectangle(0, 0, bigBmp.Width, bigBmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb); int smallStride = smallData.Stride; int bigStride = bigData.Stride; int bigWidth = bigBmp.Width; int bigHeight = bigBmp.Height - smallBmp.Height + 1; int smallWidth = smallBmp.Width * 3; int smallHeight = smallBmp.Height; int margin = Convert.ToInt32(255.0 * tolerance); unsafe { byte *pSmall = (byte *)(void *)smallData.Scan0; byte *pBig = (byte *)(void *)bigData.Scan0; int smallOffset = smallStride - smallBmp.Width * 3; int bigOffset = bigStride - bigBmp.Width * 3; bool matchFound = true; for (int y = 0; y < bigHeight; y++) { if (engine != null && engine.IsCancellationPending) { break; } if (engine != null && lastRecordedTime.Second != DateTime.Now.Second) { engine.ReportProgress("Element Not Yet Found... " + (timeToEnd - DateTime.Now).Seconds + "s remain"); lastRecordedTime = DateTime.Now; } if (timeToEnd <= DateTime.Now) { break; } for (int x = 0; x < bigWidth; x++) { byte *pBigBackup = pBig; byte *pSmallBackup = pSmall; //Look for the small picture. for (int i = 0; i < smallHeight; i++) { int j = 0; matchFound = true; for (j = 0; j < smallWidth; j++) { //With tolerance: pSmall value should be between margins. int inf = pBig[0] - margin; int sup = pBig[0] + margin; if (sup < pSmall[0] || inf > pSmall[0]) { matchFound = false; break; } pBig++; pSmall++; } if (!matchFound) { break; } //We restore the pointers. pSmall = pSmallBackup; pBig = pBigBackup; //Next rows of the small and big pictures. pSmall += smallStride * (1 + i); pBig += bigStride * (1 + i); } //If match found, we return. if (matchFound) { element = new ImageElement { LeftX = x, MiddleX = x + smallBmp.Width / 2, RightX = x + smallBmp.Width, TopY = y, MiddleY = y + smallBmp.Height / 2, BottomY = y + smallBmp.Height }; if (isCaptureTest) { element.SmallTestImage = smallTestBmp; element.BigTestImage = bigTestBmp; } break; } //If no match found, we restore the pointers and continue. else { pBig = pBigBackup; pSmall = pSmallBackup; pBig += 3; } } if (matchFound) { break; } pBig += bigOffset; } } bigBmp.UnlockBits(bigData); smallBmp.UnlockBits(smallData); bigTestGraphics.Dispose(); return(element); }
private void scraperBackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Cancelled == true) { MessageBox.Show("Successfully halted scraping at " + lblScrapingProgress.Text, "Cancelled Scraping", MessageBoxButtons.OK, FormsHelper.SelectIcon(Enums.ResultTypes.NoAction)); lblScrapingProgress.Text = "Canceled!"; } else if (e.Error != null) { MessageBox.Show("An error occurred while scraping, stopping at " + lblScrapingProgress.Text + Environment.NewLine + e.Error.Message, "Error while Scraping", MessageBoxButtons.OK, FormsHelper.SelectIcon(Enums.ResultTypes.Error)); lblScrapingProgress.Text = "Error"; } else { ResultModel resultModel = (ResultModel)e.Result; MessageBox.Show(resultModel.Data, resultModel.Result.ToName(), MessageBoxButtons.OK, FormsHelper.SelectIcon(resultModel.Result)); lblScrapingProgress.Text = "Done!"; } btnTestScrape.Enabled = true; btnCancelScraping.Enabled = false; }
protected void ASPxMenu1_ItemClick(object source, DevExpress.Web.ASPxMenu.MenuItemEventArgs e) { try { switch (e.Item.Name) { case "btnAdd": FormsHelper.ClearControls(tblControls, new DTO.MonedasDTO()); FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Add); TipoCambio = new List <DTO.TipoCambioDTO>(); RefreshAbmGrid(gvABM); pnlControls.Visible = true; pnlControls.HeaderText = "Agregar Registro"; trDias.Visible = true; break; case "btnEdit": if (FormsHelper.GetSelectedId(gv) != null) { FormsHelper.ClearControls(tblControls, new DTO.MonedasDTO()); var entity = Business.Monedas.Read(FormsHelper.GetSelectedId(gv).Value); FormsHelper.FillControls(entity, tblControls); FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Edit); TipoCambio = Business.Monedas.ReadAllTiposCambio((string)entity.IdentifMon); spDuracion0.Value = null; deVigDesde0.Value = DateTime.Now; gvABM.Attributes.Add("IdentifMon", entity.IdentifMon); trDias.Visible = true; RefreshAbmGrid(gvABM); pnlControls.Attributes.Add("RecId", entity.RecId.ToString()); pnlControls.Visible = true; pnlControls.HeaderText = "Modificar Registro"; } else { pnlControls.Visible = false; } break; case "btnDelete": if (FormsHelper.GetSelectedId(gv) != null) { FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Delete); pnlControls.Attributes.Add("RecId", FormsHelper.GetSelectedId(gv).ToString()); pnlControls.Visible = true; pnlControls.HeaderText = "Eliminar Registros"; } else { pnlControls.Visible = false; } break; case "btnExport": case "btnExportXls": if (ASPxGridViewExporter1 != null) { ASPxGridViewExporter1.WriteXlsToResponse(); } break; case "btnExportPdf": if (ASPxGridViewExporter1 != null) { ASPxGridViewExporter1.WritePdfToResponse(); } break; default: break; } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
public async static Task <bool> DetermineStatementTruth(IAutomationEngineInstance engine, string ifActionType, DataTable IfActionParameterTable, string condition = "false") { bool ifResult = false; if (ifActionType == null) { ifResult = (bool)await condition.EvaluateCode(engine); } else { switch (ifActionType) { case "Number Compare": string num1 = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Number1" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string numOperand = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Operand" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string num2 = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Number2" select rw.Field <string>("Parameter Value")).FirstOrDefault()); var cdecValue1 = Convert.ToDecimal(await num1.EvaluateCode(engine)); var cdecValue2 = Convert.ToDecimal(await num2.EvaluateCode(engine)); switch (numOperand) { case "is equal to": ifResult = cdecValue1 == cdecValue2; break; case "is not equal to": ifResult = cdecValue1 != cdecValue2; break; case "is greater than": ifResult = cdecValue1 > cdecValue2; break; case "is greater than or equal to": ifResult = cdecValue1 >= cdecValue2; break; case "is less than": ifResult = cdecValue1 < cdecValue2; break; case "is less than or equal to": ifResult = cdecValue1 <= cdecValue2; break; } break; case "Date Compare": string date1 = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Date1" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string dateOperand = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Operand" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string date2 = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Date2" select rw.Field <string>("Parameter Value")).FirstOrDefault()); var dt1 = (DateTime)await date1.EvaluateCode(engine); var dt2 = (DateTime)await date2.EvaluateCode(engine); switch (dateOperand) { case "is equal to": ifResult = dt1 == dt2; break; case "is not equal to": ifResult = dt1 != dt2; break; case "is greater than": ifResult = dt1 > dt2; break; case "is greater than or equal to": ifResult = dt1 >= dt2; break; case "is less than": ifResult = dt1 < dt2; break; case "is less than or equal to": ifResult = dt1 <= dt2; break; } break; case "Text Compare": string text1 = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Text1" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string textOperand = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Operand" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string text2 = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Text2" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string caseSensitive = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Case Sensitive" select rw.Field <string>("Parameter Value")).FirstOrDefault()); text1 = (string)await text1.EvaluateCode(engine); text2 = (string)await text2.EvaluateCode(engine); if (caseSensitive == "No") { text1 = text1.ToUpper(); text2 = text2.ToUpper(); } switch (textOperand) { case "contains": ifResult = text1.Contains(text2); break; case "does not contain": ifResult = !text1.Contains(text2); break; case "is equal to": ifResult = text1 == text2; break; case "is not equal to": ifResult = text1 != text2; break; } break; case "Has Value": string variableName = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Variable Name" select rw.Field <string>("Parameter Value")).FirstOrDefault()); dynamic actualVariable = variableName.EvaluateCode(engine); if (actualVariable.Result != null) { ifResult = true; } else { ifResult = false; } break; case "Is Numeric": string isNumericVariableName = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Variable Name" select rw.Field <string>("Parameter Value")).FirstOrDefault()); ifResult = decimal.TryParse((await isNumericVariableName.EvaluateCode(engine)).ToString(), out decimal decimalResult); break; case "Error Occured": //get line number string userLineNumber = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Line Number" select rw.Field <string>("Parameter Value")).FirstOrDefault()); //convert to int int lineNumber = (int)await userLineNumber.EvaluateCode(engine); //determine if error happened if (engine.ErrorsOccured.Where(f => f.LineNumber == lineNumber).Count() > 0) { var error = engine.ErrorsOccured.Where(f => f.LineNumber == lineNumber).FirstOrDefault(); error.ErrorMessage.SetVariableValue(engine, "Error.Message"); error.LineNumber.ToString().SetVariableValue(engine, "Error.Line"); error.StackTrace.SetVariableValue(engine, "Error.StackTrace"); ifResult = true; } else { ifResult = false; } break; case "Error Did Not Occur": //get line number string userLineNumber2 = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Line Number" select rw.Field <string>("Parameter Value")).FirstOrDefault()); //convert to int int lineNumber2 = (int)await userLineNumber2.EvaluateCode(engine); //determine if error happened if (engine.ErrorsOccured.Where(f => f.LineNumber == lineNumber2).Count() == 0) { ifResult = true; } else { var error = engine.ErrorsOccured.Where(f => f.LineNumber == lineNumber2).FirstOrDefault(); error.ErrorMessage.SetVariableValue(engine, "Error.Message"); error.LineNumber.ToString().SetVariableValue(engine, "Error.Line"); error.StackTrace.SetVariableValue(engine, "Error.StackTrace"); ifResult = false; } break; case "Window Name Exists": //get user supplied name string windowName = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Window Name" select rw.Field <string>("Parameter Value")).FirstOrDefault()); //variable translation string variablizedWindowName = (string)await windowName.EvaluateCode(engine); //search for window IntPtr windowPtr = User32Functions.FindWindow(variablizedWindowName); //conditional if (windowPtr != IntPtr.Zero) { ifResult = true; } break; case "Active Window Name Is": string activeWindowName = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Window Name" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string variablizedActiveWindowName = (string)await activeWindowName.EvaluateCode(engine); var currentWindowTitle = User32Functions.GetActiveWindowTitle(); if (currentWindowTitle == variablizedActiveWindowName) { ifResult = true; } break; case "File Exists": string fileName = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "File Path" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string trueWhenFileExists = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "True When" select rw.Field <string>("Parameter Value")).FirstOrDefault()); var userFileSelected = (string)await fileName.EvaluateCode(engine); bool fileExistCheck = false; if (trueWhenFileExists == "It Does Exist") { fileExistCheck = true; } if (File.Exists(userFileSelected) == fileExistCheck) { ifResult = true; } break; case "Folder Exists": string folderName = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Folder Path" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string trueWhenFolderExists = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "True When" select rw.Field <string>("Parameter Value")).FirstOrDefault()); var userFolderSelected = (string)await folderName.EvaluateCode(engine); bool folderExistCheck = false; if (trueWhenFolderExists == "It Does Exist") { folderExistCheck = true; } if (Directory.Exists(userFolderSelected) == folderExistCheck) { ifResult = true; } break; case "Selenium Web Element Exists": string instanceName = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Selenium Instance Name" select rw.Field <string>("Parameter Value")).FirstOrDefault()); OBAppInstance instance = (OBAppInstance)await instanceName.EvaluateCode(engine); string parameterName = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Element Search Parameter" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string searchMethod = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Element Search Method" select rw.Field <string>("Parameter Value")).FirstOrDefault()); string timeoutStr = ((from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Timeout (Seconds)" select rw.Field <string>("Parameter Value")).FirstOrDefault()); int timeout = (int)await timeoutStr.EvaluateCode(engine); string trueWhenElementExists = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "True When" select rw.Field <string>("Parameter Value")).FirstOrDefault(); bool elementExists = await ElementExists(engine, instance, searchMethod, parameterName, "Find Element", timeout); ifResult = elementExists; if (trueWhenElementExists == "It Does Not Exist") { ifResult = !ifResult; } break; case "GUI Element Exists": string guiWindowName = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Window Name" select rw.Field <string>("Parameter Value")).FirstOrDefault(); windowName = (string)await guiWindowName.EvaluateCode(engine); string elementSearchParam = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Element Search Parameter" select rw.Field <string>("Parameter Value")).FirstOrDefault(); elementSearchParam = (string)await elementSearchParam.EvaluateCode(engine); string elementSearchMethod = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Element Search Method" select rw.Field <string>("Parameter Value")).FirstOrDefault(); elementSearchMethod = (string)await elementSearchMethod.EvaluateCode(engine); string trueWhenGUIElementExists = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "True When" select rw.Field <string>("Parameter Value")).FirstOrDefault(); string timeoutString = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Timeout (Seconds)" select rw.Field <string>("Parameter Value")).FirstOrDefault(); //set up search parameter table var uiASearchParameters = new DataTable(); uiASearchParameters.Columns.Add("Enabled"); uiASearchParameters.Columns.Add("Parameter Name"); uiASearchParameters.Columns.Add("Parameter Value"); uiASearchParameters.Rows.Add(true, elementSearchMethod, elementSearchParam); int vTimeout = (int)await timeoutString.EvaluateCode(engine); AutomationElement handle = null; var timeToEnd = DateTime.Now.AddSeconds(vTimeout); while (timeToEnd >= DateTime.Now) { try { handle = await SearchForGUIElement(engine, uiASearchParameters, windowName); break; } catch (Exception) { engine.ReportProgress("Element Not Yet Found... " + (timeToEnd - DateTime.Now).Seconds + "s remain"); Thread.Sleep(500); } } if (handle is null) { ifResult = false; } else { ifResult = true; } if (trueWhenGUIElementExists == "It Does Not Exist") { ifResult = !ifResult; } break; case "Image Element Exists": string imageName = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Captured Image Variable" select rw.Field <string>("Parameter Value")).FirstOrDefault(); string accuracyString; double accuracy; try { accuracyString = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Accuracy (0-1)" select rw.Field <string>("Parameter Value")).FirstOrDefault(); accuracy = (double)await accuracyString.EvaluateCode(engine); if (accuracy > 1 || accuracy < 0) { throw new ArgumentOutOfRangeException("Accuracy value is out of range (0-1)"); } } catch (Exception) { throw new InvalidDataException("Accuracy value is invalid"); } string trueWhenImageExists = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "True When" select rw.Field <string>("Parameter Value")).FirstOrDefault(); var capturedImage = (Bitmap)await imageName.EvaluateCode(engine); string imageTimeoutString = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Timeout (Seconds)" select rw.Field <string>("Parameter Value")).FirstOrDefault(); int imageTimeout = (int)await imageTimeoutString.EvaluateCode(engine); var element = FindImageElement(capturedImage, accuracy, engine, DateTime.Now.AddSeconds(imageTimeout)); FormsHelper.ShowAllForms(engine.EngineContext.IsDebugMode); if (element != null) { ifResult = true; } else { ifResult = false; } if (trueWhenImageExists == "It Does Not Exist") { ifResult = !ifResult; } break; case "App Instance Exists": string appInstanceName = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Instance Name" select rw.Field <string>("Parameter Value")).FirstOrDefault(); string trueWhenAppInstanceExists = (from rw in IfActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "True When" select rw.Field <string>("Parameter Value")).FirstOrDefault(); var appInstanceObj = (OBAppInstance)await appInstanceName.EvaluateCode(engine); if (appInstanceObj == null) { ifResult = false; } else { ifResult = appInstanceObj.Value.InstanceExists(); } if (trueWhenAppInstanceExists == "It Does Not Exist") { ifResult = !ifResult; } break; default: throw new Exception("If type not recognized!"); } } return(ifResult); }
private void ImportJobForm_Load(object sender, EventArgs e) { Cancelled = false; //Few changes based on form mode (create or edit) Text = ImportJobDetail == null ? Resources.Add_import_job : string.Format(Resources.Edit_job_0, ImportJobDetail.Key.Name); addToolStripButton.Text = ImportJobDetail == null ? Resources.Add_to_schedule : Resources.Edit_job; jobName.Enabled = ImportJobDetail == null; jobGroupComboBox.DataSource = Properties.Settings.Default.JobGroups; jobGroupComboBox.ValueMember = null; jobGroupComboBox.DisplayMember = "Name"; jobGroupComboBox.Enabled = ImportJobDetail == null; instanceComboBox.DataSource = Properties.Settings.Default.Instances; instanceComboBox.ValueMember = null; instanceComboBox.DisplayMember = "Name"; appRegistrationComboBox.DataSource = Properties.Settings.Default.AadApplications.Where(x => x.AuthenticationType == AuthenticationType.User).ToList(); appRegistrationComboBox.ValueMember = null; appRegistrationComboBox.DisplayMember = "Name"; userComboBox.DataSource = Properties.Settings.Default.Users; userComboBox.ValueMember = null; userComboBox.DisplayMember = "Login"; orderByComboBox.DataSource = Enum.GetValues(typeof(OrderByOptions)); importJobStartAtDateTimePicker.Value = DateTime.Now; monitoringJobStartAtDateTimePicker.Value = DateTime.Now; inputFolderTextBox.Text = Properties.Settings.Default.UploadInputFolder; uploadSuccessFolderTextBox.Text = Properties.Settings.Default.UploadSuccessFolder; uploadErrorsFolderTextBox.Text = Properties.Settings.Default.UploadErrorsFolder; processingSuccessFolderTextBox.Text = Properties.Settings.Default.ProcessingSuccessFolder; processingErrorsFolderTextBox.Text = Properties.Settings.Default.ProcessingErrorsFolder; importFromPackageTextBox.Text = PackageApiActions.ImportFromPackageActionPath; getAzureWriteUrlTextBox.Text = PackageApiActions.GetAzureWriteUrlActionPath; getExecutionSummaryStatusTextBox.Text = PackageApiActions.GetExecutionSummaryStatusActionPath; getExecutionSummaryPageUrlTextBox.Text = PackageApiActions.GetExecutionSummaryPageUrlActionPath; getImportTargetErrorKeysFileUrlTextBox.Text = PackageApiActions.GetImportTargetErrorKeysFileUrlPath; generateImportTargetErrorKeysFileTextBox.Text = PackageApiActions.GenerateImportTargetErrorKeysFilePath; getExecutionErrorsTextBox.Text = PackageApiActions.GetExecutionErrorsPath; if (ImportJobDetail != null) { jobName.Text = ImportJobDetail.Key.Name; var jobGroup = ((IEnumerable <JobGroup>)jobGroupComboBox.DataSource).FirstOrDefault(x => x.Name == ImportJobDetail.Key.Group); jobGroupComboBox.SelectedItem = jobGroup; jobDescription.Text = ImportJobDetail.Description; useStandardSubfolder.Checked = false; inputFolderTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.InputDir); uploadSuccessFolderTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.UploadSuccessDir); uploadErrorsFolderTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.UploadErrorsDir); packageTemplateTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.PackageTemplate); legalEntityTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.Company); statusFileExtensionTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.StatusFileExtension); dataProject.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.DataProject); overwriteDataProjectCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.OverwriteDataProject); executeImportCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.ExecuteImport); delayBetweenFilesNumericUpDown.Value = ImportJobDetail.JobDataMap.GetInt(SettingsConstants.DelayBetweenFiles); serviceAuthRadioButton.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.UseServiceAuthentication); if (!serviceAuthRadioButton.Checked) { User axUser = null; if (!ImportJobDetail.JobDataMap.GetString(SettingsConstants.UserName).IsNullOrWhiteSpace()) { axUser = ((IEnumerable <User>)userComboBox.DataSource).FirstOrDefault(x => x.Login == ImportJobDetail.JobDataMap.GetString(SettingsConstants.UserName)); } if (axUser == null) { axUser = new User { Login = ImportJobDetail.JobDataMap.GetString(SettingsConstants.UserName), Password = ImportJobDetail.JobDataMap.GetString(SettingsConstants.UserPassword) }; Properties.Settings.Default.Users.Add(axUser); userComboBox.DataSource = Properties.Settings.Default.Users; } userComboBox.SelectedItem = axUser; } var application = ((IEnumerable <AadApplication>)appRegistrationComboBox.DataSource).FirstOrDefault(app => app.ClientId == ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadClientId)); if (application == null) { if (!serviceAuthRadioButton.Checked) { application = new AadApplication { ClientId = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadClientId) ?? Guid.Empty.ToString(), Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}", AuthenticationType = AuthenticationType.User }; } else { application = new AadApplication { ClientId = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadClientId) ?? Guid.Empty.ToString(), Secret = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadClientSecret) ?? String.Empty, Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}", AuthenticationType = AuthenticationType.Service }; } Properties.Settings.Default.AadApplications.Add(application); appRegistrationComboBox.DataSource = Properties.Settings.Default.AadApplications; } appRegistrationComboBox.SelectedItem = application; var axInstance = ((IEnumerable <Instance>)instanceComboBox.DataSource).FirstOrDefault(x => (x.AosUri == ImportJobDetail.JobDataMap.GetString(SettingsConstants.AosUri)) && (x.AadTenant == ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadTenant)) && (x.AzureAuthEndpoint == ImportJobDetail.JobDataMap.GetString(SettingsConstants.AzureAuthEndpoint))); if (axInstance == null) { axInstance = new Instance { AosUri = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AosUri), AadTenant = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AadTenant), AzureAuthEndpoint = ImportJobDetail.JobDataMap.GetString(SettingsConstants.AzureAuthEndpoint), UseADAL = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.UseADAL), Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}" }; Properties.Settings.Default.Instances.Add(axInstance); instanceComboBox.DataSource = Properties.Settings.Default.Instances; } instanceComboBox.SelectedItem = axInstance; searchPatternTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.SearchPattern) ?? "*.*"; orderByComboBox.DataSource = Enum.GetValues(typeof(OrderByOptions)); var selectedOrderBy = OrderByOptions.FileName; if (!ImportJobDetail.JobDataMap.GetString(SettingsConstants.OrderBy).IsNullOrWhiteSpace()) { selectedOrderBy = (OrderByOptions)Enum.Parse(typeof(OrderByOptions), ImportJobDetail.JobDataMap.GetString(SettingsConstants.OrderBy)); } orderByComboBox.SelectedItem = selectedOrderBy; orderDescendingRadioButton.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.ReverseOrder); inputFilesArePackagesCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.InputFilesArePackages); pauseIndefinitelyCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.IndefinitePause); if (ImportTrigger.GetType() == typeof(SimpleTriggerImpl)) { var localTrigger = (SimpleTriggerImpl)ImportTrigger; importJobSimpleTriggerRadioButton.Checked = true; importJobHoursDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; importJobMinutesDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; importJobStartAtDateTimePicker.Value = localTrigger.StartTimeUtc.UtcDateTime.ToLocalTime(); } else if (ImportTrigger.GetType() == typeof(CronTriggerImpl)) { var localTrigger = (CronTriggerImpl)ImportTrigger; importJobCronTriggerRadioButton.Checked = true; importJobCronExpressionTextBox.Text = localTrigger.CronExpressionString; } retriesCountUpDown.Value = ImportJobDetail.JobDataMap.GetInt(SettingsConstants.RetryCount); retriesDelayUpDown.Value = ImportJobDetail.JobDataMap.GetInt(SettingsConstants.RetryDelay); pauseOnExceptionsCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.PauseJobOnException); importFromPackageTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.ImportFromPackageActionPath) ?? PackageApiActions.ImportFromPackageActionPath; getAzureWriteUrlTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.GetAzureWriteUrlActionPath) ?? PackageApiActions.GetAzureWriteUrlActionPath; multicompanyCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.MultiCompanyImport); getLegalEntityFromFilenameRadioButton.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.GetLegalEntityFromFilename); filenameSeparatorTextBox.Text = ImportJobDetail.JobDataMap.GetString(SettingsConstants.FilenameSeparator); legalEntityTokenPositionNumericUpDown.Value = ImportJobDetail.JobDataMap.GetInt(SettingsConstants.LegalEntityTokenPosition); verboseLoggingCheckBox.Checked = ImportJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.LogVerbose); Properties.Settings.Default.Save(); } if ((ExecutionJobDetail != null) && (ExecutionTrigger != null)) { useMonitoringJobCheckBox.Checked = true; processingSuccessFolderTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.ProcessingSuccessDir); processingErrorsFolderTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.ProcessingErrorsDir); if (ExecutionTrigger.GetType() == typeof(SimpleTriggerImpl)) { var localTrigger = (SimpleTriggerImpl)ExecutionTrigger; monitoringJobSimpleTriggerRadioButton.Checked = true; monitoringJobHoursDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; monitoringJobMinutesDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; monitoringJobStartAtDateTimePicker.Value = localTrigger.StartTimeUtc.UtcDateTime.ToLocalTime(); } else if (ExecutionTrigger.GetType() == typeof(CronTriggerImpl)) { var localTrigger = (CronTriggerImpl)ExecutionTrigger; monitoringJobCronTriggerRadioButton.Checked = true; monitoringJobCronExpressionTextBox.Text = localTrigger.CronExpressionString; } getExecutionSummaryStatusTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GetExecutionSummaryStatusActionPath) ?? PackageApiActions.GetExecutionSummaryStatusActionPath; getExecutionSummaryPageUrlTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GetExecutionSummaryPageUrlActionPath) ?? PackageApiActions.GetExecutionSummaryPageUrlActionPath; getImportTargetErrorKeysFileUrlTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GetImportTargetErrorKeysFileUrlPath) ?? PackageApiActions.GetImportTargetErrorKeysFileUrlPath; generateImportTargetErrorKeysFileTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GenerateImportTargetErrorKeysFilePath) ?? PackageApiActions.GenerateImportTargetErrorKeysFilePath; getExecutionErrorsTextBox.Text = ExecutionJobDetail.JobDataMap.GetString(SettingsConstants.GetExecutionErrorsPath) ?? PackageApiActions.GetExecutionErrorsPath; downloadErrorKeysFileCheckBox.Checked = ExecutionJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.GetImportTargetErrorKeysFile); getExecutionErrorsCheckBox.Checked = ExecutionJobDetail.JobDataMap.GetBooleanValue(SettingsConstants.GetExecutionErrors); statusCheckDelayNumericUpDown.Value = ExecutionJobDetail.JobDataMap.GetInt(SettingsConstants.DelayBetweenStatusCheck); } FormsHelper.SetDropDownsWidth(this); }
private bool ValidateJobSettings() { if (importJobCronTriggerRadioButton.Checked) { var date = FormsHelper.GetScheduleForCron(importJobCronExpressionTextBox.Text, DateTimeOffset.Now); if (date == DateTimeOffset.MinValue) { return(false); } } if (useMonitoringJobCheckBox.Checked && monitoringJobCronTriggerRadioButton.Checked) { var date = FormsHelper.GetScheduleForCron(monitoringJobCronExpressionTextBox.Text, DateTimeOffset.Now); if (date == DateTimeOffset.MinValue) { return(false); } } var message = new StringBuilder(); if (string.IsNullOrEmpty(jobName.Text)) { message.AppendLine(Resources.Job_name_is_missing); } if ((jobGroupComboBox.SelectedItem == null) || string.IsNullOrEmpty(jobGroupComboBox.Text)) { message.AppendLine(Resources.Job_group_is_not_selected); } if (string.IsNullOrEmpty(topFolderTextBox.Text) && useStandardSubfolder.Checked) { message.AppendLine(Resources.Top_uploads_folder_is_not_selected); } if (string.IsNullOrEmpty(inputFolderTextBox.Text)) { message.AppendLine(Resources.Input_folder_is_not_selected); } if (string.IsNullOrEmpty(uploadSuccessFolderTextBox.Text)) { message.AppendLine(Resources.Upload_success_folder_is_not_selected); } if (string.IsNullOrEmpty(uploadErrorsFolderTextBox.Text)) { message.AppendLine(Resources.Upload_errors_folder_is_not_selected); } if (string.IsNullOrEmpty(processingSuccessFolderTextBox.Text) && useMonitoringJobCheckBox.Checked) { message.AppendLine(Resources.Processing_success_folder_is_not_selected); } if (string.IsNullOrEmpty(processingErrorsFolderTextBox.Text) && useMonitoringJobCheckBox.Checked) { message.AppendLine(Resources.Processing_errors_folder_is_not_selected); } if (!multicompanyCheckBox.Checked && string.IsNullOrEmpty(legalEntityTextBox.Text)) { message.AppendLine(Resources.Legal_entity_is_missing); } if (string.IsNullOrEmpty(dataProject.Text)) { message.AppendLine(Resources.Data_project_is_missing); } if ((instanceComboBox.SelectedItem == null) || string.IsNullOrEmpty(instanceComboBox.Text)) { message.AppendLine(Resources.Dynamics_instance_is_not_selected); } if (userAuthRadioButton.Checked && ((userComboBox.SelectedItem == null) || string.IsNullOrEmpty(userComboBox.Text))) { message.AppendLine(Resources.User_is_not_selected); } if ((appRegistrationComboBox.SelectedItem == null) || string.IsNullOrEmpty(appRegistrationComboBox.Text)) { message.AppendLine(Resources.AAD_client_application_is_not_selected); } if (string.IsNullOrEmpty(statusFileExtensionTextBox.Text) && useMonitoringJobCheckBox.Checked) { message.AppendLine(Resources.Status_file_extension_is_not_specified); } if (!inputFilesArePackagesCheckBox.Checked && string.IsNullOrEmpty(packageTemplateTextBox.Text)) { message.AppendLine(Resources.Package_template_is_missing); } if (multicompanyCheckBox.Checked && getLegalEntityFromFilenameRadioButton.Checked) { if (string.IsNullOrEmpty(filenameSeparatorTextBox.Text)) { message.AppendLine(Resources.Filename_separator_is_missing); } } if (string.IsNullOrEmpty(getAzureWriteUrlTextBox.Text)) { message.AppendLine(Resources.URL_for_GetAzureWriteUrl_action_is_missing); } if (string.IsNullOrEmpty(importFromPackageTextBox.Text)) { message.AppendLine(Resources.URL_for_ImportFromPackage_action_is_missing); } if (string.IsNullOrEmpty(getExecutionSummaryStatusTextBox.Text)) { message.AppendLine(Resources.URL_for_GetExecutionSummaryStatus_action_is_missing); } if (string.IsNullOrEmpty(getExecutionSummaryPageUrlTextBox.Text)) { message.AppendLine(Resources.URL_for_GetExecutionSummaryPageUrl_action_is_missing); } if (string.IsNullOrEmpty(getImportTargetErrorKeysFileUrlTextBox.Text)) { message.AppendLine(Resources.URL_for_GetImportTargetErrorKeysFileUrl_action_is_missing); } if (string.IsNullOrEmpty(generateImportTargetErrorKeysFileTextBox.Text)) { message.AppendLine(Resources.URL_for_GenerateImportTargetErrorKeysFile_action_is_missing); } if (string.IsNullOrEmpty(getExecutionErrorsTextBox.Text)) { message.AppendLine(Resources.URL_for_GetExecutionErrors_action_is_missing); } if (message.Length > 0) { MessageBox.Show(message.ToString(), Resources.Job_configuration_is_not_valid); } return(message.Length == 0); }
private void Extras_Shown(object sender, EventArgs e) { FormsHelper.NudgeOnScreen(this); }
protected override Layout SetupContentLayout() { BackgroundColor = Configuration.Theme.BackgroundColor; Grid mainLayout = new Grid(); StackLayout contentLayout = new StackLayout() { Padding = new Thickness(20, 100), VerticalOptions = LayoutOptions.Start, }; //contentLayout.Children.Add(new Label() //{ // Text = "Escanea el código QR de tu invitación", // FontSize = Configuration.Theme.BigFontSize, // TextColor = Configuration.Theme.TextColor, // HorizontalTextAlignment = TextAlignment.Center, //}); //contentLayout.Children.Add(new Image { Source = "logo__new.png" }); contentLayout.Children.Add(new Label() { Text = "Introduce el código que se te ha enviado por email y escribe tu nombre de usuario", FontSize = Configuration.Theme.SmallFontSize, TextColor = Configuration.Theme.TextColor, VerticalTextAlignment = TextAlignment.Start, HorizontalTextAlignment = TextAlignment.Center, }); Grid introduceCodeLayout = new Grid() { Padding = new Thickness(10), Margin = new Thickness(10, 5, 10, 5), }; introduceCodeLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) }); introduceCodeLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(10, GridUnitType.Absolute) }); introduceCodeLayout.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); _codeEntry = new Entry() { //BackgroundColor = Configuration.Theme.SecondaryBackgroundColor, FontSize = Configuration.Theme.MediumFontSize, TextColor = Configuration.Theme.TextColor, }; introduceCodeLayout.Children.Add(_codeEntry, 0, 0); introduceCodeLayout.Children.Add(FormsHelper.ConfigureImageButton("settings.png", (e, s) => { return; }, new Size(4, 4), true, Assembly.GetCallingAssembly()), 2, 0); contentLayout.Children.Add(introduceCodeLayout); Grid introduceCodeLayout2 = new Grid() { Margin = new Thickness(10, 5, 10, 5), Padding = new Thickness(10), }; introduceCodeLayout2.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5, GridUnitType.Star) }); introduceCodeLayout2.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(10, GridUnitType.Absolute) }); introduceCodeLayout2.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); _codeEntry2 = new Entry() { //BackgroundColor = Configuration.Theme.SecondaryBackgroundColor, FontSize = Configuration.Theme.MediumFontSize, TextColor = Configuration.Theme.TextColor, }; introduceCodeLayout2.Children.Add(_codeEntry2, 0, 0); introduceCodeLayout2.Children.Add(FormsHelper.ConfigureImageButton("person.png", (e, s) => { return; }, new Size(4, 4), true, Assembly.GetCallingAssembly()), 2, 0); contentLayout.Children.Add(introduceCodeLayout2); EventHandler scanButtonAction = (sender, e) => { /* * var emailPattern = @"^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$"; * if (Regex.IsMatch(email, emailPattern)) * { * ErrorLabel.Text = "Email is valid"; * } * else * { * ErrorLabel.Text = "EMail is InValid"; * } */ var code_Input = _codeEntry.Text; var name_Input = _codeEntry2.Text; if (code_Input == null) { DisplayAlert("Cuidado", "Entra un código válido o consulte con su médico", "ok"); } else if (name_Input == null) { DisplayAlert("Falta un campo", "Rellena el campo con un nombre de referencia.", "Rellenar"); /*var answer = await DisplayAlert("Exit", "Do you wan't to exit the App?", "Yes", "No"); * if(answer) * { * _canClose = false; * OnBackButtonPressed; * }*/ } else { _configuration.SaveProperty("name", name_Input); _configuration.SaveProperty("docId", code_Input); CheckCode(_codeEntry.Text); _codeEntry.Text = string.Empty; _codeEntry2.Text = string.Empty; } /*if (!string.IsNullOrWhiteSpace(_codeEntry.Text) && !string.IsNullOrWhiteSpace(_codeEntry2.Text)) * { * firebaseHelper.AddPerson(Convert.ToInt32(_codeEntry.Text.Substring(5)), _codeEntry2.Text, _codeEntry.Text); * DisplayAlert("Success", "Person Added Successfully", "OK"); * var allPersons = firebaseHelper.GetAllPersons(); * //lstPersons.ItemsSource = allPersons; * CheckCode(_codeEntry.Text); * _codeEntry.Text = string.Empty; * _codeEntry2.Text = string.Empty; * } * else * { * DisplayAlert("Alert", "Consulta a tu médico para que te de un código o rellena el campo de nombre.", "OK"); * }*/ }; var scanButton = new FrameButton("Acceder", scanButtonAction) { Margin = new Thickness(40), BackgroundColor = Configuration.Theme.SelectedBackgroundColor, FontSize = Configuration.Theme.SmallFontSize, TextColor = Color.White, }; contentLayout.Children.Add(scanButton); mainLayout.Children.Add(contentLayout); _dialog = new Dialog(new Size(300, 300)) { Content = new Label() { Text = "Código incorrecto. Vuelva a intentarlo o comuníquese con el organizador.", FontSize = Configuration.Theme.MediumFontSize, TextColor = Configuration.Theme.TextColor, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Center, LineBreakMode = LineBreakMode.WordWrap, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, MaxLines = 10, }, DialogBackgroundColor = Configuration.Theme.SecondaryBackgroundColor, DialogSize = new Size(300, 300), DialogHeight = 300, }; mainLayout.Children.Add(_dialog); return(mainLayout); }
protected override void OnCreate(Bundle bundle) { try { ToolbarResource = Resource.Layout.Toolbar; TabLayoutResource = Resource.Layout.Tabs; base.OnCreate(bundle); App.ScreenWidth = (int)((int)Resources.DisplayMetrics.WidthPixels / Resources.DisplayMetrics.Density); // real pixels App.ScreenHeight = (int)((int)Resources.DisplayMetrics.HeightPixels / Resources.DisplayMetrics.Density); // real pixels // Required for proper Push notifications handling var setupSingleton = MvxAndroidSetupSingleton.EnsureSingletonAvailable(ApplicationContext); setupSingleton.EnsureInitialized(); global::Xamarin.Forms.Forms.Init(this, bundle); Xamarin.FormsMaps.Init(this, bundle); GrialKit.Init(this, "Bullytect.Droid.GrialLicense"); // Presenters Initialization global::Xamarin.Auth.Presenters.XamarinAndroid.AuthenticationConfiguration.Init(this, bundle); // Xamarin.Auth CustomTabs Initialization/Customisation global::Xamarin.Auth.CustomTabsConfiguration.ActionLabel = null; global::Xamarin.Auth.CustomTabsConfiguration.MenuItemTitle = null; global::Xamarin.Auth.CustomTabsConfiguration.AreAnimationsUsed = true; global::Xamarin.Auth.CustomTabsConfiguration.IsShowTitleUsed = false; global::Xamarin.Auth.CustomTabsConfiguration.IsUrlBarHidingUsed = false; global::Xamarin.Auth.CustomTabsConfiguration.IsCloseButtonIconUsed = false; global::Xamarin.Auth.CustomTabsConfiguration.IsActionButtonUsed = false; global::Xamarin.Auth.CustomTabsConfiguration.IsActionBarToolbarIconUsed = false; global::Xamarin.Auth.CustomTabsConfiguration.IsDefaultShareMenuItemUsed = false; global::Android.Graphics.Color color_xamarin_blue; color_xamarin_blue = new global::Android.Graphics.Color(0x34, 0x98, 0xdb); global::Xamarin.Auth.CustomTabsConfiguration.ToolbarColor = color_xamarin_blue; // ActivityFlags for tweaking closing of CustomTabs // please report findings! global::Xamarin.Auth.CustomTabsConfiguration. ActivityFlags = global::Android.Content.ActivityFlags.NoHistory | global::Android.Content.ActivityFlags.SingleTop | global::Android.Content.ActivityFlags.NewTask ; global::Xamarin.Auth.CustomTabsConfiguration.IsWarmUpUsed = true; global::Xamarin.Auth.CustomTabsConfiguration.IsPrefetchUsed = true; UserDialogs.Init(this); PullToRefreshLayoutRenderer.Init(); XFGloss.Droid.Library.Init(this, bundle); //Initializing FFImageLoading CachedImageRenderer.Init(); CarouselViewRenderer.Init(); FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects)); LoadApplication(FormsApplication); FirebasePushNotificationManager.ProcessIntent(Intent); System.Diagnostics.Debug.WriteLine("Token: " + FirebaseInstanceId.Instance.Token); var starter = Mvx.Resolve <IMvxAppStart>(); starter.Start(); CrashManager.Register(this, "1a19190547c340aa9e7bf156aa5527ec"); MetricsManager.Register(Application, "1a19190547c340aa9e7bf156aa5527ec"); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("**BullTect LAUNCH EXCEPTION**\n\n" + e); } }
public virtual ActionResult UpdateFormElementPosition(long formElementId, int orderNumber) { //check permissions inside UpdateFormElementsPositions widget FormsHelper.UpdateFormElementsPositions(formElementId, this.CorePrincipal(), orderNumber); return(null); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { //var manager = BITHockeyManager.SharedHockeyManager; //manager.Configure(GridCentral.Helpers.Keys.HockeyId_IOS); //manager.StartManager(); //manager.Authenticator.AuthenticateInstallation(); var container = new SimpleContainer(); container.Register <IDevice>(t => AppleDevice.CurrentDevice); container.Register <IDisplay>(t => t.Resolve <IDevice>().Display); container.Register <INetwork>(t => t.Resolve <IDevice>().Network); Resolver.SetResolver(container.GetResolver()); global::Xamarin.Forms.Forms.Init(); CarouselViewRenderer.Init(); CachedImageRenderer.Init(); // Initializing FFImageLoading UXDivers.Artina.Shared.GrialKit.Init(new ThemeColors(), "GridCentral.iOS.GrialLicense"); iOS11Workaround(); // Code for starting up the Xamarin Test Cloud Agent #if ENABLE_TEST_CLOUD Xamarin.Calabash.Start(); #endif FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects)); FormsHelper.ForceLoadingAssemblyContainingType <UXDivers.Effects.iOS.CircleEffect>(); LoadApplication(new App()); //LoadApplication(UXDivers.Gorilla.iOS.Player.CreateApplication( // new UXDivers.Gorilla.Config("Good Gorilla").RegisterAssembliesFromTypes<UXDivers.Artina.Shared.CircleImage, // GrialShapesFont, XLabs.Forms.Controls.CheckBox, XLabs.Forms.Controls.BindableRadioGroup, BindablePicker, CarouselViewControl>())); ////////////Notifactions///////////////////// // get permission for notification if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // iOS 10 var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound; UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) => { Console.WriteLine(granted); }); // For iOS 10 display notification (sent via APNS) UNUserNotificationCenter.Current.Delegate = this; } else { var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound; var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null); UIApplication.SharedApplication.RegisterUserNotificationSettings(settings); } UIApplication.SharedApplication.RegisterForRemoteNotifications(); // Firebase component initialize Firebase.Core.App.Configure(); //System.Diagnostics.Debug.WriteLine("Token =" + CrossSettings.Current.GetValueOrDefault<string>("Token")); GridCentral.Services.AccountService.Instance.getToken(CrossSettings.Current.GetValueOrDefault <string>("Token")); Firebase.InstanceID.InstanceId.Notifications.ObserveTokenRefresh((sender, e) => { var newToken = Firebase.InstanceID.InstanceId.SharedInstance.Token; // System.Diagnostics.Debug.WriteLine("xToken =" + newToken); GridCentral.Services.AccountService.Instance.getToken(newToken); connectFCM(); }); ////////////////////////////////////// //// Handling Push notification when app is closed if App was opened by Push Notification... //if (options != null && options.Keys != null && options.Keys.GetCount() != 0 && options.ContainsKey(new NSString("UIApplicationLaunchOptionsRemoteNotificationKey"))) //{ // NSDictionary UIApplicationLaunchOptionsRemoteNotificationKey = options.ObjectForKey(new NSString("UIApplicationLaunchOptionsRemoteNotificationKey")) as NSDictionary; // //ProcessNotification(UIApplicationLaunchOptionsRemoteNotificationKey, false); //check here //} return(base.FinishedLaunching(app, options)); }
protected void ASPxMenu1_ItemClick(object source, MenuItemEventArgs e) { try { switch (e.Item.Name) { case "btnAdd": FormsHelper.ClearControls(tblControls, new DTO.EspacioContDTO()); FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Add); pnlControls.Visible = true; pnlControls.HeaderText = "Agregar Registro"; break; case "btnEdit": if (FormsHelper.GetSelectedId(gv) != null) { FormsHelper.ClearControls(tblControls, new DTO.EspacioContDTO()); var entity = CRUDHelper.Read(FormsHelper.GetSelectedId(gv).Value, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); FormsHelper.FillControls(entity, tblControls); FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Edit); pnlControls.Attributes.Add("RecId", entity.RecId.ToString()); pnlControls.Visible = true; pnlControls.HeaderText = "Modificar Registro"; TipoDeEspacioChanged(); } else { pnlControls.Visible = false; } break; case "btnDelete": if (FormsHelper.GetSelectedId(gv) != null) { FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Delete); pnlControls.Attributes.Add("RecId", FormsHelper.GetSelectedId(gv).ToString()); pnlControls.Visible = true; pnlControls.HeaderText = "Eliminar Registros"; } else { pnlControls.Visible = false; } break; case "btnExport": case "btnExportXls": if (ASPxGridViewExporter1 != null) { ASPxGridViewExporter1.WriteXlsToResponse(); } break; case "btnExportPdf": if (ASPxGridViewExporter1 != null) { ASPxGridViewExporter1.WritePdfToResponse(); } break; default: break; } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
private bool ValidateJobSettings() { if (cronTriggerRadioButton.Checked) { var date = FormsHelper.GetScheduleForCron(cronExpressionTextBox.Text, DateTimeOffset.Now); if (date == DateTimeOffset.MinValue) { return(false); } } var message = new StringBuilder(); if (string.IsNullOrEmpty(jobName.Text)) { message.AppendLine(Resources.Job_name_is_missing); } if (string.IsNullOrEmpty(jobGroupComboBox.Text)) { message.AppendLine(Resources.Job_group_is_not_selected); } if (string.IsNullOrEmpty(downloadFolder.Text)) { message.AppendLine(Resources.Download_folder_is_not_selected); } if (string.IsNullOrEmpty(errorsFolder.Text)) { message.AppendLine(Resources.Download_errors_folder_is_not_selected); } if ((instanceComboBox.SelectedItem == null) || string.IsNullOrEmpty(instanceComboBox.Text)) { message.AppendLine(Resources.Dynamics_instance_is_not_selected); } if (userAuthRadioButton.Checked && ((userComboBox.SelectedItem == null) || string.IsNullOrEmpty(userComboBox.Text))) { message.AppendLine(Resources.User_is_not_selected); } if ((appRegistrationComboBox.SelectedItem == null) || string.IsNullOrEmpty(appRegistrationComboBox.Text)) { message.AppendLine(Resources.AAD_client_application_is_not_selected); } if (string.IsNullOrEmpty(dataProject.Text)) { message.AppendLine(Resources.Data_project_is_missing); } if (string.IsNullOrEmpty(legalEntity.Text)) { message.AppendLine(Resources.Legal_entity_is_missing); } if (string.IsNullOrEmpty(exportToPackageTextBox.Text)) { message.AppendLine(Resources.URL_for_ExportToPackage_action_is_missing); } if (string.IsNullOrEmpty(getExecutionSummaryStatusTextBox.Text)) { message.AppendLine(Resources.URL_for_GetExecutionSummaryStatus_action_is_missing); } if (string.IsNullOrEmpty(getExportedPackageUrlTextBox.Text)) { message.AppendLine(Resources.URL_for_GetExportedPackageUrl_action_is_missing); } if (message.Length > 0) { MessageBox.Show(message.ToString(), Resources.Job_configuration_is_not_valid); } return(message.Length == 0); }
protected override Layout SetupContentLayout() { Layout layout = base.SetupContentLayout(); if (emotionalStatus != null) { emotionalIcon = FormsHelper.ConfigureImageButton($"{ emotionalStatus.ToString().ToLower() }.png", null, SelectEmotionalStatusPage.EmotionalIconSize); // new Size(85, 85)); _mainLayout.Children.Add(emotionalIcon, new Rectangle(0.5, 130 - 50, SelectEmotionalStatusPage.EmotionalIconSize.Width, SelectEmotionalStatusPage.EmotionalIconSize.Height), AbsoluteLayoutFlags.XProportional); } ActivityIndicator activityIndicator = new ActivityIndicator { IsRunning = true }; _mainLayout.Children.Add(activityIndicator, new Rectangle(0, 0, SelectEmotionalStatusPage.EmotionalIconSize.Width, 50), AbsoluteLayoutFlags.XProportional); _challengeTypesIconsLayout = new Grid() { Margin = new Thickness(0, 10), VerticalOptions = LayoutOptions.FillAndExpand, ColumnSpacing = 10, //RowSpacing = 10, }; _challengeTypesIconsLayout.ColumnDefinitions.Add(new ColumnDefinition()); _challengeTypesIconsLayout.ColumnDefinitions.Add(new ColumnDefinition()); _challengeTypesIconsLayout.RowDefinitions.Add(new RowDefinition()); _challengeTypesIconsLayout.RowDefinitions.Add(new RowDefinition()); _challengeTypesIcons = new List <ChallengeTypeIcon>(); var icon = ConfigureOptionButton(ChallengeType.Social); icon.VerticalOptions = LayoutOptions.End; icon.HorizontalOptions = LayoutOptions.End; _challengeTypesIcons.Add(new ChallengeTypeIcon() { ChallengeType = ChallengeType.Social, Image = icon }); _challengeTypesIconsLayout.Children.Add(icon, 0, 0); icon = ConfigureOptionButton(ChallengeType.Cognitive); icon.VerticalOptions = LayoutOptions.End; icon.HorizontalOptions = LayoutOptions.Start; _challengeTypesIcons.Add(new ChallengeTypeIcon() { ChallengeType = ChallengeType.Cognitive, Image = icon }); _challengeTypesIconsLayout.Children.Add(icon, 1, 0); icon = ConfigureOptionButton(ChallengeType.Behavioral); icon.VerticalOptions = LayoutOptions.Start; icon.HorizontalOptions = LayoutOptions.End; _challengeTypesIcons.Add(new ChallengeTypeIcon() { ChallengeType = ChallengeType.Behavioral, Image = icon }); _challengeTypesIconsLayout.Children.Add(icon, 0, 1); icon = ConfigureOptionButton(ChallengeType.CreateCustomChallenge); icon.VerticalOptions = LayoutOptions.Start; icon.HorizontalOptions = LayoutOptions.Start; _challengeTypesIcons.Add(new ChallengeTypeIcon() { ChallengeType = ChallengeType.CreateCustomChallenge, Image = icon }); _challengeTypesIconsLayout.Children.Add(icon, 1, 1); _bottomContent.Children.Add(_challengeTypesIconsLayout, 0, 0); return(layout); }
public override void RunCommand(object sender) { var engine = (IAutomationEngineInstance)sender; bool testMode = TestMode; //user image to bitmap Bitmap userImage = new Bitmap(CommonMethods.Base64ToImage(v_ImageCapture)); double accuracy; try { accuracy = double.Parse(v_MatchAccuracy.ConvertUserVariableToString(engine)); if (accuracy > 1 || accuracy < 0) { throw new ArgumentOutOfRangeException("Accuracy value is out of range (0-1)"); } } catch (Exception) { throw new InvalidDataException("Accuracy value is invalid"); } dynamic element = null; if (v_ImageAction == "Wait For Image To Exist") { var timeoutText = (from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Timeout (Seconds)" select rw.Field <string>("Parameter Value")).FirstOrDefault(); timeoutText = timeoutText.ConvertUserVariableToString(engine); int timeOut = Convert.ToInt32(timeoutText); var timeToEnd = DateTime.Now.AddSeconds(timeOut); while (timeToEnd >= DateTime.Now) { try { element = CommandsHelper.FindImageElement(userImage, accuracy); if (element == null) { throw new Exception("Image Element Not Found"); } else { break; } } catch (Exception) { engine.ReportProgress("Element Not Yet Found... " + (timeToEnd - DateTime.Now).Seconds + "s remain"); Thread.Sleep(1000); } } if (element == null) { throw new Exception("Image Element Not Found"); } return; } else { element = CommandsHelper.FindImageElement(userImage, accuracy); } try { string clickPosition; int xAdjust; int yAdjust; switch (v_ImageAction) { case "Click Image": string clickType = (from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Click Type" select rw.Field <string>("Parameter Value")).FirstOrDefault(); clickPosition = (from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Click Position" select rw.Field <string>("Parameter Value")).FirstOrDefault(); xAdjust = Convert.ToInt32((from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "X Adjustment" select rw.Field <string>("Parameter Value")).FirstOrDefault().ConvertUserVariableToString(engine)); yAdjust = Convert.ToInt32((from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Y Adjustment" select rw.Field <string>("Parameter Value")).FirstOrDefault().ConvertUserVariableToString(engine)); Point clickPositionPoint = GetClickPosition(clickPosition, element); //move mouse to position var mouseX = (clickPositionPoint.X + xAdjust).ToString(); var mouseY = (clickPositionPoint.Y + yAdjust).ToString(); User32Functions.SendMouseMove(mouseX, mouseY, clickType); break; case "Set Text": string textToSet = (from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Text To Set" select rw.Field <string>("Parameter Value")).FirstOrDefault().ConvertUserVariableToString(engine); clickPosition = (from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Click Position" select rw.Field <string>("Parameter Value")).FirstOrDefault(); xAdjust = Convert.ToInt32((from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "X Adjustment" select rw.Field <string>("Parameter Value")).FirstOrDefault().ConvertUserVariableToString(engine)); yAdjust = Convert.ToInt32((from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Y Adjustment" select rw.Field <string>("Parameter Value")).FirstOrDefault().ConvertUserVariableToString(engine)); string encryptedData = (from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Encrypted Text" select rw.Field <string>("Parameter Value")).FirstOrDefault(); if (encryptedData == "Encrypted") { textToSet = EncryptionServices.DecryptString(textToSet, "OPENBOTS"); } Point setTextPositionPoint = GetClickPosition(clickPosition, element); //move mouse to position and set text var xPos = (setTextPositionPoint.X + xAdjust).ToString(); var yPos = (setTextPositionPoint.Y + yAdjust).ToString(); User32Functions.SendMouseMove(xPos, yPos, "Left Click"); var simulator = new InputSimulator(); simulator.Keyboard.TextEntry(textToSet); Thread.Sleep(100); break; case "Set Secure Text": var secureString = (from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Secure String Variable" select rw.Field <string>("Parameter Value")).FirstOrDefault(); clickPosition = (from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Click Position" select rw.Field <string>("Parameter Value")).FirstOrDefault(); xAdjust = Convert.ToInt32((from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "X Adjustment" select rw.Field <string>("Parameter Value")).FirstOrDefault().ConvertUserVariableToString(engine)); yAdjust = Convert.ToInt32((from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Y Adjustment" select rw.Field <string>("Parameter Value")).FirstOrDefault().ConvertUserVariableToString(engine)); var secureStrVariable = secureString.ConvertUserVariableToObject(engine, typeof(SecureString)); if (secureStrVariable is SecureString) { secureString = ((SecureString)secureStrVariable).ConvertSecureStringToString(); } else { throw new ArgumentException("Provided Argument is not a 'Secure String'"); } Point setSecureTextPositionPoint = GetClickPosition(clickPosition, element); //move mouse to position and set text var xPosition = (setSecureTextPositionPoint.X + xAdjust).ToString(); var yPosition = (setSecureTextPositionPoint.Y + yAdjust).ToString(); User32Functions.SendMouseMove(xPosition, yPosition, "Left Click"); var simulator2 = new InputSimulator(); simulator2.Keyboard.TextEntry(secureString); Thread.Sleep(100); break; case "Image Exists": var outputVariable = (from rw in v_ImageActionParameterTable.AsEnumerable() where rw.Field <string>("Parameter Name") == "Output Bool Variable Name" select rw.Field <string>("Parameter Value")).FirstOrDefault(); if (element != null) { true.StoreInUserVariable(engine, outputVariable, typeof(bool)); } else { false.StoreInUserVariable(engine, outputVariable, typeof(bool)); } break; default: break; } FormsHelper.ShowAllForms(); } catch (Exception ex) { FormsHelper.ShowAllForms(); if (element == null) { throw new Exception("Specified image was not found in window!"); } else { throw ex; } } }
public void LimpiarControles() { FormsHelper.ClearControls(this.tblABM, ObjetoDTO); }
private void DownloadJobForm_Load(object sender, EventArgs e) { Cancelled = false; //Few changes based on form mode (create or edit) Text = JobDetail == null ? Resources.Add_download_job : string.Format(Resources.Edit_job_0, JobDetail.Key.Name); addToolStripButton.Text = JobDetail == null ? Resources.Add_to_schedule : Resources.Edit_job; jobName.Enabled = JobDetail == null; jobGroupComboBox.DataSource = Properties.Settings.Default.JobGroups; jobGroupComboBox.ValueMember = null; jobGroupComboBox.DisplayMember = "Name"; jobGroupComboBox.Enabled = JobDetail == null; instanceComboBox.DataSource = Properties.Settings.Default.Instances; instanceComboBox.ValueMember = null; instanceComboBox.DisplayMember = "Name"; appRegistrationComboBox.DataSource = Properties.Settings.Default.AadApplications.Where(x => x.AuthenticationType == AuthenticationType.User).ToList(); appRegistrationComboBox.ValueMember = null; appRegistrationComboBox.DisplayMember = "Name"; userComboBox.DataSource = Properties.Settings.Default.Users; userComboBox.ValueMember = null; userComboBox.DisplayMember = "Login"; dataJobComboBox.DataSource = Properties.Settings.Default.DataJobs.Where(x => x.Type == DataJobType.Download).ToList(); dataJobComboBox.ValueMember = null; dataJobComboBox.DisplayMember = "Name"; startAtDateTimePicker.Value = DateTime.Now; errorsFolder.Text = Properties.Settings.Default.DownloadErrorsFolder; if ((JobDetail != null) && (Trigger != null)) { jobName.Text = JobDetail.Key.Name; var jobGroup = ((IEnumerable <JobGroup>)jobGroupComboBox.DataSource).FirstOrDefault(x => x.Name == JobDetail.Key.Group); jobGroupComboBox.SelectedItem = jobGroup; jobDescription.Text = JobDetail.Description; downloadFolder.Text = JobDetail.JobDataMap.GetString(SettingsConstants.DownloadSuccessDir); errorsFolder.Text = JobDetail.JobDataMap.GetString(SettingsConstants.DownloadErrorsDir); useStandardSubfolder.Checked = false; unzipCheckBox.Checked = JobDetail.JobDataMap.GetBooleanValue(SettingsConstants.UnzipPackage); addTimestampCheckBox.Checked = JobDetail.JobDataMap.GetBooleanValue(SettingsConstants.AddTimestamp); deletePackageCheckBox.Checked = JobDetail.JobDataMap.GetBooleanValue(SettingsConstants.DeletePackage); serviceAuthRadioButton.Checked = JobDetail.JobDataMap.GetBooleanValue(SettingsConstants.UseServiceAuthentication); delayBetweenFilesNumericUpDown.Value = JobDetail.JobDataMap.GetInt(SettingsConstants.DelayBetweenFiles); if (!serviceAuthRadioButton.Checked) { User axUser = null; if (!JobDetail.JobDataMap.GetString(SettingsConstants.UserName).IsNullOrWhiteSpace()) { axUser = ((IEnumerable <User>)userComboBox.DataSource).FirstOrDefault(x => x.Login == JobDetail.JobDataMap.GetString(SettingsConstants.UserName)); } if (axUser == null) { axUser = new User { Login = JobDetail.JobDataMap.GetString(SettingsConstants.UserName), Password = JobDetail.JobDataMap.GetString(SettingsConstants.UserPassword) }; Properties.Settings.Default.Users.Add(axUser); userComboBox.DataSource = Properties.Settings.Default.Users; } userComboBox.SelectedItem = axUser; } var application = ((IEnumerable <AadApplication>)appRegistrationComboBox.DataSource).FirstOrDefault(app => app.ClientId == JobDetail.JobDataMap.GetString(SettingsConstants.AadClientId)); if (application == null) { if (!serviceAuthRadioButton.Checked) { application = new AadApplication { ClientId = JobDetail.JobDataMap.GetString(SettingsConstants.AadClientId) ?? Guid.Empty.ToString(), Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}", AuthenticationType = AuthenticationType.User }; } else { application = new AadApplication { ClientId = JobDetail.JobDataMap.GetString(SettingsConstants.AadClientId) ?? Guid.Empty.ToString(), Secret = JobDetail.JobDataMap.GetString(SettingsConstants.AadClientSecret) ?? String.Empty, Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}", AuthenticationType = AuthenticationType.Service }; } Properties.Settings.Default.AadApplications.Add(application); appRegistrationComboBox.DataSource = Properties.Settings.Default.AadApplications; } appRegistrationComboBox.SelectedItem = application; var dataJob = ((IEnumerable <DataJob>)dataJobComboBox.DataSource).FirstOrDefault(dj => dj.ActivityId == JobDetail.JobDataMap.GetString(SettingsConstants.ActivityId)); if (dataJob == null) { dataJob = new DataJob { ActivityId = JobDetail.JobDataMap.GetString(SettingsConstants.ActivityId), Type = DataJobType.Download, Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}" }; Properties.Settings.Default.DataJobs.Add(dataJob); dataJobComboBox.DataSource = Properties.Settings.Default.DataJobs.Where(x => x.Type == DataJobType.Download).ToList(); } dataJobComboBox.SelectedItem = dataJob; var axInstance = ((IEnumerable <Instance>)instanceComboBox.DataSource).FirstOrDefault(x => (x.AosUri == JobDetail.JobDataMap.GetString(SettingsConstants.AosUri)) && (x.AadTenant == JobDetail.JobDataMap.GetString(SettingsConstants.AadTenant)) && (x.AzureAuthEndpoint == JobDetail.JobDataMap.GetString(SettingsConstants.AzureAuthEndpoint))); if (axInstance == null) { axInstance = new Instance { AosUri = JobDetail.JobDataMap.GetString(SettingsConstants.AosUri), AadTenant = JobDetail.JobDataMap.GetString(SettingsConstants.AadTenant), AzureAuthEndpoint = JobDetail.JobDataMap.GetString(SettingsConstants.AzureAuthEndpoint), UseADAL = JobDetail.JobDataMap.GetBooleanValue(SettingsConstants.UseADAL), Name = $"{Resources.IMPORTED_CHANGE_THIS} {DateTime.Now.ToShortDateString()} {DateTime.Now.ToLongTimeString()}" }; Properties.Settings.Default.Instances.Add(axInstance); instanceComboBox.DataSource = Properties.Settings.Default.Instances; } instanceComboBox.SelectedItem = axInstance; pauseIndefinitelyCheckBox.Checked = JobDetail.JobDataMap.GetBooleanValue(SettingsConstants.IndefinitePause); if (Trigger.GetType() == typeof(SimpleTriggerImpl)) { var localTrigger = (SimpleTriggerImpl)Trigger; simpleTriggerRadioButton.Checked = true; hoursDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; minutesDateTimePicker.Value = DateTime.Now.Date + localTrigger.RepeatInterval; startAtDateTimePicker.Value = localTrigger.StartTimeUtc.UtcDateTime.ToLocalTime(); } else if (Trigger.GetType() == typeof(CronTriggerImpl)) { var localTrigger = (CronTriggerImpl)Trigger; cronTriggerRadioButton.Checked = true; cronExpressionTextBox.Text = localTrigger.CronExpressionString; } retriesCountUpDown.Value = JobDetail.JobDataMap.GetInt(SettingsConstants.RetryCount); retriesDelayUpDown.Value = JobDetail.JobDataMap.GetInt(SettingsConstants.RetryDelay); pauseOnExceptionsCheckBox.Checked = JobDetail.JobDataMap.GetBooleanValue(SettingsConstants.PauseJobOnException); verboseLoggingCheckBox.Checked = JobDetail.JobDataMap.GetBooleanValue(SettingsConstants.LogVerbose); Properties.Settings.Default.Save(); } FormsHelper.SetDropDownsWidth(this); }
private Dialog SetupSkip3Dialog() { Dialog dialog = new Dialog(new Size(App.ScreenWidth - 30, _challenge.Solution != null ? 430 : 340)) { DialogBackgroundColor = _configuration.Theme.BackgroundColor, EnableCloseButton = false, }; Grid dialogLayout = new Grid() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowSpacing = 20, }; dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(60, GridUnitType.Absolute) }); dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(40, GridUnitType.Absolute) }); dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(70, GridUnitType.Absolute) }); dialogLayout.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(70, GridUnitType.Absolute) }); int row = 0; var infoIcon = FormsHelper.ConfigureImageButton("info.png"); dialogLayout.Children.Add(infoIcon, 0, row); row++; dialogLayout.Children.Add(new Label() { Text = $"Sólo puedes saltar de prueba tres veces.", HorizontalTextAlignment = TextAlignment.Center, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, }, 0, row); row++; dialogLayout.Children.Add(new FrameButton("VOLVER", (e, s) => { dialog.Close(); EnableButtonsAfter3Times(true); }) { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = _configuration.Theme.SecondaryBackgroundColor, TextColor = _configuration.Theme.SelectedTextColor, Margin = new Thickness(35, 0), }, 0, row); row++; dialogLayout.Children.Add(new FrameButton("PASAR", (e, s) => { ShowResultSummary(false, false); }) { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), BackgroundColor = _configuration.Theme.SecondaryBackgroundColor, TextColor = _configuration.Theme.SelectedTextColor, Margin = new Thickness(35, 0), }, 0, row); row++; dialog.Content = dialogLayout; //_mainLayout.Children.Add(dialog, new Rectangle(0, 250, 1, 350), AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional); return(dialog); }
public BaseBinder() : base() { Controllers = new Dictionary <string, IDBController>(); Mapper = new Dictionary <string, Control>(); Prop = new Func <string, PropertyInfo>(x => typeof(M).GetProperty(x)); isBoolean = new Func <string, bool>(x => Mapper[x].GetType() == typeof(CheckBox) && Prop(x).PropertyType == typeof(bool)); isDateTime = new Func <string, bool>(x => Prop(x).PropertyType == typeof(DateTime) || Prop(x).PropertyType == typeof(DateTime?)); isInt64 = new Func <string, bool>(x => Prop(x).PropertyType == typeof(Int64)); isInt32 = new Func <string, bool>(x => Prop(x).PropertyType == typeof(Int32) || Prop(x).PropertyType == typeof(int)); isDouble = new Func <string, bool>(x => Prop(x).PropertyType == typeof(double) || Prop(x).PropertyType == typeof(Double)); //Load += (s, e) => { // if (DesignMode || (Site != null && Site.DesignMode)) return; new PermissionsHelper <M>(this); foreach (var control in Mapper.Values.OrderBy(x => x.TabIndex)) { if (DefaultControl == null && control.TabStop) { DefaultControl = control; } control.KeyDown += delegate(object sender, KeyEventArgs ea) { if (ea.KeyCode == Keys.Enter) { ea.SuppressKeyPress = true; ea.Handled = true; SendKeys.Send("\t"); } }; } DefaultControl?.Focus(); if (SaveButton != null) { SaveButton.Enabled = SaveButtonEnabled; SaveButton.Click += (bs, be) => { try { Controller.Save(Model); Model = Controller.Find(Model, Controller.GetMetaData().UniqueKeyFields.ToArray()); AfterSave?.Invoke(); DefaultControl.Focus(); DefaultControl.Select(); }catch (Exception ex) { FormsHelper.Error(ex.Message); } }; } if (DeleteButton != null) { DeleteButton.Enabled = DeleteButtonEnabled; DeleteButton.Click += (bs, be) => { Controller.Delete(Model); NewButton?.PerformClick(); }; } if (NewButton != null) { NewButton.Enabled = NewButtonEnabled; NewButton.Click += (bs, be) => { Model = Controller.NewModel <M>(); }; } //}; }
private Dialog SetupnoMoreChallengesDialog() { Dialog dialog = new Dialog(new Size(App.ScreenWidth - 30, 300)) { DialogBackgroundColor = _configuration.Theme.BackgroundColor, EnableCloseButton = false, }; Grid dialogLayout = new Grid() { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, RowSpacing = 20, }; int row = 0; var summaryIcon = FormsHelper.ConfigureImageButton("info.png"); dialogLayout.Children.Add(summaryIcon, 0, row); row++; Label anotherChallenge = new Label() { Text = "Se han acabado las pruebas de esta categoria...ves al Inicio o al apartado de Filtros que se encuentra en Perfil.", HorizontalTextAlignment = TextAlignment.Center, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, }; dialogLayout.Children.Add(anotherChallenge, 0, row); row++; Button buttonI = new Button { Text = "Volver a Inicio", VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center, BackgroundColor = Configuration.Theme.SecondaryBackgroundColor, TextColor = Color.FromHex("#000078"), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), Margin = new Thickness(35, 0), }; ImageButton imageButton = new ImageButton { Source = "info.png", BackgroundColor = Color.Transparent, HorizontalOptions = LayoutOptions.Center, HeightRequest = 60, VerticalOptions = LayoutOptions.CenterAndExpand }; buttonI.Clicked += OnImageButtonClicked; var continueButton = new FrameButton("Ir a Inicio", (e, s) => { OnChallengeEnd(true); }) { BackgroundColor = Configuration.Theme.SecondaryBackgroundColor, TextColor = Color.FromHex("#000078"), FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), Margin = new Thickness(35, 0), }; dialogLayout.Children.Add(buttonI, 0, row); row++; dialog.Content = dialogLayout; return(dialog); }
/// <summary> /// Checks if an update is available online and offer to install, download or open product web page. /// App version is "MAJOR.MINOR". /// </summary> /// <returns> /// True if application must exist else false. /// </returns> /// <param name="checkAtStartup">True if it is a startup check.</param> /// <param name="lastdone">The last done date.</param> /// <param name="interval">Days interval to check.</param> /// <param name="auto">True if no user interaction else false.</param> /// <param name="useGitHub">True to use GitHub.</param> static public bool Run(bool checkAtStartup, ref DateTime lastdone, int interval, bool auto, bool useGitHub = false) { if (interval == -1) { interval = DefaultCheckDaysInterval; } CleanTemp(); if (Mutex) { return(false); } if (auto && !checkAtStartup) { return(false); } if (auto && lastdone.AddDays(interval) >= DateTime.Now) { return(false); } var form = FormsHelper.GetActiveForm(); bool formEnabled = form?.Enabled ?? false; bool formTopMost = form?.TopMost ?? false; bool formHidden = LoadingForm.Instance.Hidden; try { Mutex = true; if (form is not null) { form.TopMost = true; form.TopMost = formTopMost; form.Enabled = false; } LoadingForm.Instance.Hidden = auto; LoadingForm.Instance.Initialize(SysTranslations.WebCheckUpdate.GetLang(), 3, 0, false); LoadingForm.Instance.Owner = Globals.MainForm; LoadingForm.Instance.DoProgress(); using var client = new WebClientEx(); var fileInfo = GetVersionAndChecksum(client, useGitHub); lastdone = DateTime.Now; if (fileInfo.Item1.CompareTo(Assembly.GetExecutingAssembly().GetName().Version) > 0) { return(GetUserChoice(client, fileInfo, useGitHub)); } else if (!auto) { DisplayManager.ShowInformation(SysTranslations.NoNewVersionAvailable.GetLang()); } } catch (UnauthorizedAccessException ex) { CleanTemp(); DisplayManager.ShowWarning(SysTranslations.CheckUpdate.GetLang(Globals.AssemblyTitle), ex.Message); if (DisplayManager.QueryYesNo(SysTranslations.AskToOpenGitHubPage.GetLang())) { SystemManager.OpenGitHupRepo(); } } catch (IOException ex) { CleanTemp(); DisplayManager.ShowWarning(SysTranslations.CheckUpdate.GetLang(Globals.AssemblyTitle), ex.Message); if (DisplayManager.QueryYesNo(SysTranslations.AskToOpenGitHubPage.GetLang())) { SystemManager.OpenGitHupRepo(); } } catch (WebException ex) { // TODO create advanced box to retry-cancel CleanTemp(); string msg = ex.Message; if (ex.Status == WebExceptionStatus.Timeout) { if (auto) { if (useGitHub) { return(false); } else { return(Run(checkAtStartup, ref lastdone, interval, auto, true)); } } else if (useGitHub) { msg += Globals.NL2 + SysTranslations.CheckInternetConnection.GetLang(); } else { return(Run(checkAtStartup, ref lastdone, interval, auto, true)); } } DisplayManager.ShowWarning(SysTranslations.CheckUpdate.GetLang(Globals.AssemblyTitle), msg); } catch (Exception ex) { CleanTemp(); DisplayManager.ShowWarning(SysTranslations.CheckUpdate.GetLang(Globals.AssemblyTitle), ex.Message); } finally { doFinally(); } return(false); // void doFinally() { Mutex = false; LoadingForm.Instance.Hidden = formHidden; LoadingForm.Instance.Hide(); if (form is not null) { form.TopMost = true; form.TopMost = formTopMost; form.Enabled = formEnabled; } } }
public PermissionsHelper(BaseView <M, C> view) { if (view == null) { throw new ArgumentException("view cannot be null"); } //if(model==default) throw new ArgumentException("model cannot be null"); var CntrlEN = DBControllersFactory.Entitlement(); var CntrlPE = DBControllersFactory.ProfileEntitlement(); var CntrlPR = DBControllersFactory.Profile(); var CntrlET = DBControllersFactory.Entity(); var usr = MVCHISSession.Instance.CurrentUser; if (usr == null) { return; } //var mdl = view?.GetType().GetCustomAttributes().OfType<ForModelAttribute>().FirstOrDefault(); //if (mdl == null) return; var entity = CntrlET.Find(new EntityModel() { EntityName = $"{typeof(M).Name}".Replace("Model", "") }, "EntityName"); var ent = CntrlEN.Find(new EntitlementModel() { EntityId = entity.Id }, "EntityId"); if (ent == null) { return; } var pen = CntrlPE.Find(new ProfileEntitlementModel() { ProfileId = usr.ProfileId, EntitlementId = ent.Id }, "ProfileId", "EntitlementId"); if (view.NewButton != null) { view.SetNewButtonEnabled(view.NewButton.Enabled && pen.AllowCreate); } if (view.SaveButton != null) { view.SetSaveButtonEnabled(view.SaveButton.Enabled && pen.AllowUpdate); } if (view.DeleteButton != null) { view.SetDeleteButtonEnabled(view.DeleteButton.Enabled && pen.AllowDelete); } if (!pen.AllowRead) { FormsHelper.Error($"You don't have enough permissions to open {view}."); view.GotFocus += (x, y) => { view.Enabled = false; view.BeginInvoke(new MethodInvoker(view.Hide)); }; } }
private bool ValidateJobSettings() { if (upJobCronTriggerRadioButton.Checked) { var date = FormsHelper.GetScheduleForCron(upJobCronExpressionTextBox.Text, DateTimeOffset.Now); if (date == DateTimeOffset.MinValue) { return(false); } } if (useMonitoringJobCheckBox.Checked && procJobCronTriggerRadioButton.Checked) { var date = FormsHelper.GetScheduleForCron(procJobCronExpressionTextBox.Text, DateTimeOffset.Now); if (date == DateTimeOffset.MinValue) { return(false); } } var message = new StringBuilder(); if (string.IsNullOrEmpty(jobName.Text)) { message.AppendLine(Resources.Job_name_is_missing); } if ((jobGroupComboBox.SelectedItem == null) || string.IsNullOrEmpty(jobGroupComboBox.Text)) { message.AppendLine(Resources.Job_group_is_not_selected); } if (string.IsNullOrEmpty(topUploadFolderTextBox.Text) && useStandardSubfolder.Checked) { message.AppendLine(Resources.Top_uploads_folder_is_not_selected); } if (string.IsNullOrEmpty(inputFolderTextBox.Text)) { message.AppendLine(Resources.Input_folder_is_not_selected); } if (string.IsNullOrEmpty(uploadSuccessFolderTextBox.Text)) { message.AppendLine(Resources.Upload_success_folder_is_not_selected); } if (string.IsNullOrEmpty(uploadErrorsFolderTextBox.Text)) { message.AppendLine(Resources.Upload_errors_folder_is_not_selected); } if (string.IsNullOrEmpty(processingSuccessFolderTextBox.Text) && useMonitoringJobCheckBox.Checked) { message.AppendLine(Resources.Processing_success_folder_is_not_selected); } if (string.IsNullOrEmpty(processingErrorsFolderTextBox.Text) && useMonitoringJobCheckBox.Checked) { message.AppendLine(Resources.Processing_errors_folder_is_not_selected); } if ((instanceComboBox.SelectedItem == null) || string.IsNullOrEmpty(instanceComboBox.Text)) { message.AppendLine(Resources.Dynamics_instance_is_not_selected); } if (userAuthRadioButton.Checked && ((userComboBox.SelectedItem == null) || string.IsNullOrEmpty(userComboBox.Text))) { message.AppendLine(Resources.User_is_not_selected); } if ((appRegistrationComboBox.SelectedItem == null) || string.IsNullOrEmpty(appRegistrationComboBox.Text)) { message.AppendLine(Resources.AAD_client_application_is_not_selected); } if ((dataJobComboBox.SelectedItem == null) || string.IsNullOrEmpty(dataJobComboBox.Text)) { message.AppendLine(Resources.Data_job_is_not_selected); } if (string.IsNullOrEmpty(statusFileExtensionTextBox.Text) && useMonitoringJobCheckBox.Checked) { message.AppendLine(Resources.Status_file_extension_is_not_specified); } if (message.Length > 0) { MessageBox.Show(message.ToString(), Resources.Job_configuration_is_not_valid); } return(message.Length == 0); }