private void SaveAndApplyOptions()
        {
            SaveOptions();
            ClockType clockType = ClockType.Digital;

            // Apply on MainForm(s)
            switch (Options.ClockType)
            {
            case "Digital":
                clockType = ClockType.Digital;
                break;

            case "Analog":
                clockType = ClockType.Analog;
                break;

            case "DoubleDigital":
                clockType = ClockType.DoubleDigital;
                break;

            default:
                break;
            }

            ApplyOnGame(rdbClocks_N_1d4.Checked, clockType);

            OnOptionsApplied();
        }
Example #2
0
        internal bool AddReminder(BarFactoryItem item, DateTime dateTime, ClockType type)
        {
            bool created = false;
            SortedList <long, List <BarFactoryItem> > slistByBarSize;

            if (!this.reminderTable.TryGetValue(dateTime, out slistByBarSize))
            {
                slistByBarSize = new SortedList <long, List <BarFactoryItem> >();
                this.reminderTable.Add(dateTime, slistByBarSize);
                created = true;
            }

            List <BarFactoryItem> list;

            if (!slistByBarSize.TryGetValue(item.barSize, out list))
            {
                list = new List <BarFactoryItem>();
                slistByBarSize.Add(item.barSize, list);
            }

            list.Add(item);

            if (created)
            {
                var clock = type == ClockType.Exchange ? this.framework.ExchangeClock : this.framework.Clock;
                return(clock.AddReminder(OnReminder, dateTime));
            }
            return(true);
        }
Example #3
0
    /// <summary>
    /// Verifica quanto tempo foi passado
    /// </summary>
    /// <param name="clockType">Tipo do relógio (StopWatcher|Countdown)</param>
    /// <returns></returns>
    public int ElapsedTime(ClockType clockType)
    {
        if (clockType == ClockType.StopWatch)
            return Mathf.CeilToInt(m_ElapsedTime);

        return Mathf.CeilToInt(m_TotalSeconds - m_ElapsedTime);
    }
        public void Test()
        {
            var brand = new Brand
            {
                Title = "Brand 1"
            };

            var clockType = new ClockType
            {
                Title = "Clock Type 1"
            };

            var payment = new Payment
            {
                Title = "Payment 1"
            };

            var delivery = new Delivery
            {
                Title = "Delivery 1"
            };

            _brandRepository.Add(brand);
            _clockTypeRepository.Add(clockType);
            _paymentRepository.Add(payment);
            _deliveryRepository.Add(delivery);
        }
Example #5
0
        public void Remove(Instrument instrument, BarType barType, long barSize, BarInput barInput = BarInput.Trade,
                           ClockType type = ClockType.Local)
        {
            BarFactoryItem item;

            switch (barType)
            {
            case BarType.Time:
                item = new TimeBarFactoryItem(instrument, barSize, barInput, type, -1);
                break;

            case BarType.Tick:
                item = new TickBarFactoryItem(instrument, barSize, barInput, -1);
                break;

            case BarType.Volume:
                item = new VolumeBarFactoryItem(instrument, barSize, barInput, -1);
                break;

            case BarType.Range:
                item = new RangeBarFactoryItem(instrument, barSize, barInput, -1);
                break;

            case BarType.Session:
                throw new ArgumentException(
                          "BarFactory::Remove Can not create SessionBarFactoryItem without session parameters");

            default:
                throw new ArgumentException($"Unknown bar type - {barType}");
            }
            Remove(item);
        }
        public void ClockTypeExtensionsClass_SetControlsVisibleIn12HourModeMethod_DoesNotCrash_IfSecondParameterIsNull()
        {
            ClockType       testValue  = _rnd.NextBoolean() ? ClockType.TwelveHourClock : ClockType.TwentyFourHourClock;
            IList <Control> testParam1 = null;

            testValue.SetControlsVisibleIn12HourMode(testParam1);
        }
 /// <inheritdoc/>
 public override bool IsValid(ClockType mode = ClockType.TwelveHour)
 {
     return(mode switch
     {
         ClockType.TwelveHour => Time.IsValidTimeOfDay(13),
         ClockType.TwentyFourHour => throw  new NotSupportedException("A qualified time of day cannot be judged based on a twenty four hour clock style."),
         _ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null)
     });
