Пример #1
0
        public TourWrapper(ITour tour, IPersonDayWrapper personDayWrapper, int purpose, bool suppressRandomVOT)
        {
            _tour = tour;

            _exporter =
                Global
                .ContainerDaySim
                .GetInstance <IPersistenceFactory <ITour> >()
                .Exporter;

            _tourCreator =
                Global
                .ContainerDaySim
                .GetInstance <IWrapperFactory <ITourCreator> >()
                .Creator;

            // relations properties

            Household = personDayWrapper.Household;
            Person    = personDayWrapper.Person;
            PersonDay = personDayWrapper;
            Subtours  = new List <ITourWrapper>();

            SetParcelRelationships(tour);

            // flags/choice model/etc. properties

            SetValueOfTimeCoefficients(purpose, suppressRandomVOT);

            IsHomeBasedTour = true;
            TimeWindow      = new TimeWindow();
        }
        /// <summary>
        /// Converts time window into a pair of starting and ending date/time values.
        /// </summary>
        /// <param name="timeWindow">The reference to the time window to be converted.</param>
        /// <param name="plannedDate">The date/time when time window should be applied.</param>
        /// <returns>A pair of starting and ending date/time values.</returns>
        public static Tuple <DateTime?, DateTime?> ToDateTime(
            this TimeWindow timeWindow,
            DateTime plannedDate)
        {
            // Start date time.
            DateTime?startDate = null;

            // End date time.
            DateTime?endDate = null;

            // Time window start/end date time tuple.
            Tuple <DateTime?, DateTime?> dateTimeTuple = null;

            // If time wondow is null or wide open.
            if (timeWindow == null || timeWindow.IsWideOpen)
            {
                dateTimeTuple = Tuple.Create(startDate, endDate);
            }
            // Time window is not wide open.
            else
            {
                startDate = plannedDate.Date.Add(timeWindow.EffectiveFrom);
                endDate   = plannedDate.Date.Add(timeWindow.EffectiveTo);

                dateTimeTuple = Tuple.Create(startDate, endDate);
            }

            return(dateTimeTuple);
        }
Пример #3
0
        public async Task <GetUserAvailabilityResults> getFreeBusyResultsAsync()
        {
            ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010_SP2);

            service.UseDefaultCredentials = true; // Use domain account for connecting
            //service.Credentials = new WebCredentials("*****@*****.**", "password"); // used if we need to enter a password, but for now we are using domain credentials
            //service.AutodiscoverUrl("*****@*****.**");  //XXX we should use the service user for webmgmt!
            service.Url = new Uri("https://mail.aau.dk/EWS/exchange.asmx");

            List <AttendeeInfo> attendees = new List <AttendeeInfo>();

            attendees.Add(new AttendeeInfo()
            {
                SmtpAddress  = UserModel.UserPrincipalName,
                AttendeeType = MeetingAttendeeType.Organizer
            });

            // Specify availability options.
            AvailabilityOptions myOptions = new AvailabilityOptions();

            myOptions.MeetingDuration       = 30;
            myOptions.RequestedFreeBusyView = FreeBusyViewType.FreeBusy;

            // Return a set of free/busy times.
            DateTime dayBegin = DateTime.Now.Date;
            var      window   = new TimeWindow(dayBegin, dayBegin.AddDays(1));

            return(await service.GetUserAvailability(attendees, window, AvailabilityData.FreeBusy, myOptions));
        }
Пример #4
0
        public TimeWindowView(
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            TimeWindowViewFactory timeWindowViewFactory,
            ViewUpdatedCollection viewUpdatedCollection,
            TimePeriodProvide timePeriodProvide)
        {
            this.agentInstanceContext = agentInstanceContext.AgentInstanceContext;
            this.timeWindowViewFactory = timeWindowViewFactory;
            ViewUpdatedCollection = viewUpdatedCollection;
            timeWindow = new TimeWindow(agentInstanceContext.IsRemoveStream);
            scheduleSlot = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();
            this.timePeriodProvide = timePeriodProvide;

            ScheduleHandleCallback callback = new ProxyScheduleHandleCallback {
                ProcScheduledTrigger = () => {
                    agentInstanceContext.AuditProvider.ScheduleFire(
                        this.agentInstanceContext,
                        ScheduleObjectType.view,
                        timeWindowViewFactory.ViewName);
                    agentInstanceContext.InstrumentationProvider.QViewScheduledEval(timeWindowViewFactory);
                    Expire();
                    agentInstanceContext.InstrumentationProvider.AViewScheduledEval();
                }
            };
            handle = new EPStatementHandleCallbackSchedule(
                agentInstanceContext.EpStatementAgentInstanceHandle,
                callback);
        }
Пример #5
0
 /// <summary>
 ///   Creates order data. Location of the order is random, as well
 ///   as its demand (quantity), time window and penalty.  ///
 ///   </summary>
 /// <param name="number_of_orders"> number of orders to build. </param>
 /// <param name="x_max"> maximum x coordinate in which orders are located.
 /// </param>
 /// <param name="y_max"> maximum y coordinate in which orders are located.
 /// </param>
 /// <param name="demand_max"> maximum quantity of a demand. </param>
 /// <param name="time_window_max"> maximum starting time of the order time
 /// window. </param>
 /// <param name="time_window_width"> duration of the order time window.
 /// </param>
 /// <param name="penalty_min"> minimum pernalty cost if order is dropped.
 /// </param>
 /// <param name="penalty_max"> maximum pernalty cost if order is dropped.
 /// </param>
 private void BuildOrders(int number_of_orders,
                          int number_of_vehicles,
                          int x_max, int y_max,
                          int demand_max,
                          int time_window_max,
                          int time_window_width,
                          int penalty_min,
                          int penalty_max)
 {
     Console.WriteLine("Building orders.");
     locations_          = new Position[number_of_orders + 2 * number_of_vehicles];
     order_demands_      = new int[number_of_orders];
     order_time_windows_ = new TimeWindow[number_of_orders];
     order_penalties_    = new int[number_of_orders];
     for (int order = 0; order < number_of_orders; ++order)
     {
         locations_[order] =
             new Position(random_generator.Next(x_max + 1),
                          random_generator.Next(y_max + 1));
         order_demands_[order] = random_generator.Next(demand_max + 1);
         int time_window_start = random_generator.Next(time_window_max + 1);
         order_time_windows_[order] =
             new TimeWindow(time_window_start,
                            time_window_start + time_window_width);
         order_penalties_[order] =
             random_generator.Next(penalty_max - penalty_min + 1) + penalty_min;
     }
 }
