public static async Task <WizardResult> GetResult(
            [OrchestrationTrigger] DurableOrchestrationContext context)
        {
            var criteria = context.GetInput <FoodInputCriteria>();

            var items = await context.CallActivityAsync <IEnumerable <ResultModel> >("DataFunction", DataType.Food);

            items = items
                    .Where(x => x.Details.En.LongDescription.Contains(criteria.Category))
                    .Where(
                x =>
                x.Location != null &&
                WithinDistance(x.Location.Latitude, x.Location.Longitude, criteria.VisitorCoordinates,
                               criteria.Range));

            var result = new WizardResult
            {
                Title = criteria.Key,
                Text  = "Based on your interests we've found these results."
            };

            result.Items = items.Select(x => WizardResultItem.From(x));

            return(result);
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            string projectFile;

            if (args.Length == 0)
            {
                projectFile = null;
            }
            else
            {
                projectFile = args[0];
            }

            ProjectFileConfigurationStrategy strategy = new ProjectFileConfigurationStrategy(projectFile);

            Application.EnableVisualStyles();
            Application.Run(new SoodaConfigurationWizard(strategy));
#if A
            using (SoodaConfigurationWizard wizard = new SoodaConfigurationWizard())
            {
                if (DialogResult.OK == wizard.ShowDialog())
                {
                    WizardResult result = wizard.Result;

                    using (ConfiguringSoodaForm csf = new ConfiguringSoodaForm())
                    {
                        csf.ShowDialog();
                    }
                }
            }
#endif
        }
        /// <summary>
        /// Calls the OnNext() method of the current step and
        /// advances the wizard to the next step. If the current step
        /// is the last in the sequence, ends the wizard.
        /// </summary>
        /// <returns></returns>
        private bool Advance()
        {
            IStep departingComponent = steps[currentStepIndex] is ConditionalStep
                ? (steps[currentStepIndex] as ConditionalStep).UnderlyingStep
                : steps[currentStepIndex];

            bool successful = departingComponent.OnNext();

            if (successful)
            {
                if (steps.Count > currentStepIndex + 1)
                {
                    ++currentStepIndex;
                    IStep displayedComponent = steps[currentStepIndex];
                    while (displayedComponent is ConditionalStep)
                    {
                        ConditionalStep cc = steps[currentStepIndex] as ConditionalStep;
                        if (cc.Condition())
                        {
                            displayedComponent = cc.UnderlyingStep;
                            cc.Displayed       = true;
                        }
                        else
                        {
                            cc.Displayed = false;
                            if (currentStepIndex == steps.Count - 1)
                            {
                                throw new Exception("Conditional step occurred last in step sequence"
                                                    + " and was displayed.");
                            }
                            ++currentStepIndex;
                            displayedComponent = steps[currentStepIndex];
                        }
                    }
                    runComponent(displayedComponent);
                }
                else
                {
                    result = WizardResult.Finish;
                    endWizard();
                }
            }
            else
            {
                updateButtonState();
            }
            return(successful);
        }
Beispiel #4
0
        private void ShowPartner()
        {
            Cursor.Current = Cursors.WaitCursor;

            if (p == null)
            {
                p = new PartnerWizardForm();
            }
            Cursor.Current = Cursors.WaitCursor;
            WizardResult rez = p.ShowWizard();

            if (rez == WizardResult.Next)
            {
                ShowDokument();
            }
        }
Beispiel #5
0
        private void ShowDokument()
        {
            Cursor.Current = Cursors.WaitCursor;

            if (d == null)
            {
                d = new DokumentWizardForm();
            }

            d.SetPartner(p.Partner);
            WizardResult rez = d.ShowWizard();

            if (rez == WizardResult.Previous)
            {
                ShowPartner();
            }
        }