Example #8
0
 public void Add(InstrumentList instruments, BarType barType, long barSize, BarInput barInput = BarInput.Trade,
                 ClockType type = ClockType.Local, int providerId = -1)
 {
     foreach (var i in instruments)
     {
         Add(i, barType, barSize, barInput, type, providerId);
     }
 }
Example #9
0
 public void Add(string[] symbols, BarType barType, long barSize, BarInput barInput = BarInput.Trade,
                 ClockType type = ClockType.Local, int providerId = -1)
 {
     foreach (var symbol in symbols)
     {
         Add(this.framework.InstrumentManager.Get(symbol), barType, barSize, barInput, type, providerId);
     }
 }
Example #10
0
 /// <summary>
 /// Checks if the value of the <see cref="TimeSpan"/> is valid for the given <see cref="ClockType"/>
 /// </summary>
 /// <param name="time">The time to perform the action on</param>
 /// <param name="clockType">The clock type used to judge</param>
 /// <returns>A <see cref="bool"/> that determines if the time is valid</returns>
 /// <exception cref="ArgumentOutOfRangeException"></exception>
 public static bool IsValidTimeOfDay(this TimeSpan time, ClockType clockType)
 {
     return(clockType switch
     {
         ClockType.TwelveHour => time.IsValidTimeOfDay(13), //thirteen because 12:34 is a valid time
         ClockType.TwentyFourHour => time.IsValidTimeOfDay(24),
         _ => throw new ArgumentOutOfRangeException(nameof(clockType), clockType, null)
     });
Example #11
0
 /// <summary>
 /// Checks if the time represented is valid.
 /// </summary>
 /// <param name="mode">Sets the mode to judge the time by.</param>
 /// <returns>A <see cref="bool"/> that indicates whether the time is valid.</returns>
 /// <exception cref="ArgumentOutOfRangeException"></exception>
 public virtual bool IsValid(ClockType mode = ClockType.TwelveHour)
 {
     return(mode switch
     {
         ClockType.TwelveHour => Time.IsValidTimeOfDay(13),
         ClockType.TwentyFourHour => Time.IsValidTimeOfDay(24),
         _ => throw new ArgumentOutOfRangeException(nameof(mode), mode, null) //resharper on crack? dont know
     });
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                await ElementReferenceId.SetAnalogClock(JSRuntimeObj, ClockType.GetHashCode());

                base.StateHasChanged();
            }
        }
Example #13
0
        /// <summary>
        /// Tells the AMPS box which clock to use: external or internal
        /// </summary>
        /// <param name="clockType">
        /// </param>
        /// <returns>
        /// The <see cref="Task"/>.
        /// </returns>
        public async Task <Unit> SetClock(ClockType clockType)
        {
            var ampsmessage = Message.Create(AmpsCommand.STBLCLK, clockType.ToString());

            messageQueue.Enqueue(ampsmessage);
            await ProcessQueue();

            return(Unit.Default);
        }
Example #14
0
 /// <summary>
 /// Constructor for a GameTimer
 /// </summary>
 /// <param name="clock">Real Time or Game Time</param>
 /// <param name="seconds">Seconds to time out on</param>
 public GameTimer(ClockType clock, double seconds)
 {
     this.clock   = clock;
     this.seconds = seconds;
     if (this.seconds == 0)
     {
         this.seconds = 1.0f;
     }
 }
Example #15
0
 private static DocumentOptions GetDocumentOptions(ClockType clockType)
 {
     return(new DocumentOptions
     {
         ClockType = clockType,
         DisplayTrainLabelsOnGraphs = _rnd.NextBoolean(),
         GraphEditStyle = _rnd.NextBoolean() ? GraphEditStyle.Free : GraphEditStyle.PreserveSectionTimes,
     });
 }