Пример #6
0
        /// <summary>
        /// Get time range in which trip can be started.
        /// </summary>
        /// <param name="startLocationTimeWindow">Start location time window.</param>
        /// <returns>Time range if it was found, null otherwise.</returns>
        private TimeRange _GetTripStartTimeRange(TimeWindow startLocationTimeWindow)
        {
            // If start location timewindow is wideopen - ignore it.
            if (startLocationTimeWindow == null || startLocationTimeWindow.IsWideOpen)
            {
                return(null);
            }

            TimeRange routeStartTimeRange    = new TimeRange(_route.StartTimeWindow);
            TimeRange startLocationTimeRange = new TimeRange(startLocationTimeWindow);
            TimeRange result = null;

            // Calculate the time which route can spend at location at start.
            result =
                routeStartTimeRange.Intersection(startLocationTimeRange);

            // Trip will really start later.
            if (result != null)
            {
                result = result.Shift(
                    TimeSpan.FromMinutes(_route.TimeAtStart));
            }

            return(result);
        }
Пример #7
0
    bool TryReadElementFromXml(EwsServiceXmlReader reader)
    {
        switch (reader.LocalName)
        {
        case XmlElementNames.OofState:
            this.state = reader.ReadValue <OofState>();
            return(true);

        case XmlElementNames.ExternalAudience:
            this.externalAudience = reader.ReadValue <OofExternalAudience>();
            return(true);

        case XmlElementNames.Duration:
            this.duration = new TimeWindow();
            this.duration.LoadFromXml(reader);
            return(true);

        case XmlElementNames.InternalReply:
            this.internalReply = new OofReply();
            this.internalReply.LoadFromXml(reader, reader.LocalName);
            return(true);

        case XmlElementNames.ExternalReply:
            this.externalReply = new OofReply();
            this.externalReply.LoadFromXml(reader, reader.LocalName);
            return(true);

        default:
            return(false);
        }
    }
Пример #8
0
        private void GetPath(TimeSeries ts, string worksheet, int column, PathLayout pathLayout)
        {
            ts.Path = new DssPath();
            if (pathLayout == PathLayout.StandardPath)
            {
                ts.Path.Apart = CellToString(workbook.Worksheets[worksheet].Cells[0, column]);
                ts.Path.Bpart = CellToString(workbook.Worksheets[worksheet].Cells[1, column]);
                ts.Path.Cpart = CellToString(workbook.Worksheets[worksheet].Cells[2, column]);
                ts.Path.Fpart = CellToString(workbook.Worksheets[worksheet].Cells[5, column]);
            }
            else if (pathLayout == PathLayout.PathWithoutDPart)
            {
                ts.Path.Apart = CellToString(workbook.Worksheets[worksheet].Cells[0, column]);
                ts.Path.Bpart = CellToString(workbook.Worksheets[worksheet].Cells[1, column]);
                ts.Path.Cpart = CellToString(workbook.Worksheets[worksheet].Cells[2, column]);
                ts.Path.Fpart = CellToString(workbook.Worksheets[worksheet].Cells[4, column]);
            }

            if (IsRegular(ts.Times.ToList()))
            {
                ts.Path.Epart = TimeWindow.GetInterval(ts);
            }
            else
            {
                ts.Path.Epart = "IR-Year";
            }
        }
Пример #9
0
        public override IEnumerable <TimeWindow> AssignWindows(TElement element, long timestamp, WindowAssignerContext context)
        {
            var now   = context.CurrentProcessingTime;
            var start = TimeWindow.GetWindowStartWithOffset(now, Offset, Size);

            yield return(new TimeWindow(start, start + Size));
        }
Пример #10
0
        private static AutoscaleSettingResource CreateAutoscaleSetting(string location, string resourceUri, string metricName)
        {
            var capacity = new ScaleCapacity("1", "100", "1");

            var fixedDate = new TimeWindow(DateTime.Parse("2014-04-15T21:06:11.7882792Z"), DateTime.Parse("2014-04-16T21:06:11.7882792Z"));

            var recurrence = new Recurrence(RecurrenceFrequency.Week, new RecurrentSchedule("UTC-11", new List <string> {
                "Monday"
            }, new List <int> {
                0
            }, new List <int> {
                10
            }));

            var rules = new ScaleRule[]
            {
                new ScaleRule(new MetricTrigger(
                                  metricName, resourceUri, TimeSpan.FromMinutes(1), MetricStatisticType.Average, TimeSpan.FromHours(1), TimeAggregationType.Maximum, ComparisonOperationType.EqualsValue, threshold: 80.0),
                              new ScaleAction(ScaleDirection.Increase, ScaleType.ChangeCount, "10", cooldown: TimeSpan.FromMinutes(20))
                              )
            };

            AutoscaleSettingResource setting = new AutoscaleSettingResource(null, "setting1", null, "", new Dictionary <string, string>(),
                                                                            new AutoscaleProfile[]
            {
                //There may have one issue
                //new AutoscaleProfile("Profile1",capacity,rules,fixedDate,recurrence),
                new AutoscaleProfile("Profile2", capacity, rules, fixedDate, recurrence)
            }, new List <AutoscaleNotification>(), true, "setting1", resourceUri);

            return(setting);
        }