Beispiel #6
0
        public override void ExecuteCommand(IList <NavigationModelNodeBase> nodes, NavigationModelNodeTask task, ICollection <string> parameters)
        {
            try
            {
                EnterpriseManagementGroup emg = ConsoleContext.GetConsoleEMG();

                if (parameters.Contains("Create"))
                {
                    //do stuff
                    ProjectConnectorHelpers helper = new ProjectConnectorHelpers();
                    ProjectConnectorData    data   = helper.CreateProjectConnector();
                    if (data.WizardResult == WizardResult.Success)
                    {
                        this.RequestViewRefresh();
                    }
                }
                else if (parameters.Contains("Edit"))
                {
                    //do other stuff
                    ProjectConnectorHelpers helper = new ProjectConnectorHelpers();
                    WizardResult            result = helper.EditProjectConnector(nodes[0]);
                    if (result == WizardResult.Success)
                    {
                        this.RequestViewRefresh();
                    }
                }
                else if (parameters.Contains("Delete"))
                {
                    //delete stuff
                    ProjectConnectorHelpers helper = new ProjectConnectorHelpers();
                    if (helper.DeleteProjectConnector(nodes[0]))
                    {
                        this.RequestViewRefresh();
                    }
                }
            }
            catch (Exception ex)
            {
                ConsoleContextHelper.Instance.ShowErrorDialog(ex, string.Empty, ConsoleJobExceptionSeverity.Error);
            }
        }
Beispiel #7
0
 public WizardReturnEventArgs(WizardResult result, object data)
 {
     Result = result;
     Data   = data;
 }
 public WizardReturnEventArgs(WizardResult result, object data)
 {
     Result = result;
     Data = data;
 }
Beispiel #9
0
 public WizardContext(WizardResult result, object data)
 {
     this.result = result;
     this.data   = data;
 }
Beispiel #10
0
 public WizardReturnEventArgs(WizardResult result, object data)
 {
     this.result = result;
     this.data   = data;
 }
Beispiel #11
0
        /// <summary>
        /// Calls the OnNext() method of the current step and
        /// advances the wizard to the next step. If the current step
        /// is the last in the sequence, ends the wizard.
        /// </summary>
        /// <returns></returns>
        private bool Advance()
        {
            IStep departingComponent = steps[currentStepIndex] is ConditionalStep
                ? (steps[currentStepIndex] as ConditionalStep).UnderlyingStep
                : steps[currentStepIndex];

            bool successful = departingComponent.OnNext();           
            if (successful)
            {
                if (steps.Count > currentStepIndex + 1)
                {
                    ++currentStepIndex;
                    IStep displayedComponent = steps[currentStepIndex];
                    while (displayedComponent is ConditionalStep)
                    {
                        ConditionalStep cc = steps[currentStepIndex] as ConditionalStep;
                        if (cc.Condition())
                        {
                            displayedComponent = cc.UnderlyingStep;
                            cc.Displayed = true;
                        }
                        else
                        {
                            cc.Displayed = false;
                            if (currentStepIndex == steps.Count - 1)
                            {
                                throw new Exception("Conditional step occurred last in step sequence"
                                    + " and was displayed.");
                            }
                            ++currentStepIndex;
                            displayedComponent = steps[currentStepIndex];
                        }
                    }
                    runComponent(displayedComponent);
                }
                else
                {
                    result = WizardResult.Finish;
                    endWizard();
                }
            }
            else
            {
                updateButtonState();
            }
            return successful;
        }
Beispiel #12
0
 public static void Main(String[] args)
 {
     SampleWizard wiz = new SampleWizard();
     WizardResult res = wiz.ShowWizard();
 }
Beispiel #13
0
 public WizardReturnEventArgs(WizardResult result, object data)
 {
     this.result = result;
     this.data = data;
 }