Example #16
0
 //Type of OR-Clock -> analog, digital
 public Clock(STFReader stf, string shapePath)
 {
     stf.MustMatch("(");
     Name = shapePath + stf.ReadString();
     if (EnumExtension.GetValue(stf.ReadString(), out ClockType type))
     {
         ClockType = type;
     }
     stf.SkipRestOfBlock();
 }
Example #17
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="clockType">Type of clock to use.</param>
        /// <param name="conventionalMoves">Number of moves that must be taken before time runs out with the conventional clock.</param>
        /// <param name="conventionalTime">Amount of time a player has to take the specified amount of moves with the conventional clock.</param>
        /// <param name="incrementStartTime">Start time if using the incremental clock.</param>
        /// <param name="incrementPlusTime">Time added for avery move taken with the incremental clock.</param>
        public ClockConfiguration(ClockType clockType, int conventionalMoves, TimeSpan conventionalTime, TimeSpan incrementStartTime, TimeSpan incrementPlusTime)
        {
            m_clockType = clockType;

            m_conventionalMoves = conventionalMoves;
            m_conventionalTime  = conventionalTime;

            m_incrementStartTime = incrementStartTime;
            m_incrementPlusTime  = incrementPlusTime;
        }
Example #18
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="clockType">Type of clock to use.</param>
        /// <param name="conventionalMoves">Number of moves that must be taken before time runs out with the conventional clock.</param>
        /// <param name="conventionalTime">Amount of time a player has to take the specified amount of moves with the conventional clock.</param>
        /// <param name="incrementStartTime">Start time if using the incremental clock.</param>
        /// <param name="incrementPlusTime">Time added for avery move taken with the incremental clock.</param>
        public ClockConfiguration(ClockType clockType, int conventionalMoves, TimeSpan conventionalTime, TimeSpan incrementStartTime, TimeSpan incrementPlusTime)
        {
            m_clockType = clockType;

              m_conventionalMoves = conventionalMoves;
              m_conventionalTime = conventionalTime;

              m_incrementStartTime = incrementStartTime;
              m_incrementPlusTime = incrementPlusTime;
        }
Example #19
0
 public QBTimeBarFactoryItem(Instrument instrument, long barSize, bool enableLog = false)
     : base(instrument, barSize, BarInput.Trade, ClockType.Exchange)
 {
     _enableLog = enableLog;
     if (_enableLog)
     {
         _logger = LogManager.GetLogger("tbf." + instrument.Symbol);
     }
     _clockType = ClockType.Exchange;
     LoadTradingTimeRange();
 }
Example #20
0
 public QBTimeBarFactoryItem(Instrument instrument, long barSize, bool enableLog = false)
     : base(instrument, barSize, BarInput.Trade, ClockType.Exchange)
 {
     _enableLog = enableLog;
     if (_enableLog)
     {
         _logger = LogManager.GetLogger("tbg." + instrument.Symbol);
     }
     IncludeFirstTick = true;
     _timeRange       = MarketDataFilter.Instance.GetFilter(instrument);
     _clockType       = ClockType.Exchange;
 }
Example #21
0
        /// <summary>
        /// Extension method that takes a list of <see cref="Control" /> objects and sets them to visible if the <see cref="ClockType" /> is the 12-hour clock.
        /// </summary>
        /// <param name="clockType">The <see cref="ClockType" /> to use to determine the objects' visibility.</param>
        /// <param name="controls">The <see cref="Control" /> objects to control the visibility of.</param>
        public static void SetControlsVisibleIn12HourMode(this ClockType clockType, IList <Control> controls)
        {
            if (controls is null)
            {
                return;
            }
            bool visibility = clockType == ClockType.TwelveHourClock;

            foreach (Control control in controls)
            {
                control.Visible = visibility;
            }
        }
Example #22
0
 public Clock(Framework framework, ClockType type = ClockType.Local, bool isStandalone = false)
 {
     this.framework    = framework;
     Type              = type;
     this.isStandalone = isStandalone;
     this.dateTime     = DateTime.MinValue;
     this.mode         = this.framework.Mode == FrameworkMode.Realtime ? ClockMode.Realtime : ClockMode.Simulation;
     this.initTicks    = DateTime.Now.Ticks;
     this.stopwatch    = Stopwatch.StartNew();
     if (this.isStandalone)
     {
         throw new NotImplementedException("don't know when to use it");
     }
 }