Пример #11
0
        public async Task <IActionResult> Put(Guid id, TimeWindow timeWindow)
        {
            if (id == Guid.Empty)
            {
                return(BadRequest(CreateProblemDetailsResponse("Invalid Id")));
            }

            if (timeWindow == null)
            {
                return(BadRequest(CreateProblemDetailsResponse("TimeWindow is required")));
            }

            TimeWindow existingTimeWindow = await _timeWindowService
                                            .GetByIdAsync(id)
                                            .ConfigureAwait(false);

            if (existingTimeWindow == null)
            {
                return(NotFound());
            }

            if (existingTimeWindow.Id != timeWindow.Id)
            {
                return(BadRequest(CreateProblemDetailsResponse("TimeWindow Id mismatch")));
            }

            timeWindow.ModifiedOn = DateTimeOffset.Now;
            TimeWindow updatedTimeWindow = _timeWindowService.Update(timeWindow);

            return(updatedTimeWindow == null
                ? (IActionResult)StatusCode(StatusCodes.Status500InternalServerError)
                : Ok(updatedTimeWindow));
        }
Пример #12
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="agentInstanceContext">The agent instance context.</param>
        /// <param name="timeWindowViewFactory">for copying the view in a group-by</param>
        /// <param name="timeDeltaComputation">is the computation of number of milliseconds before events gets pushedout of the timeWindow as oldData in the Update method.</param>
        /// <param name="viewUpdatedCollection">is a collection the view must Update when receiving events</param>
        public TimeWindowView(
            AgentInstanceViewFactoryChainContext agentInstanceContext,
            TimeWindowViewFactory timeWindowViewFactory,
            ExprTimePeriodEvalDeltaConst timeDeltaComputation,
            ViewUpdatedCollection viewUpdatedCollection)
        {
            _agentInstanceContext  = agentInstanceContext;
            _timeWindowViewFactory = timeWindowViewFactory;
            _timeDeltaComputation  = timeDeltaComputation;
            _viewUpdatedCollection = viewUpdatedCollection;
            _scheduleSlot          = agentInstanceContext.StatementContext.ScheduleBucket.AllocateSlot();
            _timeWindow            = new TimeWindow(agentInstanceContext.IsRemoveStream);

            ScheduleHandleCallback callback = new ProxyScheduleHandleCallback
            {
                ProcScheduledTrigger = extensionServicesContext => Instrument.With(
                    i => i.QViewScheduledEval(this, timeWindowViewFactory.ViewName),
                    i => i.AViewScheduledEval(),
                    Expire)
            };

            _handle = new EPStatementHandleCallback(agentInstanceContext.EpStatementAgentInstanceHandle, callback);

            if (agentInstanceContext.StatementContext.ScheduleAdjustmentService != null)
            {
                agentInstanceContext.StatementContext.ScheduleAdjustmentService.AddCallback(this);
            }
            agentInstanceContext.AddTerminationCallback(Stop);
        }
Пример #13
0
        public static void GetOOF(ExchangeService service)
        {
            // Return the Out Of Office object that contains OOF state for the user whose credendials were supplied at the console.
            // This method will result in a call to the Exchange Server.
            OofSettings userOOFSettings = service.GetUserOofSettings(UserDataFromConsole.GetUserData().EmailAddress);

            // Get the (read-only) audience of email message senders outside a client's organization who will receive automatic Out Of Office replies ("All", "Known", or "None").
            OofExternalAudience allowedExternalAudience = userOOFSettings.AllowExternalOof;

            // Get the duration for a scheduled Out Of Office reply.
            TimeWindow OOFDuration = userOOFSettings.Duration;

            // Get the ExternalAudience of email message senders outside a client's organization who will receive automatic Out OF Office replies (All/Known/None).
            OofExternalAudience externalAudience = userOOFSettings.ExternalAudience;

            // Get the reply to be sent to email message senders outside a client's organization.
            OofReply externalReply = userOOFSettings.ExternalReply;

            // Get the reply to be sent to email message senders inside a client's organization.
            OofReply internalReply = userOOFSettings.InternalReply;

            // Get the (Disabled/Enabled/Scheduled) state of the Out Of Office automatic reply feature.
            OofState userOofState = userOOFSettings.State;

            // Print user status information to the console
            Console.WriteLine("Allowed External Audience: {0}", allowedExternalAudience);
            Console.WriteLine("Out of Office duration: {0}", OOFDuration);
            Console.WriteLine("External Audience: {0}", externalAudience);
            Console.WriteLine("External Reply: {0}", externalReply);
            Console.WriteLine("Internal Reply: {0}", internalReply);
            Console.WriteLine("User OOF state: {0}", userOofState);
        }
Пример #14
0
 public void Update(TimeWindow timeWindow)
 {
     Name      = timeWindow.Name;
     StartTime = timeWindow.StartTime;
     EndTime   = timeWindow.EndTime;
     Selection = timeWindow.Selection;
 }
Пример #15
0
        public static IEnumerable <TimeSeries> GetTimeSeries(IRange DateTimes, IRange Values, string Apart, string Bpart, string Cpart, string Dpart, string Epart, string Fpart)
        {
            var l = new List <TimeSeries>();
            var c = Values.ColumnCount;

            for (int i = 0; i < c; i++)
            {
                var ts = new TimeSeries();
                ts.Times  = RangeToDateTimes(DateTimes);
                ts.Values = RangeToTimeSeriesValues(Values, i);
                if (CheckTimeSeriesType(ts.Times) == RecordType.RegularTimeSeries)
                {
                    ts.Path = new DssPath(Apart, Bpart, Cpart, "", "",
                                          "r" + (i + 1).ToString() + Fpart, RecordType.RegularTimeSeries, "type", "units");
                    ts.Path.Epart = TimeWindow.GetInterval(ts);
                }
                else
                {
                    ts.Path = new DssPath(Apart, Bpart, Cpart, "", "IR-Year",
                                          "r" + (i + 1).ToString() + Fpart, RecordType.IrregularTimeSeries, "type", "units");
                }
                l.Add(ts);
            }

            return(l);
        }
