public override void Init(IEntity entity)
 {
     base.Init(entity);
     IImageComponent image = entity.GetComponent<IImageComponent>();
     TypedParameter imageParam = new TypedParameter(typeof(IHasImage), image);
     _scale = _resolver.Resolve<IScale>(imageParam);
 }
        public AggregateBars(IDataManager data, ISymbol symbol, IScale scale)
        {
            l.Info("Создаем AggregateBars для " + symbol + " " + scale);
            if (scale.scaleType != ScaleEnum.sec)
                throw new NotImplementedException("поддерживаются только ТАЙМ фреймы");

            this.symbol = symbol;
            this.scale = scale;
            this.debKey = "(" + symbol + "." + scale + ") ";
            m_TickBars = data.GetBars(symbol, data.GetScale(ScaleEnum.tick, 1));
            m_TickBars.Lock.AcquireReaderLock(1000);
            try
            {
                IBar bar = m_TickBars.First;
                while (bar != null)
                {
                    m_TickBars_NewBarEvent(m_TickBars, new BarsEventArgs(this,bar));
                    bar = m_TickBars.GetNext(bar);
                }
                m_TickBars.NewBarEvent += new EventHandler<BarsEventArgs>(m_TickBars_NewBarEvent);
                m_TickBars.ChangeBarEvent += new EventHandler<BarsEventArgs>(m_TickBars_ChangeBarEvent);
            }
            finally
            {
                m_TickBars.Lock.ReleaseReaderLock();
            }
        }
Exemple #3
0
		public override void Init(IEntity entity)
		{
			base.Init(entity);
			_drawableInfo = entity.GetComponent<IDrawableInfo>();
			_obj = entity.GetComponent<IAnimationContainer>();
            _scale = entity.GetComponent<IScaleComponent>();
            _pixelPerfect = entity.GetComponent<IPixelPerfectComponent>();
		}
Exemple #4
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     _entity = entity;
     entity.Bind <IDrawableInfoComponent>(c => _drawableInfo = c, _ => _drawableInfo = null);
     entity.Bind <IImageComponent>(c => _obj   = c, _ => _obj = null);
     entity.Bind <IScaleComponent>(c => _scale = c, _ => _scale = null);
     entity.Bind <IPixelPerfectComponent>(c => _pixelPerfect = c, _ => _pixelPerfect = null);
     entity.Bind <IBoundingBoxComponent>(c => _boundingBox   = c, _ => _boundingBox = null);
 }
Exemple #5
0
 /// <summary>
 /// Restituiesce un sensore generico mappato su singolo input
 /// </summary>
 /// <param name="name">Etichetta assegnata al sensore</param>
 /// <param name="id">Identificativo del sensore</param>
 /// <param name="scaleFunction"></param>
 /// <param name="rules"></param>
 /// <param name="input"></param>
 public GenericSensor(
     string name,
     int id,
     IScale <Tin, Tout> scaleFunction,
     IRules <Tin> rules,
     IInput <Tin> input)
     : base(name, id, scaleFunction, rules)
 {
     Console.WriteLine($"Generic1_{Type}_created({Id})");
     _inputsList.Add(input);
 }