Example #23
0
        public Lap(int LapNumber, ClockType ClockType, int Hour, int Minute, float Second)
        {
            assignLapNumber(LapNumber);

            if (ClockType == ClockType.Lap)
            {
                this.lapTime = TimeSpan.FromHours(Hour) + TimeSpan.FromMinutes(Minute) + TimeSpan.FromSeconds(Math.Round(Second, 3));
            }

            if (ClockType == ClockType.Split)
            {
                this.splitTime = TimeSpan.FromHours(Hour) + TimeSpan.FromMinutes(Minute) + TimeSpan.FromSeconds(Math.Round(Second, 3));
            }
        }
Example #24
0
        public void NewGame()
        {
            ClockType = ClockType.Digital;
            lblWhiteTime.ForeColor = Color.White;
            lblBlackTime.ForeColor = Color.White;

            SetClockType();

            ResizeWhite();
            ResizeBlack();
            RefreshClock();

            SetMinSize();
        }
        public void TimeOfDayExtensionsClass_SetTimeMethod_ThrowsArgumentNullException_IfSecondParameterIsNull()
        {
            TimeOfDay testObject = new TimeOfDay();
            TextBox   testParam1 = null;

            using (TextBox testParam2 = new TextBox())
                using (ComboBox testParam3 = new ComboBox())
                {
                    ClockType testParam4 = _rnd.NextBoolean() ? ClockType.TwelveHourClock : ClockType.TwentyFourHourClock;

                    testObject.SetTime(testParam1, testParam2, testParam3, testParam4);

                    Assert.Fail();
                }
        }
Example #26
0
        private void ApplyOnGame(bool isSingleNotation, ClockType clockType)
        {
            MainForm mainForm = null;

            foreach (Form frm in Application.OpenForms)
            {
                if (frm.GetType().BaseType == typeof(MainForm))
                {
                    mainForm = frm as MainForm;
                    mainForm.Game.Notations.DisplayNotation(isSingleNotation);
                    mainForm.ClockUc.ClockType = clockType;
                    mainForm.ClockUc.RefreshClock();
                }
            }
        }
Example #27
0
    public Clock(ClockParams value, System.Action _callBack)
    {
        this.type = value.type;
        switch (this.type)
        {
        case ClockType.UnityTimeClock:
            this.endSecond = Time.time + value.second;
            break;

        case ClockType.UnityRealTimeClock:
            this.endSecond = Time.realtimeSinceStartup + value.second;
            break;

        case ClockType.DateTimeClock:
            this.endDateTime = DateTime.Now + new TimeSpan((int)(TimeSpan.TicksPerSecond * value.second));
            break;

        default:
            break;
        }

        this.repeat   = value.repeat;
        this.interval = value.interval;

        if (repeat)
        {
            switch (this.type)
            {
            case ClockType.UnityTimeClock:
                this.nextAlarmSecond = Time.time + value.interval;
                break;

            case ClockType.UnityRealTimeClock:
                this.nextAlarmSecond = Time.realtimeSinceStartup + value.interval;
                break;

            case ClockType.DateTimeClock:
                this.endDateTime = DateTime.Now + new TimeSpan((int)(TimeSpan.TicksPerSecond * value.interval));
                break;

            default:
                break;
            }
        }

        this.onAlarm = _callBack;
    }
        protected override void Seed(ClockRestorationContext context)
        {
            var adminRole = new IdentityRole();

            adminRole.Name = "admin";
            var userRole = new IdentityRole();

            userRole.Name = "user";

            var admin = new ApplicationUser();

            admin.UserName     = "******";
            admin.FirstName    = "Admin";
            admin.LastName     = "Admin";
            admin.PhoneNumber  = "+123123123";
            admin.Email        = "*****@*****.**";
            admin.PasswordHash = "PAssword123".GetHashCode().ToString();
            admin.Role         = UserRole.Admin;

            var brand = new Brand();

            brand.Title = "Brand 1";

            var clockType = new ClockType();

            clockType.Title = "Clock Type 1";

            var payment = new Payment();

            payment.Title = "Payment 1";

            var delivery = new Delivery();

            delivery.Title = "Delivery 1";

            context.Payments.Add(payment);
            context.Roles.Add(adminRole);
            context.Roles.Add(userRole);
            context.Users.Add(admin);
            context.Brands.Add(brand);
            context.ClockTypes.Add(clockType);
            context.Deliveries.Add(delivery);

            context.SaveChanges();
        }
        public void TimeOfDayExtensionsClass_SetTimeMethod_ThrowsArgumentNullExceptionWithCorrectParamNameProperty_IfSecondParameterIsNull()
        {
            TimeOfDay testObject = new TimeOfDay();
            TextBox   testParam1 = null;

            using (TextBox testParam2 = new TextBox())
                using (ComboBox testParam3 = new ComboBox())
                {
                    ClockType testParam4 = _rnd.NextBoolean() ? ClockType.TwelveHourClock : ClockType.TwentyFourHourClock;

                    try
                    {
                        testObject.SetTime(testParam1, testParam2, testParam3, testParam4);
                        Assert.Fail();
                    }
                    catch (ArgumentNullException ex)
                    {
                        Assert.AreEqual("tbHour", ex.ParamName);
                    }
                }
        }