Пример #16
0
        private void EndTimeGame()
        {
            lose = true;

            AnsverBoxPicture(true, "Время закончилось!");
            TimeWindow.Start();
        }
Пример #17
0
        public async Task <IActionResult> Post(TimeWindow timeWindow, CancellationToken cancellationToken = default)
        {
            if (timeWindow == null)
            {
                return(BadRequest(CreateProblemDetailsResponse("TimeWindow is required")));
            }

            Feature timeWindowFeature = await _featureService
                                        .GetByIdAsync(timeWindow.FeatureId)
                                        .ConfigureAwait(false);

            if (timeWindowFeature == null)
            {
                return(BadRequest(CreateProblemDetailsResponse("Invalid feature id")));
            }

            TimeWindow existingFeatureTimeWindow =
                await _timeWindowService.GetByFeatureId(timeWindow.FeatureId, cancellationToken)
                .ConfigureAwait(false);

            if (existingFeatureTimeWindow != null)
            {
                return(BadRequest(CreateProblemDetailsResponse("Feature already has a time window")));
            }

            timeWindow.CreatedOn = DateTimeOffset.Now;

            TimeWindow newTimeWindow = await _timeWindowService
                                       .AddAsync(timeWindow)
                                       .ConfigureAwait(false);

            return(newTimeWindow == null
                ? (IActionResult)StatusCode(StatusCodes.Status500InternalServerError)
                : Ok(newTimeWindow));
        }
        public static AutoscaleSettingData GetBasicAutoscaleSettingData(AzureLocation location)
        {
            var fixDate  = new TimeWindow("UTC", DateTime.Parse("2014-04-15T21:06:11.7882792Z"), DateTime.Parse("2014-04-15T21:06:11.7882792Z"));
            var Schedule = new RecurrentSchedule("UTC-11", new List <string> {
                "Monday"
            }, new List <int> {
                0
            }, new List <int> {
                10
            });
            var               recurrence    = new MonitorRecurrence(RecurrenceFrequency.Week, Schedule);
            ScaleCapacity     scaleCapacity = new ScaleCapacity("1", "1", "1");
            var               metricTtigger = new MetricTrigger("AbandonMessage", "microsoft.servicebus/namespaces", "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testservicebusRG-9432/providers/Microsoft.ServiceBus/namespaces/testnamespacemgmt7892", "Eest US 2", TimeSpan.FromMinutes(1), MetricStatisticType.Average, TimeSpan.FromMinutes(10), TimeAggregationType.Average, ComparisonOperationType.GreaterThan, 70, new ChangeTrackingList <ScaleRuleMetricDimension>(), false);
            IList <ScaleRule> rules         = new List <ScaleRule>()
            {
                new ScaleRule(metricTtigger, new ScaleAction(ScaleDirection.Increase, ScaleType.ServiceAllowedNextValue, "1", TimeSpan.FromMinutes(5)))
            };
            IEnumerable <AutoscaleProfile> profiles = new List <AutoscaleProfile>()
            {
                //new AutoscaleProfile("Profiles2", scaleCapacity, rules)
                new AutoscaleProfile("Profiles2", scaleCapacity, rules, fixDate, null),
                new AutoscaleProfile("Profiles3", scaleCapacity, rules, null, recurrence),
            };
            var data = new AutoscaleSettingData(location, profiles)
            {
                Enabled = true,
                TargetResourceLocation = location,
                TargetResourceId       = "/subscriptions/db1ab6f0-4769-4b27-930e-01e2ef9c123c/resourceGroups/testservicebusRG-9432/providers/Microsoft.ServiceBus/namespaces/testnamespacemgmt7892",

                /*Notifications =
                 * {
                 *  new AutoscaleNotification()
                 *  {
                 *      Operation = "Scale",
                 *      Email = new EmailNotification()
                 *      {
                 *          SendToSubscriptionAdministrator = true,
                 *          SendToSubscriptionCoAdministrators = true,
                 *          CustomEmails =
                 *          {
                 *              "*****@*****.**",
                 *              "*****@*****.**"
                 *          }
                 *      },
                 *      Webhooks =
                 *      {
                 *          new WebhookNotification()
                 *          {
                 *              ServiceUri = "http://myservice.com",
                 *              Properties = {}
                 *          }
                 *      }
                 *  },
                 * },*/
                Tags = {},
            };

            return(data);
        }
Пример #19
0
 /// <summary>
 /// Writes to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 /// <param name="xmlElementName">Name of the XML element.</param>
 void WriteToXml(EwsServiceXmlWriter writer, String xmlElementName)
 {
     TimeWindow.WriteToXml(
         writer,
         xmlElementName,
         this.StartTime,
         this.EndTime);
 }
Пример #20
0
        public DatabaseUsageViewModel(IEnumerable <Aggregation> timeLine, DateTime startTime, DateTime endTime,
                                      TimeWindow timeWindow, TimeResolution resolution) :
            base(timeLine, startTime, endTime, timeWindow, resolution)
        {
            var count = GetCount();

            _dbUsages = new DatabaseUsage[count];
        }
        /// <summary>
        /// Compares two time windows.
        /// </summary>
        /// <param name="object1">First time window.</param>
        /// <param name="object2">Second time window.</param>
        /// <returns>Less than zero - first time window is less than second.
        ///          Zero - time windows are equal.
        ///          Greater than zero  - first time window is greater than second.</returns>
        public int Compare(object object1, object object2)
        {
            int comparisonResult = 0;

            if (object1 == null)
            {
                comparisonResult = -1;
            }
            else if (object2 == null)
            {
                comparisonResult = 1;
            }
            // Both time windows are not null.
            else
            {
                TimeWindow timeWindow1 = object1 as TimeWindow;
                TimeWindow timeWindow2 = object2 as TimeWindow;

                Debug.Assert(timeWindow1 != null);
                Debug.Assert(timeWindow2 != null);

                // Only 1-st time window is wide open.
                if (timeWindow1.IsWideOpen && !timeWindow2.IsWideOpen)
                {
                    comparisonResult = 1;
                }
                // Only 2-nd time window is wide open.
                else if (!timeWindow1.IsWideOpen && timeWindow2.IsWideOpen)
                {
                    comparisonResult = -1;
                }
                // Both time windows are wide open.
                else if (timeWindow1.IsWideOpen && timeWindow2.IsWideOpen)
                {
                    comparisonResult = 0;
                }
                // None of time windows is wide open.
                else
                {
                    // Compare time windows start time.
                    if (timeWindow1.EffectiveFrom.Ticks > timeWindow2.EffectiveFrom.Ticks)
                    {
                        comparisonResult = 1;
                    }
                    else if (timeWindow1.EffectiveFrom.Ticks < timeWindow2.EffectiveFrom.Ticks)
                    {
                        comparisonResult = -1;
                    }
                    else
                    {
                        comparisonResult = 0;
                    }
                }
            }

            return(comparisonResult);
        }