Beispiel #14
0
        public static IFeatureClass CreateOPFeatureClass(WizardResult calcResult, IFeatureClass observatioPointsFeatureClass,
                                                         IActiveView activeView, IRaster raster)
        {
            var calcObservPointsFeatureClass = VisibilityCalcResults.GetResultName(VisibilityCalculationResultsEnum.ObservationPoints, calcResult.TaskName);

            var observPointTemporaryFeatureClass =
                GdbAccess.Instance.GenerateTemporaryFeatureClassWithRequitedFields(observatioPointsFeatureClass.Fields, calcObservPointsFeatureClass);

            bool   isCircle;
            double maxAzimuth  = 0;
            double minAzimuth  = 360;
            double maxDistance = 0;

            calcResult.ObservationStation.Project(activeView.FocusMap.SpatialReference);

            var observationStationPolygon   = calcResult.ObservationStation as IPolygon;
            var observStationEnvelope       = observationStationPolygon.Envelope;
            var observStationEnvelopePoints = new IPoint[] { observStationEnvelope.LowerLeft, observStationEnvelope.LowerRight,
                                                             observStationEnvelope.UpperRight, observStationEnvelope.UpperLeft };

            var observerPointGeometry = new PointClass
            {
                X = calcResult.ObservationPoint.X.Value,
                Y = calcResult.ObservationPoint.Y.Value,
                SpatialReference = EsriTools.Wgs84Spatialreference
            };

            observerPointGeometry.Project(activeView.FocusMap.SpatialReference);

            observerPointGeometry.AddZCoordinate(raster);
            observerPointGeometry.ZAware = true;

            if (double.IsNaN(observerPointGeometry.Z))
            {
                throw new MilSpacePointOutOfRatserException(calcResult.ObservationPoint.Objectid, calcResult.RasterLayerName);
            }

            var minDistance = FindMinDistance(observStationEnvelopePoints, observerPointGeometry);


            // ---- Get min and max azimuths ----

            var points = EsriTools.GetPointsFromGeometries(new IGeometry[] { calcResult.ObservationStation },
                                                           observerPointGeometry.SpatialReference,
                                                           out isCircle).ToArray();

            bool isPointInside = EsriTools.IsPointOnExtent(observStationEnvelope, observerPointGeometry);

            // Set azimuth for circle polygon
            if (isCircle && !isPointInside)
            {
                for (int i = 0; i < observStationEnvelopePoints.Length; i++)
                {
                    var line = new Line()
                    {
                        FromPoint        = observerPointGeometry,
                        ToPoint          = observStationEnvelopePoints[i],
                        SpatialReference = observerPointGeometry.SpatialReference
                    };

                    if (i == 0)
                    {
                        maxDistance = line.Length;
                    }
                    else if (maxDistance < line.Length)
                    {
                        maxDistance = line.Length;
                    }

                    if (minAzimuth > line.PosAzimuth())
                    {
                        minAzimuth = line.PosAzimuth();
                    }

                    if (maxAzimuth < line.PosAzimuth())
                    {
                        maxAzimuth = line.PosAzimuth();
                    }
                }
            }
            else
            {
                EsriTools.CreateDefaultPolylinesForFun(observerPointGeometry, points, new IGeometry[] { calcResult.ObservationStation },
                                                       isCircle, isPointInside, -1, out minAzimuth, out maxAzimuth, out maxDistance).ToList();
            }
            // ---- End. Get min and max azimuths ----

            // observerPointGeometry.Project(activeView.FocusMap.SpatialReference);
            var pointCopy = observerPointGeometry.CloneWithProjecting();

            (pointCopy as PointClass).ZAware = true;

            int idObserPooint = 0;

            for (var currentHeight = calcResult.FromHeight; currentHeight <= calcResult.ToHeight; currentHeight += calcResult.Step)
            {
                double maxTiltAngle = -90;
                double minTiltAngle = 90;

                var height = currentHeight;

                // Set parameters for case if point located into the polygon
                if (isCircle && isPointInside)
                {
                    minTiltAngle = -90;
                    minDistance  = 0;
                }

                for (int i = 0; i < observStationEnvelopePoints.Length; i++)
                {
                    var currentTitleAngle = EsriTools.FindAngleByDistanceAndHeight(height, observerPointGeometry, observStationEnvelopePoints[i], raster);

                    if (minTiltAngle > currentTitleAngle)
                    {
                        minTiltAngle = currentTitleAngle;
                    }

                    if (maxTiltAngle < currentTitleAngle)
                    {
                        maxTiltAngle = currentTitleAngle;
                    }
                }

                // Create observation point copy with changing height, distance and angles values
                ObservationPoint currentObservationPoint = calcResult.ObservationPoint.ShallowCopy();
                currentObservationPoint.RelativeHeight  = currentHeight;
                currentObservationPoint.AngelMinH       = minTiltAngle;
                currentObservationPoint.AngelMaxH       = maxTiltAngle;
                currentObservationPoint.AzimuthStart    = minAzimuth;
                currentObservationPoint.AzimuthEnd      = maxAzimuth;
                currentObservationPoint.InnerRadius     = minDistance;
                currentObservationPoint.OuterRadius     = maxDistance;
                currentObservationPoint.AzimuthMainAxis = calcResult.ObservationPoint.AzimuthMainAxis;
                currentObservationPoint.Id = idObserPooint.ToString();

                GdbAccess.Instance.AddObservPoint(pointCopy, currentObservationPoint, observPointTemporaryFeatureClass);
                idObserPooint++;
            }

            return(observPointTemporaryFeatureClass);
        }