Example #30
0
        /// <summary>
        /// Convert this object into a pair of strings, one for the start time and one for the finish time.
        /// </summary>
        /// <param name="clockType">Whether to use the 12-hour or 24-hour clock format.</param>
        /// <returns>An array of strings of two elements, element 0 being the formatted start time and element 1 being the formatted finish time.</returns>
        public string[] ToStrings(ClockType clockType)
        {
            string timeFormatFormat;
            string noTokenWarning;

            if (clockType == ClockType.TwelveHourClock)
            {
                timeFormatFormat = "ht{0}mm";
                noTokenWarning   = string.Empty;
            }
            else
            {
                timeFormatFormat = "HH{0}mm";
                noTokenWarning   = " ";
            }

            string startTime = FormatTime(StartTime, timeFormatFormat, noTokenWarning);
            string endTime   = FormatTime(EndTime, timeFormatFormat, noTokenWarning);

            return(new[] { startTime, endTime });
        }
        public void CheckClocktype()
        {
            var clocksType = _clockTypeRepository.GetAll();

            if (clocksType.Count != 3)
            {
                _clockTypeRepository.DeleteRange(clocksType);

                var clockType1 = new ClockType();
                clockType1.Title = "Наручные часы";

                var clockType2 = new ClockType();
                clockType2.Title = "Интерьерные часы";

                var clockType3 = new ClockType();
                clockType3.Title = "Карманные часы";

                _clockTypeRepository.Add(clockType1);
                _clockTypeRepository.Add(clockType2);
                _clockTypeRepository.Add(clockType3);
            }
        }
Example #32
0
        private void SetClockType()
        {
            ClockType clockType = ClockType.Digital;

            switch (Ap.Options.ClockType)
            {
            case "Digital":
                clockType = ClockType.Digital;
                break;

            case "Analog":
                clockType = ClockType.Analog;
                break;

            case "DoubleDigital":
                clockType = ClockType.DoubleDigital;
                break;

            default:
                break;
            }
            this.SetClockType(clockType);
        }
Example #33
0
 public void Add(string symbol, BarType barType, long barSize, BarInput barInput = BarInput.Trade,
     ClockType type = ClockType.Local, int providerId = -1)
 {
     Add(this.framework.InstrumentManager[symbol], barType, barSize, barInput, type, providerId);
 }
Example #34
0
 public SessionBarFactoryItem(Instrument instrument, BarInput barInput, ClockType type, TimeSpan session1, TimeSpan session2, int providerId = -1)
     : base(instrument, BarType.Session, (long)(session2 - session1).TotalSeconds, barInput, session1, session2, providerId)
 {
     this.type = type;
 }