Пример #22
0
        public IMinuteSpan GetRandomDestinationTimes(TimeWindow timeWindow, TourWrapper tour)
        {
            if (tour == null)
            {
                throw new ArgumentNullException("tour");
            }

            return(timeWindow.GetMinuteSpan(tour.Household.RandomUtility, ArrivalPeriod.Start, ArrivalPeriod.End, DeparturePeriod.Start, DeparturePeriod.End));
        }
Пример #23
0
 protected StatisticsViewModelBase(IEnumerable <Aggregation> timeLine, DateTime startTime, DateTime endTime,
                                   TimeWindow timeWindow, TimeResolution resolution)
 {
     TimeLine   = timeLine.ToArray();
     StartTime  = startTime;
     EndTime    = endTime;
     TimeWindow = timeWindow;
     Resolution = resolution;
 }
Пример #24
0
 public ApiUsageViewModel(IEnumerable <Aggregation> timeLine, DateTime startTime, DateTime endTime,
                          TimeWindow timeWindow, TimeResolution resolution)
 {
     _timeLine   = timeLine.ToArray();
     _startTime  = startTime;
     _endTime    = endTime;
     _timeWindow = timeWindow;
     _resolution = resolution;
 }
 private static void AreEqual(TimeWindow exp, TimeWindow act)
 {
     if (exp != null)
     {
         Assert.Equal(exp.End.ToUniversalTime(), act.End.ToUniversalTime());
         Assert.Equal(exp.Start.ToUniversalTime(), act.Start.ToUniversalTime());
         Assert.Equal(exp.TimeZone, act.TimeZone);
     }
 }
Пример #26
0
    /// <summary>
    /// Writes to XML without scoping the dates and without emitting times.
    /// </summary>
    /// <param name="writer">The writer.</param>
    /// <param name="xmlElementName">Name of the XML element.</param>
    void WriteToXmlUnscopedDatesOnly(EwsServiceXmlWriter writer, String xmlElementName)
    {
        const String DateOnlyFormat = "yyyy-MM-ddT00:00:00";

        TimeWindow.WriteToXml(
            writer,
            xmlElementName,
            this.StartTime.ToString(DateOnlyFormat, CultureInfo.InvariantCulture),
            this.EndTime.ToString(DateOnlyFormat, CultureInfo.InvariantCulture));
    }
Пример #27
0
        public override IEnumerable <TimeWindow> AssignWindows(TElement element, long timestamp, WindowAssignerContext context)
        {
            timestamp = context.CurrentProcessingTime;
            var lastStart = TimeWindow.GetWindowStartWithOffset(timestamp, Offset, Slide);

            for (var start = lastStart; start > timestamp - Size; start -= Slide)
            {
                yield return(new TimeWindow(start, start + Size));
            }
        }
Пример #28
0
        public void TimeIntervalMethodTest()
        {
            DssPath path = new DssPath("/MISSISSIPPI/ST. LOUIS/FLOW//1Day/OBS/");

            using (DssReader r = new DssReader(TestUtility.BasePath + "sample7.dss"))
            {
                var s = TimeWindow.GetInterval(r.GetTimeSeries(path));
                Debug.WriteLine(s);
            }
        }
Пример #29
0
        /// <summary>
        /// Transform values from control fields to TimeWindow value.
        /// </summary>
        protected void _GetTimeWindowFromControl()
        {
            TimeWindow tw = new TimeWindow();

            tw.IsWideOpen = (bool)_IsWideopen.IsChecked;
            tw.From       = _FromText.Time;
            tw.To         = _ToText.Time;

            TimeWindow = tw;
        }
Пример #30
0
        public async Task <SearchContainer <SearchPerson> > GetTrendingPeopleAsync(TimeWindow timeWindow, CancellationToken cancellationToken = default(CancellationToken))
        {
            RestRequest req = _client.Create("trending/person/{time_window}");

            req.AddUrlSegment("time_window", timeWindow.ToString());

            RestResponse <SearchContainer <SearchPerson> > resp = await req.ExecuteGet <SearchContainer <SearchPerson> >(cancellationToken).ConfigureAwait(false);

            return(resp);
        }