Exemple #6
0
 public static bool MarkInRange(IScale Scale, int minmark, int maxmark)
 {
     if (Scale.Mark >= minmark & Scale.Mark <= maxmark)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #7
0
 public static bool HasHeightLevel(IScale Scale)
 {
     if (Scale.Level == "Высокий")
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #8
0
 public static bool HasMiddleLevel(IScale Scale)
 {
     if (Scale.Level == "Средний")
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #9
0
 public static bool HasLowLevel(IScale Scale)
 {
     if (Scale.Level == "Низкий")
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #10
0
 public static bool StenInRange(IScale Scale, int minsten, int maxsten)
 {
     if (Scale.Stens >= minsten & Scale.Stens <= maxsten)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemple #11
0
        public MainFormPresenter(IMainForm view, IShipService shipService, IScale myScale, IPrinter myPrinter, MainFormViewModel viewModel)
        {
            _shipService = shipService;
            _scale       = myScale;
            _printer     = myPrinter;
            _view        = view;
            _model       = viewModel;

            _view.BindToViewModel(viewModel);
            _pages = new Dictionary <Constants.Pages, Control>();
        }
        private MutableValue(double value, double precision, IQuantity quantity, IUnit unit, IScale scale, List <Change> history)
        {
            OriginalValue = new ReadOnlyValue(value, precision, quantity, unit, scale);

            Value     = value;
            Precision = precision;
            Quantity  = quantity;
            Unit      = unit;
            Scale     = scale;
            _history  = history;
        }
        //Обработка события выбора входной шкалы измерения
        private void Convert(object sender, EventArgs e)
        {
            int indexInput  = view.IndexInputScale;
            int indexOutput = view.IndexOutputScale;

            IScale input  = model[indexInput];
            IScale output = model[indexOutput];

            double?celsius = input.ConvertTemperatureToCelsius(view.InputDegree);

            view.OutputDegree = output.ConvertCelsiusToOtherScale(celsius);
        }
Exemple #14
0
        float AnimateScaleValue(IScale scale)
        {
            var currValue = trackBarControl1.Value;
            var error     = (currValue > 10) ? currValue - 10 : 0;

            var   value     = (random.Next(error, currValue)) / 100.0f;
            float deviation = (value - (scale as IConvertibleScale).Percent);

            //return scale.Value + (scale.ScaleLength * 0.075f) * deviation;

            return(trackBarControl1.Value);
        }
 static XLTableWraper()
 {
     l.Debug("static XLTableWraper()");
     if (data != null)
     {
         tickScale = data.GetScale(ScaleEnum.tick, 1);
     }
     else
     {
         l.Error("data == null");
     }
 }
Exemple #16
0
 public DesignConfigLight()
 {
     ColorConfig       = new ColorConfigLight();
     FormSize          = new FormSizeDef();
     ContextMenuConfig = new ContextMenuConfigDef();
     PanelMainConfig   = new PanelMainConfig();
     PanelInstrument   = new PanelInstrumentDef();
     PanelNavbar       = new PanelNavbarDef();
     PanelLayerConfig  = new PanelLayerConfigDef();
     PanelToolBox      = new PanelToolbox();
     Resources         = new ResourcesDef();
     Scale             = new ScaleDef();
 }
Exemple #17
0
 public ScaleFinderOptions(ConfigFile configFile, ChordiousSettings chordiousSettings = null) : base(configFile, "scale")
 {
     if (null != chordiousSettings)
     {
         Settings = chordiousSettings;
     }
     else
     {
         string settingsLevel = "ScaleFinderOptions";
         Settings = new ChordiousSettings(_configFile.ChordiousSettings, settingsLevel);
     }
     _cachedScale = null;
 }
        public BotResult(bool IsTest, DateTime StartDateTime, string DLL, string Name, IEnumerable<BotParam> BotParams, ISymbol Symbol, IScale Scale, int From)
        {
            this.IsTest = IsTest;
            this.StartDateTime = StartDateTime;
            this.DLL = DLL;
                this.Name = Name;
             this.Symbol = Symbol;
                 this.Scale = Scale;
            this.From = From;

            foreach (BotParam bp in BotParams)
                this.BotParams.Add(new BotParam(bp));
        }
Exemple #19
0
 public GenericSensor(
     string name,
     int id,
     IScale <Tin, Tout> scaleFunction,
     int mappedInput,
     Action <GenericSensor <Tin, Tout>, int, Tin> updater)
 {
     ScaleFunction = scaleFunction;
     Id            = id;
     Name          = name;
     Updater       = updater;
     MappedInput   = mappedInput;
 }
Exemple #20
0
        public void SetTarget(Note rootNote, IScale scale)
        {
            if (null == scale)
            {
                throw new ArgumentNullException(nameof(scale));
            }

            Settings[Prefix + "rootnote"] = NoteUtils.ToString(rootNote);
            Settings[Prefix + "scale"]    = scale.LongName;
            ScaleLevel = scale.Level;

            _cachedScale = scale;
        }
Exemple #21
0
 public static void BindSizeToImage(IHasImage image, IScale scale)
 {
     image.PropertyChanged += ((_, args) =>
     {
         if (args.PropertyName != nameof(IHasImage.Image))
         {
             return;
         }
         if (MathUtils.FloatEquals(scale.BaseSize.Width, 0f) && image.Image != null)
         {
             scale.BaseSize = new SizeF(image.Image.Width, image.Image.Height);
         }
     });
 }
Exemple #22
0
        static void Main()
        {
            IScale[] model = new IScale[] {
                new CelsiusScale(),
                new KelvinScale(),
                new FahrenheitScale()
            };

            TemperatureView      view      = new TemperatureView();
            TemperaturePresenter presenter = new TemperaturePresenter(view, model);

            view.InitialValueScaleInCmb(model);
            view.ShowDialog();
        }
Exemple #23
0
            public static TestScaleFinderOptions Parse(string s)
            {
                if (string.IsNullOrWhiteSpace(s))
                {
                    throw new ArgumentNullException(nameof(s));
                }

                s = s.Trim();

                string[] vals = s.Split(';');

                IInstrument instrument = null;

                switch (vals[0])
                {
                case TestInstrument.UkuleleInstrumentName:
                    instrument = TestInstrument.Ukulele;
                    break;
                }

                ITuning tuning = null;

                switch (vals[1])
                {
                case TestInstrument.UkuleleStandardTuningName:
                    tuning = TestInstrument.Ukulele.Tunings.Get(TestInstrument.UkuleleStandardTuningName);
                    break;
                }

                IScale scale = null;

                switch (vals[2])
                {
                case TestScale.MajorScaleName:
                    scale = TestScale.MajorScale;
                    break;
                }

                Note rootNote = (Note)Enum.Parse(typeof(Note), vals[3]);

                int  numFrets          = int.Parse(vals[4]);
                int  maxFret           = int.Parse(vals[5]);
                int  maxReach          = int.Parse(vals[6]);
                bool allowOpenStrings  = bool.Parse(vals[7]);
                bool allowMutedStrings = bool.Parse(vals[8]);

                return(new TestScaleFinderOptions {
                    Instrument = instrument, Tuning = tuning, Scale = scale, RootNote = rootNote, NumFrets = numFrets, MaxFret = maxFret, MaxReach = maxReach, AllowOpenStrings = allowOpenStrings, AllowMutedStrings = allowMutedStrings
                });
            }
Exemple #24
0
        public ShipControlPesenter(IShipControl view, ShipViewModel model, IShipService shipService, IScale myScale, IPrinter myPrinter)
        {
            _view        = view;
            _model       = model;
            _shipService = shipService;
            _scale       = myScale;
            _printer     = myPrinter;
            _view.BindToViewModel(model);
            _view.SubmitIdInventoryButtonPressed      += ShipControl_SubmitIdInventoryButtonPressed;
            _view.SubmitWeightButtonPressed           += ShipControl_SubmitWeightButtonPressed;
            _view.CancelButtonPressed                 += ShipControl_CancelButtonPressed;
            _view.GoToCustomizeScalePageButtonPressed += ShipControl_GoToCustomizeScalePageButtonPressed;

            UpdateState(ShipStates.WaitingForIdInventory);
        }
Exemple #25
0
 public override void Init(IEntity entity)
 {
     base.Init(entity);
     entity.Bind <IImageComponent>(c =>
     {
         TypedParameter imageParam = new TypedParameter(typeof(IHasImage), c);
         _scale = _resolver.Container.Resolve <IScale>(imageParam);
         _scale.PropertyChanged += onScalePropertyChanged;
     }, c =>
     {
         _scale             = null;
         c.PropertyChanged -= onScalePropertyChanged;
     });
     entity.Bind <IAnimationComponent>(c => _animation = c, _ => _animation = null);
 }
Exemple #26
0
        void menu_Concat(object sender, EventArgs e)
        {
            IScale tickScale = GetScale(ScaleEnum.tick, 1);

            foreach (IMarket m in markets)
            {
                foreach (ISymbol s in m.GetSymbols())
                {
                    Ticks ticks = GetBars(s, tickScale) as Ticks;
                    if (ticks != null)
                    {
                        ticks.ticksFileList.Concat();
                    }
                }
            }
        }
Exemple #27
0
        public AGSSprite(Resolver resolver, IMaskLoader maskLoader)
        {
            _id         = Interlocked.Increment(ref _lastId);
            _maskLoader = maskLoader;
            _resolver   = resolver;

            //todo: abstract it to the constructor
            _translate      = new AGSTranslate();
            _hasImage       = new AGSHasImage();
            _hasImage.Pivot = new PointF();
            _scale          = new AGSScale(_hasImage);
            _rotate         = new AGSRotate();

            _scale.PropertyChanged     += onPropertyChanged;
            _hasImage.PropertyChanged  += onPropertyChanged;
            _translate.PropertyChanged += onPropertyChanged;
        }
        private void RefreshScales(IScale selectedScale = null)
        {
            Scales        = AppVM.GetScales();
            SelectedScale = null;

            if (null != selectedScale && null != Scales)
            {
                foreach (ObservableScale os in Scales)
                {
                    if (os.Scale == selectedScale)
                    {
                        SelectedScale = os;
                        break;
                    }
                }
            }
        }
Exemple #29
0
        public static Action BindSizeToImage(IHasImage image, IScale scale)
        {
            PropertyChangedEventHandler onPropertyChanged = ((_, args) =>
            {
                if (args.PropertyName != nameof(IHasImage.Image))
                {
                    return;
                }
                if (MathUtils.FloatEquals(scale.BaseSize.Width, 0f) && image.Image != null)
                {
                    scale.BaseSize = new SizeF(image.Image.Width, image.Image.Height);
                }
            });

            image.PropertyChanged += onPropertyChanged;
            return(() => image.PropertyChanged -= onPropertyChanged);
        }
Exemple #30
0
        private void colorHandle()
        {
            LinearScale linearScale = new LinearScale();

            linearScale.MinimumValue = 0;
            linearScale.MaximumValue = 100;

            ColorCollection colors = new ColorCollection();

            colors.Add(System.Windows.Media.Colors.Blue);
            colors.Add(System.Windows.Media.Colors.Pink);
            colors.Add(System.Windows.Media.Colors.Red);


            linearScale.Colors = colors;

            SetColors = linearScale;
        }
Exemple #31
0
        private static IScale LoadModule()
        {
            try
            {
                scaleCas = ModuleManeger.LoadModule("Hugin.POS.Scale", "Scale") as IScale;
            }
            catch (Exception ex)
            {
                CashRegister.Log.Error(ex);
            }

            if (scaleCas == null)
            {
                scaleCas = new ScaleCAS();
            }

            return(scaleCas);
        }
Exemple #32
0
        private void CalculateButton_Click(object sender, EventArgs e)
        {
            try
            {
                double temperature = Convert.ToDouble(entryTextField.Text);
                resultLabel.ForeColor = Color.Black;

                IScale fromScale = (IScale)fromScaleComboBox.SelectedItem;
                IScale toScale   = (IScale)toScaleComboBox.SelectedItem;

                resultLabel.Text = converter.ConvertTemperature(fromScale, toScale, temperature).ToString("0.00");
            }
            catch (FormatException)
            {
                resultLabel.Text      = "It must be number!";
                resultLabel.ForeColor = Color.Red;
            }
        }
Exemple #33
0
        /// <summary>Creates a new instance of a scale for the specified scale type.</summary>
        public static IScale CreateScale(string scaleType, string comPort)
        {
            //Create a scale of type IScale
            IScale scale = null;

            switch (scaleType.ToLower())
            {
            case "automatic":       scale = new AutoScale(comPort); break;

            case "manual":      scale = new ManualScale(); break;

            case "constant":    scale = new ConstantScale(); break;

            case "table":       scale = new TableScale(); break;

            default:                        throw new Exception("Scale type not found.");
            }
            return(scale);
        }
Exemple #34
0
        public POSUI(
            IConfiguration config,
            ILogger logger,
            IItemRepository itemRepository,
            IScale scale,
            ITransactionRepository transactionRepository,
            IPaymentProcessor paymentProcessor)
        {
            _config                = config;
            _logger                = logger;
            _itemRepository        = itemRepository;
            _scale                 = scale;
            _transactionRepository = transactionRepository;
            _paymentProcessor      = paymentProcessor;

            _logger.LogInformation("Initializing POS.");
            InitializeComponent();
            _logger.LogInformation("Initialization Complete.");
        }
Exemple #35
0
        public IBars GetBars(ISymbol symbol, IScale scale)
        {
            if (l.IsDebugEnabled)
                l.Debug("GetBars " + symbol + " " + scale);
            lock (barss)
            {
                string key = symbol + "." + scale;
                if (barss.ContainsKey(key))
                    return barss[key];

                IBars newBars;
                if ((scale.scaleType == ScaleEnum.tick) && (scale.interval == 1))
                {
                    newBars = new Ticks(symbol);
                }
                else
                    newBars = new AggregateBars(this, symbol, scale);

                barss.Add(key, newBars);

                return newBars;
            }
        }
        public IntegrativeReference(ITestReport KettellC, fBaseEntities fe)
        {
            _fe = fe;
            _kettellreport = (KettellCTestReport)KettellC;

            _ScaleMD = _kettellreport.ListScales[0];
            _ScaleA = _kettellreport.ListScales[1];
            _ScaleB = _kettellreport.ListScales[2];
            _ScaleC = _kettellreport.ListScales[3];
            _ScaleE = _kettellreport.ListScales[4];
            _ScaleF = _kettellreport.ListScales[5];
            _ScaleG = _kettellreport.ListScales[6];
            _ScaleH = _kettellreport.ListScales[7];
            _ScaleI = _kettellreport.ListScales[8];
            _ScaleL = _kettellreport.ListScales[9];
            _ScaleM = _kettellreport.ListScales[10];
            _ScaleN = _kettellreport.ListScales[11];
            _ScaleO = _kettellreport.ListScales[12];
            _ScaleQ1 = _kettellreport.ListScales[13];
            _ScaleQ2 = _kettellreport.ListScales[14];
            _ScaleQ3 = _kettellreport.ListScales[15];
            _ScaleQ4 = _kettellreport.ListScales[16];
        }
Exemple #37
0
 public abstract void Add(IScale scale);
Exemple #38
0
 public ScaleControl()
 {
     InitializeComponent();
     _scale = null;
 }
Exemple #39
0
 public static bool HasMiddleLevel(IScale Scale)
 {
     if (Scale.Level == "Средний") { return true; }
        else { return false; }
 }
Exemple #40
0
 public static bool MarkInRange(IScale Scale, int minmark, int maxmark)
 {
     if (Scale.Mark >= minmark & Scale.Mark <= maxmark) { return true; }
        else { return false; }
 }
Exemple #41
0
 public static bool StenInRange(IScale Scale, int minsten, int maxsten)
 {
     if (Scale.Stens >= minsten & Scale.Stens <= maxsten) { return true; }
        else { return false; }
 }
 static XLTableWraper()
 {
     l.Debug("static XLTableWraper()");
     if (data != null)
     {
         tickScale = data.GetScale(ScaleEnum.tick, 1);
     }
     else
         l.Error("data == null");
 }
 public bool GetData(ISymbol symbol, IScale scale, DateTime startDate, DateTime endDate, int maxBars, bool includePartialBar)
 {
     l.Error("Для провайдера не реализуещего isHistoryProvider данный метод вызываться не должен");
     return false;
 }
		public override void Init(IEntity entity)
		{
			base.Init(entity);
			_scale = entity.GetComponent<IScaleComponent>();
			_tree = entity.GetComponent<IInObjectTree>();
		}
Exemple #45
0
 public static bool HasHeightLevel(IScale Scale)
 {
     if (Scale.Level == "Высокий") { return true; }
        else { return false; }
 }
Exemple #46
0
 public static bool HasLowLevel(IScale Scale)
 {
     if (Scale.Level == "Низкий") { return true; }
        else { return false; }
 }
Exemple #47
0
 //TODO  public static DataScale Parse(string s);
 public bool CanConvertTo(IScale scale)
 {
     if (beginning != scale.beginning)
         return false;
     return Equals(scale) || ((interval == 1) && (this.scaleType == ScaleEnum.tick)) || ((this.scaleType == scale.scaleType) && (0 == scale.interval % this.interval));
 }