Example #35
0
 private void labelFlash_Click(object sender, EventArgs e)
 {
     this.previewClockType = ClockType.Flash;
     this.picBoxPreview.Invalidate();
 }
Example #36
0
        internal bool AddReminder(BarFactoryItem item, DateTime dateTime, ClockType type)
        {
            bool created = false;
            SortedList<long, List<BarFactoryItem>> slistByBarSize;
            if (!this.reminderTable.TryGetValue(dateTime, out slistByBarSize))
            {
                slistByBarSize = new SortedList<long, List<BarFactoryItem>>();
                this.reminderTable.Add(dateTime, slistByBarSize);
                created = true;
            }

            List<BarFactoryItem> list;
            if (!slistByBarSize.TryGetValue(item.barSize, out list))
            {
                list = new List<BarFactoryItem>();
                slistByBarSize.Add(item.barSize, list);
            }

            list.Add(item);

            if (created)
            {
                var clock = type == ClockType.Exchange ? this.framework.ExchangeClock : this.framework.Clock;
                return clock.AddReminder(OnReminder, dateTime);
            }
            return true;
        }
Example #37
0
 public void Add(string symbol, BarInput barInput, ClockType type, TimeSpan session1, TimeSpan session2,
     int providerId = -1)
 {
     Add(this.framework.InstrumentManager[symbol], BarType.Session, (session2 - session1).Seconds, barInput, type,
         session1, session2, providerId);
 }
Example #38
0
 public void Add(string symbol, BarType barType, long barSize, BarInput barInput, ClockType type,
     TimeSpan session1, TimeSpan session2, int providerId = -1)
 {
     Add(this.framework.InstrumentManager[symbol], barType, barSize, barInput, type, session1, session2,
         providerId);
 }
Example #39
0
 public void Add(InstrumentList instruments, BarType barType, long barSize, BarInput barInput = BarInput.Trade,
     ClockType type = ClockType.Local, int providerId = -1)
 {
     foreach (var i in instruments)
         Add(i, barType, barSize, barInput, type, providerId);
 }
Example #40
0
 public Clock(Framework framework, ClockType type = ClockType.Local, bool isStandalone = false)
 {
     this.framework = framework;
     Type = type;
     this.isStandalone = isStandalone;
     this.dateTime = DateTime.MinValue;
     this.mode = this.framework.Mode == FrameworkMode.Realtime ? ClockMode.Realtime : ClockMode.Simulation;
     this.initTicks = DateTime.Now.Ticks;
     this.stopwatch = Stopwatch.StartNew();
     if (this.isStandalone)
     {
         throw new NotImplementedException("don't know when to use it");
     }
 }
 /// <summary>
 /// Converts the timespec to desired clock type.
 /// </summary>
 public Timespec ToClockType(ClockType targetClock)
 {
     return Native.gprsharp_convert_clock_type(this, targetClock);
 }
Example #42
0
 private void labelRecord_Click(object sender, EventArgs e)
 {
     this.previewClockType = ClockType.NewRecord;
     this.picBoxPreview.Invalidate();
 }
 public Timespec(long tv_sec, int tv_nsec, ClockType clock_type)
 {
     this.tv_sec = tv_sec;
     this.tv_nsec = tv_nsec;
     this.clock_type = clock_type;
 }
Example #44
0
 public void Add(string[] symbols, BarType barType, long barSize, BarInput barInput = BarInput.Trade,
     ClockType type = ClockType.Local, int providerId = -1)
 {
     foreach (var symbol in symbols)
         Add(this.framework.InstrumentManager.Get(symbol), barType, barSize, barInput, type, providerId);
 }
Example #45
0
		/// <summary>
		/// Gets the clock frequency of the specified clock.
		/// </summary>
		/// <returns>
		/// The clock frequency, if successful; Otherwise, -1.
		/// </returns>
		/// <param name="type">
		/// The clock type to get the frequency of.
		/// </param>
		public static long GetClockFrequency(ClockType type) {
			return GetClockFrequency(Enum.GetName(typeof(ClockType), type).ToLower());
		}