Пример #31
0
        /// <summary>
        /// Initializes a new instance of <c>TimeRange<c> class.
        /// </summary>
        /// <param name="timeWindow">TimeWindow, based on which time window will be created.</param>
        /// <exception cref="ArgumentNullException">TimeWindow is null.</exception>
        public TimeRange(TimeWindow timeWindow)
        {
            if (timeWindow == null)
                throw new ArgumentNullException();

            if (timeWindow.IsWideOpen)
            {
                From = TimeSpan.MinValue;
                To = new TimeSpan(TimeSpan.MaxValue.Ticks / 2);
            }
            else
            {
                From = timeWindow.EffectiveFrom;
                To = timeWindow.EffectiveTo;
            }
        }
        /// <summary>
        ///     View images for memes subgallery.
        /// </summary>
        /// <param name="sort">The order that the gallery should be sorted by. Default: Viral</param>
        /// <param name="window">The time period that should be used in filtering requests. Default: Week</param>
        /// <param name="page">The data paging number. Default: null</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task<IEnumerable<IGalleryItem>> GetMemesSubGalleryAsync(
            MemesGallerySortOrder? sort = MemesGallerySortOrder.Viral,
            TimeWindow? window = TimeWindow.Week, int? page = null)
        {
            sort = sort ?? MemesGallerySortOrder.Viral;
            window = window ?? TimeWindow.Week;

            var sortValue = $"{sort}".ToLower();
            var windowValue = $"{window}".ToLower();

            var url = $"g/memes/{sortValue}/{windowValue}/{page}";

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var gallery = await SendRequestAsync<IEnumerable<GalleryItem>>(request).ConfigureAwait(false);
                return gallery;
            }
        }
        /// <summary>
        ///     View images for a gallery tag.
        /// </summary>
        /// <param name="tag">The name of the tag.</param>
        /// <param name="sort">The order that the images in the gallery tag should be sorted by. Default: Viral</param>
        /// <param name="window">The time period that should be used in filtering requests. Default: Week</param>
        /// <param name="page">The data paging number. Default: null</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task<ITag> GetGalleryTagAsync(string tag, GalleryTagSortOrder? sort = GalleryTagSortOrder.Viral,
            TimeWindow? window = TimeWindow.Week, int? page = null)
        {
            if (string.IsNullOrWhiteSpace(tag))
                throw new ArgumentNullException(nameof(tag));

            sort = sort ?? GalleryTagSortOrder.Viral;
            window = window ?? TimeWindow.Week;

            var sortValue = $"{sort}".ToLower();
            var windowValue = $"{window}".ToLower();

            var url = $"gallery/t/{tag}/{sortValue}/{windowValue}/{page}";

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var returnTag = await SendRequestAsync<Tag>(request).ConfigureAwait(false);
                return returnTag;
            }
        }
        /// <summary>
        ///     View gallery images for a subreddit.
        /// </summary>
        /// <param name="subreddit">A valid subreddit name. Example: pics, gaming</param>
        /// <param name="sort">The order that the gallery should be sorted by. Default: Time</param>
        /// <param name="window">The time period that should be used in filtering requests. Default: Week</param>
        /// <param name="page">The data paging number. Default: null</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task<IEnumerable<IGalleryImage>> GetSubredditGalleryAsync(string subreddit,
            SubredditGallerySortOrder? sort = SubredditGallerySortOrder.Time, TimeWindow? window = TimeWindow.Week,
            int? page = null)
        {
            if (string.IsNullOrWhiteSpace(subreddit))
                throw new ArgumentNullException(nameof(subreddit));

            sort = sort ?? SubredditGallerySortOrder.Time;
            window = window ?? TimeWindow.Week;

            var sortValue = $"{sort}".ToLower();
            var windowValue = $"{window}".ToLower();

            var url = $"gallery/r/{subreddit}/{sortValue}/{windowValue}/{page}";

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var gallery = await SendRequestAsync<IEnumerable<GalleryImage>>(request).ConfigureAwait(false);
                return gallery;
            }
        }
        /// <summary>
        /// Reads a TSP-TW problem from the given stream.
        /// </summary>
        /// <param name="stream"></param>
        /// <returns></returns>
        public static ITSPTW Read(Stream stream)
        {
            var streamReader = new StreamReader(stream);

            // first line has to contain problem size.
            var line = streamReader.ReadLine();
            var size = int.Parse(line);

            // read weights.
            var weights = new double[size][];
            for(int x = 0; x < size; x++)
            {
                line = streamReader.ReadLine();

                var lineWeights = new double[size];
                var lineSplit = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                for(int y = 0; y < size; y++)
                {
                    lineWeights[y] = double.Parse(lineSplit[y],
                        System.Globalization.NumberStyles.Any, System.Globalization.CultureInfo.InvariantCulture);
                }

                weights[x] = lineWeights;
            }

            // read timewindows.
            var windows = new TimeWindow[size];
            for (int x = 0; x < size; x++)
            {
                line = streamReader.ReadLine();

                var lineSplit = line.Split(new char[0], StringSplitOptions.RemoveEmptyEntries);
                windows[x] = new TimeWindow()
                {
                    Min = int.Parse(lineSplit[0]),
                    Max = int.Parse(lineSplit[1])
                };
            }
            return new TSPTWProblem(0, 0, weights, windows);
        }
Пример #36
0
        /// <summary>
        ///     Returns the images in the gallery.
        /// </summary>
        /// <param name="section">The gallery section. Default: Hot</param>
        /// <param name="sort">The order that the gallery should be sorted by. Default: Viral</param>
        /// <param name="window">The time period that should be used in filtering requests. Default: Day</param>
        /// <param name="page">The data paging number. Default: null</param>
        /// <param name="showViral">Show or hide viral images from the 'user' section. Default: true</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task<IEnumerable<IGalleryItem>> GetGalleryAsync(GallerySection? section = GallerySection.Hot,
            GallerySortOrder? sort = GallerySortOrder.Viral, TimeWindow? window = TimeWindow.Day, int? page = null,
            bool? showViral = true)
        {
            section = section ?? GallerySection.Hot;
            sort = sort ?? GallerySortOrder.Viral;
            window = window ?? TimeWindow.Week;
            showViral = showViral ?? true;

            var sectionValue = $"{section}".ToLower();
            var sortValue = $"{sort}".ToLower();
            var windowValue = $"{window}".ToLower();
            var showViralValue = $"{showViral}".ToLower();

            var url = $"gallery/{sectionValue}/{sortValue}/{windowValue}/{page}?showViral={showViralValue}";

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var gallery = await SendRequestAsync<IEnumerable<GalleryItem>>(request).ConfigureAwait(false);
                return gallery;
            }
        }