Example #46
0
 public void Add(Instrument instrument, BarType barType, long barSize, BarInput barInput, ClockType type,
     TimeSpan session1, TimeSpan session2, int providerId = -1)
 {
     BarFactoryItem item;
     switch (barType)
     {
         case BarType.Time:
             item = new TimeBarFactoryItem(instrument, barSize, barInput, type, session1, session2, providerId);
             break;
         case BarType.Tick:
             item = new TickBarFactoryItem(instrument, barSize, barInput, session1, session2, providerId);
             break;
         case BarType.Volume:
             item = new VolumeBarFactoryItem(instrument, barSize, barInput, session1, session2, providerId);
             break;
         case BarType.Range:
             item = new RangeBarFactoryItem(instrument, barSize, barInput, session1, session2, providerId);
             break;
         case BarType.Session:
             item = new SessionBarFactoryItem(instrument, barInput, type, session1, session2, providerId);
             break;
         default:
             throw new ArgumentException($"Unknown bar type - {barType}");
     }
     Add(item);
 }
Example #47
0
 protected virtual DateTime GetDataObjectDateTime(DataObject obj, ClockType type)
 {
     return type == ClockType.Local ? obj.DateTime : ((Tick)obj).ExchangeDateTime;
 }
Example #48
0
 public void Remove(Instrument instrument, BarType barType, long barSize, BarInput barInput = BarInput.Trade,
     ClockType type = ClockType.Local)
 {
     BarFactoryItem item;
     switch (barType)
     {
         case BarType.Time:
             item = new TimeBarFactoryItem(instrument, barSize, barInput, type, -1);
             break;
         case BarType.Tick:
             item = new TickBarFactoryItem(instrument, barSize, barInput, -1);
             break;
         case BarType.Volume:
             item = new VolumeBarFactoryItem(instrument, barSize, barInput, -1);
             break;
         case BarType.Range:
             item = new RangeBarFactoryItem(instrument, barSize, barInput, -1);
             break;
         case BarType.Session:
             throw new ArgumentException(
                 "BarFactory::Remove Can not create SessionBarFactoryItem without session parameters");
         default:
             throw new ArgumentException($"Unknown bar type - {barType}");
     }
     Remove(item);
 }
Example #49
0
 protected bool AddReminder(DateTime datetime, ClockType type) => this.factory.AddReminder(this, datetime, type);
Example #50
0
 /// <summary>
 /// Initializes a new ClockEventArgs,
 /// </summary>
 /// <param name="clockType">Type of clock raising the event.</param>
 /// <param name="time">Time of the clock.</param>
 /// <param name="timeOut">True if time has run out, false otherwise.</param>
 internal ClockEventArgs(ClockType clockType, TimeSpan time, bool timeOut)
 {
     m_clockType = clockType;
       m_time = time;
       m_timeOut = timeOut;
 }
Example #51
0
 public TimeBarFactoryItem(Instrument instrument, long barSize, BarInput barInput = BarInput.Trade, ClockType type = ClockType.Local, int providerId = -1)
     : base(instrument, BarType.Time, barSize, barInput, providerId)
 {
     this.type = type;
 }
 public void LogClock(DateTime timeStamp, ClockType clockType, bool isOverride)
 {
     Debug.WriteLine(clockType + ": " + timeStamp + " - " + isOverride);
 }
Example #53
0
 public TimeBarFactoryItem(Instrument instrument, long barSize, BarInput barInput, ClockType type, TimeSpan session1, TimeSpan session2, int providerId = -1)
     : base(instrument, BarType.Time, barSize, barInput, session1, session2, providerId)
 {
     this.type = type;
 }
Example #54
0
 private void labelNoLoaded_Click(object sender, EventArgs e)
 {
     this.previewClockType = ClockType.NoRun;
     this.picBoxPreview.Invalidate();
 }
Example #55
0
 private void labelBehindLosing_Click(object sender, EventArgs e)
 {
     this.previewClockType = ClockType.BehindLosing;
     this.picBoxPreview.Invalidate();
 }