Пример #37
0
        /// <summary>
        ///     Search the gallery with a given query string.
        /// </summary>
        /// <param name="query">
        ///     Query string to search by. This parameter also supports boolean operators (AND, OR, NOT) and
        ///     indices (tag: user: title: ext: subreddit: album: meme:). An example compound query would be 'title: cats AND dogs
        ///     ext: gif'
        /// </param>
        /// <param name="sort">The order that the gallery should be sorted by. Default: Time</param>
        /// <param name="window">The time period that should be used in filtering requests. Default: Day</param>
        /// <param name="page">The data paging number. Default: null</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task<IEnumerable<IGalleryItem>> SearchGalleryAsync(string query,
            GallerySortOrder? sort = GallerySortOrder.Time,
            TimeWindow? window = TimeWindow.All, int? page = null)
        {
            if (string.IsNullOrWhiteSpace(query))
                throw new ArgumentNullException(nameof(query));

            sort = sort ?? GallerySortOrder.Time;
            window = window ?? TimeWindow.All;

            var sortValue = $"{sort}".ToLower();
            var windowValue = $"{window}".ToLower();

            var url = $"gallery/search/{sortValue}/{windowValue}/{page}";
            url = RequestBuilder.SearchGalleryRequest(url, query);

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var searchResults = await SendRequestAsync<IEnumerable<GalleryItem>>(request).ConfigureAwait(false);
                return searchResults;
            }
        }
Пример #38
0
        private void UpdateUI(HeartBeatType t, TimeWindow w , TDESample[] tde, AudioSample[] a)
        {
            try
            {
                SetLabels(t);
                text1.Text = client.HeartBeatText(t);
                text2.Text = beat.ToString();

                text03.Text = tde[0].Value().ToString();
                text04.Text = tde[1].Value().ToString();
                text05.Text = tde[2].Value().ToString();
                text06.Text = a[1].Align().ToString();
                text07.Text = a[1].MaxAmplitude().ToString();
                text08.Text = a[1].Average().ToString();

                text13.Text = tde[3].Value().ToString();
                text14.Text = tde[4].Value().ToString();
                text15.Text = tde[5].Value().ToString();
                text16.Text = a[2].Align().ToString();
                text17.Text = a[2].MaxAmplitude().ToString();
                text18.Text = a[2].Average().ToString();

                text23.Text = tde[6].Value().ToString();
                text24.Text = tde[7].Value().ToString();
                text25.Text = tde[8].Value().ToString();
                text06.Text = a[3].Align().ToString();
                text07.Text = a[3].MaxAmplitude().ToString();
                text08.Text = a[3].Average().ToString();

                switch (t)
                {
                    case HeartBeatType.DATA:
                    case HeartBeatType.INVALID:
                    case HeartBeatType.SILENCE:
                        buffering = 0;
                        rebootPending = false;
                        break;
                    case HeartBeatType.BUFFERING:
                        buffering++;
                        break;
                    case HeartBeatType.DEVICE_ERROR:
                        rebootPending = true;
                        ResetEngine(10, "ERROR");
                        break;
                    case HeartBeatType.NODEVICE:
                        rebootPending = true;
                        break;
                }

                if (buffering == 30) { rebootPending = true; }
                else if (buffering >= 10 && buffering % 10 == 0) { ResetEngine(10, "RESET"); }
                
                if (t != HeartBeatType.BUFFERING) canvas.Children.Clear();
                if (t == HeartBeatType.DATA)
                {
                    SoundDirection(w.Samples(), 0.3, -1 * tde[0].Value(), 600, 200, 0, 200, new SolidColorBrush(Colors.Red), 4);
                    SoundDirection(w.Samples(), 0.3, -1 * tde[1].Value(), 600, 200, 0, 200, new SolidColorBrush(Colors.Green), 2);
                    SoundDirection(w.Samples(), 0.3, -1 * tde[2].Value(), 600, 200, 0, 200, new SolidColorBrush(Colors.Blue), 1);
                    samples++;       
                }
                text9.Text = samples.ToString();
            }
            catch (Exception ex)
            {
                Error("UpdateUI: " + ex.ToString() + " " + ex.Message + " " + ex.HResult);
            }
        }
Пример #39
0
 private void ThreadDelegate(HeartBeatType t, TimeWindow w , TDESample[] tde, AudioSample[] a)
 {
     try
     {
         var ign = Dispatcher.RunAsync(CoreDispatcherPriority.Low, () =>
         {
             lock(accessLock)
             {
                 beat++;
                 if (w != null && tde != null && a != null)
                 {
                     var l = w.End();
                     if (t == HeartBeatType.BUFFERING)
                     {
                         l = w.Begin();
                         UpdateUI(t, w, tde, a);
                     }
                     UpdateUI(t, w, tde, a);
                     //client.AddMessage(t, cc0, asdf0, peak0, max0, max1, ave0, ave1, ave_all, beat, b - lastTimeStamp, l - b);
                     lastTimeStamp = l;
                 }
             }
         });
     }
     catch (Exception ex)            {
         Error("ThreadDelegate: " + ex.ToString() + " " + ex.Message + " " + ex.HResult);
     }        
 }
Пример #40
0
 public TimeWindowSelector()
 {
     InitializeComponent();
     timeWindow1 = new TimeSeries.TimeWindow();
     EnableDates(this, EventArgs.Empty);
 }
Пример #41
0
        /// <summary>
        ///     View gallery items for a topic.
        /// </summary>
        /// <param name="topicId">
        ///     The ID or URL-formatted name of the topic. If using a topic's name, replace its spaces with
        ///     underscores (Mother's_Day).
        /// </param>
        /// <param name="sort">The order that the gallery should be sorted by. Default: Viral</param>
        /// <param name="window">The time period that should be used in filtering requests. Default: Week</param>
        /// <param name="page">The data paging number. Default: null</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task<IEnumerable<IGalleryItem>> GetGalleryTopicItemsAsync(string topicId,
            CustomGallerySortOrder? sort = CustomGallerySortOrder.Viral, TimeWindow? window = TimeWindow.Week,
            int? page = null)
        {
            if (string.IsNullOrWhiteSpace(topicId))
                throw new ArgumentNullException(nameof(topicId));

            sort = sort ?? CustomGallerySortOrder.Viral;
            window = window ?? TimeWindow.Week;

            var sortValue = $"{sort}".ToLower();
            var windowValue = $"{window}".ToLower();
            var url = $"topics/{topicId.Replace(" ", "_")}/{sortValue}/{windowValue}/{page}";

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var items = await SendRequestAsync<IEnumerable<GalleryItem>>(request).ConfigureAwait(false);
                return items;
            }
        }
        /// <summary>
        ///     Retrieve user's filtered out gallery.
        ///     OAuth authentication required.
        /// </summary>
        /// <param name="sort">The order that the gallery should be sorted by. Default: Viral</param>
        /// <param name="window">The time period that should be used in filtering requests. Default: Week</param>
        /// <param name="page">Set the page number so you don't have to retrieve all the data at once. Default: null</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task<ICustomGallery> GetFilteredOutGalleryAsync(
            CustomGallerySortOrder? sort = CustomGallerySortOrder.Viral, TimeWindow? window = TimeWindow.Week,
            int? page = null)
        {
            if (ApiClient.OAuth2Token == null)
                throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);

            sort = sort ?? CustomGallerySortOrder.Viral;
            window = window ?? TimeWindow.Week;

            var sortValue = $"{sort}".ToLower();
            var windowValue = $"{window}".ToLower();
            var url = $"g/filtered/{sortValue}/{windowValue}/{page}";

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var gallery = await SendRequestAsync<CustomGallery>(request).ConfigureAwait(false);
                return gallery;
            }
        }
Пример #43
0
 /// <summary>
 ///   Creates order data. Location of the order is random, as well
 ///   as its demand (quantity), time window and penalty.  ///
 ///   </summary>
 /// <param name="number_of_orders"> number of orders to build. </param>
 /// <param name="x_max"> maximum x coordinate in which orders are located.
 /// </param>
 /// <param name="y_max"> maximum y coordinate in which orders are located.
 /// </param>
 /// <param name="demand_max"> maximum quantity of a demand. </param>
 /// <param name="time_window_max"> maximum starting time of the order time
 /// window. </param>
 /// <param name="time_window_width"> duration of the order time window.
 /// </param>
 /// <param name="penalty_min"> minimum pernalty cost if order is dropped.
 /// </param>
 /// <param name="penalty_max"> maximum pernalty cost if order is dropped.
 /// </param>
 private void BuildOrders(int number_of_orders,
                          int number_of_vehicles,
                          int x_max, int y_max,
                          int demand_max,
                          int time_window_max,
                          int time_window_width,
                          int penalty_min,
                          int penalty_max) {
   Console.WriteLine("Building orders.");
   locations_ = new Position[number_of_orders + 2 * number_of_vehicles];
   order_demands_ = new int[number_of_orders];
   order_time_windows_ = new TimeWindow[number_of_orders];
   order_penalties_ = new int[number_of_orders];
   for (int order = 0; order < number_of_orders; ++order) {
     locations_[order] =
         new Position(random_generator.Next(x_max + 1),
                      random_generator.Next(y_max + 1));
     order_demands_[order] = random_generator.Next(demand_max + 1);
     int time_window_start = random_generator.Next(time_window_max + 1);
     order_time_windows_[order] =
         new TimeWindow(time_window_start,
                        time_window_start + time_window_width);
     order_penalties_[order] =
         random_generator.Next(penalty_max - penalty_min + 1) + penalty_min;
   }
 }
Пример #44
0
        /// <summary>
        ///     Search the gallery with a given query string.
        /// </summary>
        /// <param name="qAll">Search for all of these words (and).</param>
        /// <param name="qAny">Search for any of these words (or).</param>
        /// <param name="qExactly">Search for exactly this word or phrase.</param>
        /// <param name="qNot">Exclude results matching this word or phrase.</param>
        /// <param name="fileType">Show results for a specific file type.</param>
        /// <param name="imageSize">Show results for a specific image size.</param>
        /// <param name="sort">The order that the gallery should be sorted by. Default: Time</param>
        /// <param name="window">The time period that should be used in filtering requests. Default: Day</param>
        /// <param name="page">The data paging number. Default: null</param>
        /// <exception cref="ArgumentNullException">
        ///     Thrown when a null reference is passed to a method that does not accept it as a
        ///     valid argument.
        /// </exception>
        /// <exception cref="ImgurException">Thrown when an error is found in a response from an Imgur endpoint.</exception>
        /// <exception cref="MashapeException">Thrown when an error is found in a response from a Mashape endpoint.</exception>
        /// <returns></returns>
        public async Task<IEnumerable<IGalleryItem>> SearchGalleryAdvancedAsync(
            string qAll = null, string qAny = null,
            string qExactly = null, string qNot = null,
            ImageFileType? fileType = null, ImageSize? imageSize = null,
            GallerySortOrder? sort = GallerySortOrder.Time,
            TimeWindow? window = TimeWindow.All, int? page = null)
        {
            if (string.IsNullOrWhiteSpace(qAll) &&
                string.IsNullOrWhiteSpace(qAny) &&
                string.IsNullOrWhiteSpace(qExactly) &&
                string.IsNullOrWhiteSpace(qNot))
                throw new ArgumentNullException(null,
                    "At least one search parameter must be provided (All | Any | Exactly | Not).");

            sort = sort ?? GallerySortOrder.Time;
            window = window ?? TimeWindow.All;

            var sortValue = $"{sort}".ToLower();
            var windowValue = $"{window}".ToLower();

            var url = $"gallery/search/{sortValue}/{windowValue}/{page}";
            url = RequestBuilder.SearchGalleryAdvancedRequest(url, qAll, qAny, qExactly, qNot, fileType,
                imageSize);

            using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
            {
                var searchResults = await SendRequestAsync<IEnumerable<GalleryItem>>(request).ConfigureAwait(false);
                return searchResults;
            }
        }