Inheritance: MeleeSkill
Ejemplo n.º 1
0
 public LevelsStructure(string name_, IEnumerable<IWeightedLevelsForFocus> comps_, Focus initialFocus_, bool resultIsVolatile_)
 {
   Focus = initialFocus_;
   m_components = new List<IWeightedLevelsForFocus>(comps_);
   ResultIsVolatile = resultIsVolatile_;
   Name = new TextSortableByDate(name_);
 }
Ejemplo n.º 2
0
    public static ConstructGen<double> GetHistoricalSpreads(BondMarket market1_, BondMarket market2_, Focus focus_)
    {
      var s1 = GetHistoricalCMT(market1_, focus_);
      var s2 = GetHistoricalCMT(market2_, focus_);

      return (s1 == null || s2 == null) ? null : s1.Minus(s2);
    }
    public SmoothCurveAndSettingsGroup(FitPhases phases_, CountryBondSource source_, BondField timeToMaturity_, Focus focus_, BondField minusField_, BondField minusFieldFitted_, int recalcNumber_, bool fitOnEvent_ = true)
      : this(phases_, source_, timeToMaturity_, focus_, recalcNumber_, fitOnEvent_)
    {
      // explanation of logic of last 2 arguments
      // false => don't want to continually recalc on the recalc cycle, but only once
      // true => if the MinusOffset changes, we want to recalculate


      DateTime thirtyYearsTime = DateTime.Today.AddYears(30);

      MinusCMT = new CMTLine(source_.Market,focus_);


      MinusCalculator = new SmoothCurveCalculator(
        cml_: MinusCMT,
        cmlStartTenor_: 1,
        cmlEndTenor_: 34,
        list_: source_.Lines.Where(x => x.Maturity <= thirtyYearsTime).ToList(),
        timeToMaturityField_: timeToMaturity_,
        valueField_: minusField_,
        fittedValueField_: minusFieldFitted_,
        recalcNumber_: recalcNumber_,
        updateOnCalcEvent_: false,
        updateOnMinusOffsetChange_: true,
        settings_: Settings);
    }
Ejemplo n.º 4
0
    public static DatedDataCollectionGen<double> GetHistoricalSpreads(BondMarket market1_, BondMarket market2_, Focus focus_, int curvePoint_)
    {
      var s1 = GetHistoricalCMT(market1_, focus_, curvePoint_);
      var s2 = GetHistoricalCMT(market2_, focus_, curvePoint_);

      return (s1 == null || s2 == null) ? null : s1.Minus(s2);
    }
 public BondFieldMappingAttribute(BondField field_, Focus focus_=Focus.None, FieldType fieldType_=FieldType.None, CellColourScheme colourScheme_=CellColourScheme.None)
 {
   Field = field_;
   Focus = focus_;
   FieldType = fieldType_;
   ColourScheme = colourScheme_;
 }
 public void ClaimFocus(Focus focus)
 {
     if (_focusStack.Count == 0 || _focusStack.Peek() != focus)
     {
         _focusStack.Push(focus);
     }
 }
Ejemplo n.º 7
0
    public static HistoricalCMT GetInstance(Data.BondCurves curve_, BondMarket market_, Focus focus_, bool createIfNotThere_=true)
    {
      var key = getKey(curve_, market_, focus_);

      if(m_cache.ContainsKey(key)==false)
        lock(m_cache)
          if(m_cache.ContainsKey(key)==false)
          {
            var record = SI.DB.MongoDB.GetCollection<HistoricalCMT>(MongoDBDetails.ServerReference, MongoDBDetails.DB, MongoDBDetails.CMTCollection)
              .Find(Builders<HistoricalCMT>.Filter.Where(h => h.Market == market_ && h.Curve == curve_ && h.Focus == focus_))
              .FirstOrDefaultAsync().Result;

            if (record == null && createIfNotThere_)
            {
              record = new HistoricalCMT
              {
                Market = market_,
                Curve = curve_,
                Focus = focus_,
                CMTs = new ConstructGen<double>(CMTLine.AllPoints.Select(x => string.Format("{0}Y", x)).ToArray()),
                FitParameters = new ConstructGen<double>(new[] {1, 2, 3, 4, 5, 6}.Select(x => x.ToString()).ToArray()),
              };
            }
            m_cache[key] = record;
          }

      return m_cache[key];
    }
Ejemplo n.º 8
0
        public UpdaterParameters(IXnaGameTime gameTime, Focus focus)
        {
            gameTime.ThrowIfNull("gameTime");

            _gameTime = gameTime;
            _focus = focus;
        }
Ejemplo n.º 9
0
    public static ConstructGen<double> GetHistoricalCMT(BondMarket market_, Focus focus_)
    {
      HistoricalCMT.RegisterMongo();

      var m = HistoricalCMT.GetInstance(BondAnalysisLineHelper.GetDefaultCurveForMarket(market_), market_, focus_, false);

      return m == null ? null : m.CMTs;
    }
Ejemplo n.º 10
0
        public void Update(IXnaGameTime gameTime, Focus focus)
        {
            gameTime.ThrowIfNull("gameTime");

            var updaterParameters = new UpdaterParameters(gameTime, focus);

            // Must call ToArray() because collection could be modified during iteration
            foreach (IUpdater updater in _updaters.ToArray())
            {
                updater.Update(updaterParameters);
            }
        }
    public RegStatLineBase CreateStructure(Focus focus_)
    {
      var ret = new BondStructureOTR(focus_, Points);

      if (!ret.HasAllBondsDefined())
      {
        ret.Dispose();
        return null;
      }
      else
        return ret;
    }
Ejemplo n.º 12
0
    public DatedDataCollectionGen<double> GetPoint(BondMarket market_, int series_, Focus focus_, BondCurves curve_, decimal curvePoint_)
    {
      var pointIndex = AllPoints.ToList().IndexOf(curvePoint_);

      if (pointIndex == -1) return null;

      var curve = Get(market_, series_, focus_, curve_, false);

      if (curve == null) return null;

      return curve.Data.GetColumnValuesAsDDC(pointIndex);
    }
Ejemplo n.º 13
0
    public BondStructureOTR(Focus focus_, Tuple<int,BondMarket,double>[] points_)
      : base(points_.GetDescription())
    {
      Points = points_;
      m_focus = focus_;

      foreach (BondMarket mkt in points_.Select(x => x.Item2).Distinct())
      {
        CountryBondSource.GetInstance(mkt).OTRCache.ItemAdded += handleCachedChanged;
        CountryBondSource.GetInstance(mkt).OTRCache.ItemRemoved += handleCachedChanged;
      }

      rebuild();
    }
Ejemplo n.º 14
0
    public static CMTLine GetCMTSpreadLiveDiff(BondMarket market1_, BondMarket market2_, Focus focus_)
    {
      var key = getSpreadLineKey(market1_, market2_, focus_);

      if (_spreadLineCache.ContainsKey(key))
        return _spreadLineCache[key];

      var diff = new CMTLineDiff(
        CountryBondSource.GetInstance(market1_).GetSmoothCurveGroupForFocus(focus_).LiveCMT,
        CountryBondSource.GetInstance(market2_).GetSmoothCurveGroupForFocus(focus_).LiveCMT);

      _spreadLineCache[key] = diff;

      return diff;
    }
Ejemplo n.º 15
0
    public BondStructureCMT(Focus focus_, Tuple<int,BondMarket,double>[] points_)
      : base(points_.GetDescription())
    {
      Points = points_;
      Focus = focus_;

      m_bits =
        Points.Select(x => x.Item2)
          .Distinct()
          .Select(x => CountryBondSource.GetInstance(x).GetSmoothCurveGroupForFocus(Focus).LiveCMT)
          .ToDictionary(x => x.Market, x => x);
      subscribeToFit();
      setPriorValue();

      RecalculateLive();
    }
Ejemplo n.º 16
0
    public CMTStructure(Focus focus_, CMTStructureDefinition definition_)
      :base(definition_.Points.Select(x=>x.Market).Select(mkt=>CountryBondSource.GetInstance(mkt).GetSmoothCurveGroupForFocus(focus_).LiveCMT) )
    {
      Definition = definition_;
      Focus = focus_;

      m_name = new TextSortableByDate(definition_.Description);

      m_lines =
        definition_.Points.Select(x => CountryBondSource.GetInstance(x.Market).GetSmoothCurveGroupForFocus(focus_).LiveCMT)
          .ToArray();

      // might need to change this later to cater for 'n' day change
      if (Levels != null && Levels.Length > 0)
        m_priorValue = Levels.LastDataValue;
    }
    public void Create(BondMarket initialMarket1_, BondMarket initialMarket2_, Focus focus_)
    {
      m_args = new Args()
      {
        Market1 = initialMarket1_,
        Market2 = initialMarket2_,
        Focus = focus_
      };

      lblCountry1.Bind(m_args, "Market1", new Validators.EnumDescValidator(m_args.Market1));
      lblCountry2.Bind(m_args, "Market2", new Validators.EnumDescValidator(m_args.Market2));
      lblField.Bind(m_args, "Focus", new Validators.EnumDescValidator(m_args.Focus));

      rebuildBinding();
      m_args.PropertyChanged += (a, b) => rebuildBinding();
    }
Ejemplo n.º 18
0
        /// <summary>
        /// Constructor for ActiveEventArgs
        /// </summary>
        /// <remarks>
        /// Creates EventArgs that can be passed to the event queue
        /// </remarks>
        /// <param name="gainedFocus">
        /// True if the focus was gained, False if it was lost
        /// </param>
        /// <param name="state">
        /// Set to type of input that gave the app focus
        /// </param>
        public ActiveEventArgs(bool gainedFocus, Focus state)
        {
            Sdl.SDL_Event evt = new Sdl.SDL_Event();

            if (gainedFocus)
            {
                evt.active.gain = 1;
            }
            else
            {
                evt.active.gain = 0;
            }
            evt.type = (byte)EventTypes.ActiveEvent;
            evt.active.state = (byte)state;
            this.EventStruct = evt;
        }
Ejemplo n.º 19
0
    public CMTStructure GetStructureImpl(Focus focus_, CMTStructureDefinition def_)
    {
      if (def_ == null) return null;

      var key = GetKey(focus_, def_);

      lock (_instance)
      {
        if (m_underlyingCache.ContainsKey(key))
          return m_underlyingCache[key];

        var o = new CMTStructure(focus_, def_);
        m_underlyingCache.Add(key, o);
        return o;
      }
    }
Ejemplo n.º 20
0
    public static Tuple<string, DatedDataCollectionGen<double>> ParseToCombination(Data.BondCurves curve_, Focus focus_, string input_)
    {
      var str = input_;

      while (str.Contains("  ")) str = str.Replace("  ", " ");

      str = str.Replace("- ", "-1x");
      str = str.Replace("+", " ");

      while (str.Contains("  ")) str = str.Replace("  ", " ");

      var split = str.Split(' ');
      var matches = regex.Matches(str);

      if (split.Length != matches.Count)
      {
        return new Tuple<string, DatedDataCollectionGen<double>>("invalid input", null);
      }

      var parts = (from Match match in matches select getDetails(match)).ToArray();

      if(parts.Any(x=>x.Item1!=null))
      {
        return
          new Tuple<string, DatedDataCollectionGen<double>>(
            string.Join(",", parts.Where(x => x.Item1 != null).Select(x => x.Item1).ToArray()), null);
      }

      var colls =
        parts.Select(
          x => Singleton<CMTCurveCache>.Instance.GetPoint(x.Item2, x.Item3, focus_, curve_, x.Item4))
          .ToArray();

      if (colls.Any(x => x == null))
      {
        return new Tuple<string, DatedDataCollectionGen<double>>("Unknown error", null);
      }

      var multipliedOut = colls.Select((x, i) => x.MultiplyBy(parts[i].Item5)).ToArray();

      var ret = multipliedOut[0];

      for (int i = 1; i < multipliedOut.Length; ++i)
        ret = ret.Plus(multipliedOut[i]);

      return new Tuple<string, DatedDataCollectionGen<double>>(null, ret);
    }
    public void Create(BondMarket initialMarket_, Focus initialFocus_, CurveSetPeriod initialPeriod_)
    {
      m_args.Market = initialMarket_;
      m_args.Focus = initialFocus_;
      m_args.Period = initialPeriod_;

      m_args.PropertyChanged += (a, b) =>
      {
        reloadCurve();
      };

      reloadCurve();

      lblCountry.Bind(m_args, "Market", new Validators.EnumDescValidator(m_args.Market));
      lblField.Bind(m_args, "Focus", new Validators.EnumDescValidator(m_args.Focus));
      lblPeriod.Bind(m_args, "Period", new Validators.EnumDescValidator(m_args.Period));
    }
Ejemplo n.º 22
0
        public RandomEvent(EventType type, Focus focus, string name, string message, bool critical, int custHappiness, int aircraftDamage, int airlineSecurity, int airlineSafety, int empHappiness, int moneyEffect, double paxDemand, double cargoDemand, int length, string id, int frequency, DateTime stat, DateTime end)
        {
            this.DateOccurred = GameObject.GetInstance().GameTime;
            this.CustomerHappinessEffect = 0;
            this.AircraftDamageEffect = 0;
            this.AirlineSecurityEffect = 0;
            this.EmployeeHappinessEffect = 0;
            this.FinancialPenalty = 0;
            this.PaxDemandEffect = 1;
            this.CargoDemandEffect = 1;
            this.EffectLength = 1;
            this.CriticalEvent = false;
            this.EventName = "";
            this.EventMessage = "";
            this.Type = type;

            this.EventID = id;
        }
Ejemplo n.º 23
0
    public static CMTRangeChartData GetRangeChartData(CMTRangeChartOptions options_, Focus focus_)
    {
      if (options_ == null || options_.Market1==BondMarket.None) return null;

      // if second market is 'None' then we're just looking to get CMT data for the single country
      if (options_.Market2 == BondMarket.None || options_.Market2 == options_.Market1)
        return new CMTRangeChartData()
        {
          Historical = GetHistoricalCMT(options_.Market1, focus_),
          LiveLine = CountryBondSource.GetInstance(options_.Market1).GetSmoothCurveGroupForFocus(options_.Focus).LiveCMT
        };
      else
      {
        return new CMTRangeChartData()
        {
          Historical = GetHistoricalSpreads(options_.Market1, options_.Market2, focus_),
          LiveLine = GetCMTSpreadLiveDiff(options_.Market1, options_.Market2, options_.Focus)
        };
      }
    }
    public SmoothCurveAndSettingsGroup(FitPhases phases_, CountryBondSource source_, BondField timeToMaturity_, Focus focus_, int recalcNumber_, bool fitOnEvent_=true)
    {
      m_settings = new SmoothCurveSettings(phases_);

      LiveCMT = new CMTLine(source_.Market,focus_);

      DateTime thirtyYearsTime = DateTime.Today.AddYears(34);

      LiveCalculator = new SmoothCurveCalculator(
        cml_: LiveCMT,
        cmlStartTenor_: 1,
        cmlEndTenor_: 34,
        list_: source_.Lines.Where(x => x.Maturity <= thirtyYearsTime).ToList(),
        timeToMaturityField_: timeToMaturity_,
        valueField_: BondAnalysisLineHelper.GetFieldForFocusAndType(focus_,FieldType.Live),
        fittedValueField_: BondAnalysisLineHelper.GetFieldForFocusAndType(focus_,FieldType.FittedLive),
        recalcNumber_: recalcNumber_,
        updateOnCalcEvent_: fitOnEvent_,
        settings_: Settings);
    }
Ejemplo n.º 25
0
    private static void addLiveCurves(DataTable table_, Focus focus_)
    {
      foreach (var curve in StructureConfigs.IntraCountryCurves)
      {
        var row = table_.NewRow();
        row[0] = string.Format("{0}s{1}s", curve[0], curve[1]);

        for (int m = 0; m < LiveMarkets.Markets.Length; ++m)
        {
          var liveIndex = 1 + (m * 2);
          var changeIndex = liveIndex + 1;

          var liveCurve =
            CountryBondSource.GetInstance(LiveMarkets.Markets[m])
              .GetSmoothCurveGroupForFocus(focus_)
              .LiveCMT.GetCurve(curve[0], curve[1], true);

          row[liveIndex] = liveCurve.Value;

          liveCurve.PropertyChanged += (x, y) =>
          {
            switch(y.PropertyName)
            {
              case "Value":
                {
                  row[liveIndex] = ((CMTLineDerivation)x).Value;
                }
                break;
              case "ASWChange":
                {
                  row[changeIndex] = ((CMTLineDerivation)x).Change;
                }
                break;
            }
          };
        }

        table_.Rows.Add(row);
      }

    }
    public RegStatLineBase CreateStructure(Focus focus_)
    {
      if (Mode == CountryGroupNodeMode.OTR)
      {
        var ret = new BondStructureOTR(focus_, Points);

        if (!ret.HasAllBondsDefined())
        {
          ret.Dispose();
          return null;
        }
        else
          return ret;
      }
      else if (Mode == CountryGroupNodeMode.CMT)
      {
        return new BondStructureCMT(focus_, Points);
      }
      else
        throw new Exception("Need to implement!");
    }
Ejemplo n.º 27
0
    internal void Create(RegStatLineShared bindToThis_, Focus initialfocus_)
    {
      focusSwitchControl1.SelectedFocus = initialfocus_;
      focusSwitchControlReg.SelectedFocus = initialfocus_;

      focusSwitchControlReg.FocusChanged += (x, y) =>
      {
        setRegressor();
      };

      tbLevelWindow.Bind(bindToThis_, "LevelWindowLength", new Validators.IntValidator());
      m_slShared = bindToThis_;

      //cmbRegressor.Items.AddRange(possibleIndependents_.Select(x => new ValueListItem(x, x.Name)).ToArray());
      //cmbRegressor.Bind(bindToThis_.RegArgs, "Independent", null);

      levelsControl1.Create(InstrumentTypeMode.IndividualBonds | InstrumentTypeMode.OTRs);
      levelsControl1.LevelsChanged += (x, y) => setRegressor();
      levelsControl1.InterpretText("DE 10");

      cmbRegressOn.AddItems(typeof (RegressOn));
      cmbRegressOn.Bind(bindToThis_.RegArgs, "RegressOn", new Validators.EnumDescValidator(RegressOn.Levels));

      tbRegressionWindow.Bind(bindToThis_.RegArgs, "RegressionWindowLength", new Validators.IntValidator());
      tbZ1.Bind(bindToThis_, "ZScore_1", new Validators.IntValidator());
      tbZ2.Bind(bindToThis_, "ZScore_2", new Validators.IntValidator());

      btnApplyLevel.Enabled = bindToThis_.LevelsOk;
      btnApplyRegression.Enabled = bindToThis_.RegArgs.IsOK;

      bindToThis_.PropertyChanged += (x, y) =>
      {
        btnApplyLevel.Enabled = bindToThis_.LevelsOk;
      };

      bindToThis_.RegArgs.PropertyChanged += (x, y) =>
      {
        btnApplyRegression.Enabled = bindToThis_.RegArgs.IsOK;
      };
    }
Ejemplo n.º 28
0
    public CMTCurve Get(BondMarket market_, int series_, Focus focus_, BondCurves curve_, bool createIfNotThere_ = false)
    {
      // messy!  but necessary
      // yield has no need for a curve, so I only save to Mongo for the 'default' curve for the market
      // so if yield is requested, then override the requested curve with the default otherwise no data will be found
      var curve = (focus_ == Focus.Yield)
        ? BondAnalysisLineHelper.GetDefaultCurveForMarket(market_)
        : curve_;

      var item = m_list.FirstOrDefault(x => x.Market == market_ && x.Series == series_ && x.Focus==focus_ && x.Curve==curve);

      if (item != null) return item;

      // try to get from mongo

      item = SI.DB.MongoDB.GetCollection<CMTCurve>(MongoDBDetails.SVR_REF, MongoDBDetails.DB, MongoDBDetails.Curve_Collection)
        .Find(Builders<CMTCurve>.Filter.Where(x=> x.Series == series_ && x.Market == market_ && x.Focus == focus_ && x.Curve == curve)).FirstOrDefaultAsync().Result;

      if (item != null)
      {
        m_list.Add(item);
        return item;
      }

      if (createIfNotThere_)
      {
        item = new CMTCurve
        {
          Market = market_,
          Series = series_,
          Focus = focus_,
          Curve=curve,
          Data = new ConstructGen<double>(AllPoints.Select(x => x.ToString()).ToArray())
        };
        m_list.Add(item);
      }

      return item;
    }
Ejemplo n.º 29
0
        public RandomEvent(
            EventType type,
            Focus focus,
            int airlineSafety,
            int moneyEffect,
            string id,
            int frequency,
            DateTime stat,
            DateTime end,
            string name = "",
            string message = "",
            bool critical = false,
            int custHappiness = 0,
            int aircraftDamage = 0,
            int airlineSecurity = 0,
            int empHappiness = 0,
            double paxDemand = 1,
            double cargoDemand = 1,
            int length = 1)
        {
            DateOccurred = GameObject.GetInstance().GameTime;
            CustomerHappinessEffect = custHappiness;
            AircraftDamageEffect = aircraftDamage;
            AirlineSecurityEffect = airlineSecurity;
            EmployeeHappinessEffect = empHappiness;
            FinancialPenalty = 0;
            PaxDemandEffect = paxDemand;
            CargoDemandEffect = cargoDemand;
            EffectLength = length;
            CriticalEvent = critical;
            EventName = name;
            EventMessage = message;
            Type = type;

            EventID = id;
        }
Ejemplo n.º 30
0
    private static void  addLiveCMTOutrights(DataTable table_, Focus focus_)
    {
      foreach (var point in CMTLine.DisplayPoints)
      {
        var row = table_.NewRow();
        row[0] = string.Format("{0}Y", point);

        for (int m = 0; m < LiveMarkets.Markets.Length; ++m)
        {
          var liveIndex = 1 + (m * 2);
          var changeIndex = liveIndex + 1;

          var marketLive = CountryBondSource.GetInstance(LiveMarkets.Markets[m]);
          var yieldLive = marketLive.GetSmoothCurveGroupForFocus(focus_).LiveCMT;
          var yieldChange = marketLive.GetSmoothCurveGroupForFocus(focus_).CMTDiff;

          row[liveIndex] = yieldLive[(int)point];

          yieldLive.PropertyChanged += (x, y) =>
          {
            if (String.CompareOrdinal(string.Format("Y{0}", point), y.PropertyName) == 0)
              row[liveIndex] = ((CMTLine)x)[(int)point];
          };

          row[changeIndex] = yieldChange[(int)point];

          var point1 = point;
          yieldChange.PropertyChanged += (x, y) =>
          {
            if (String.CompareOrdinal(string.Format("Y{0}", point1), y.PropertyName) == 0)
              row[changeIndex] = BondAnalysisLineHelper.GetChangeMultiplier(focus_) * ((CMTLine)x)[(int)point1];
          };
        }
        table_.Rows.Add(row);
      }
    }
Ejemplo n.º 31
0
 public virtual void HoldFocus(Target target, Focus entered)
 {
 }
Ejemplo n.º 32
0
        public XmlEditorContext(String file, String rmlPreviewFile, XmlTypeController typeController)
        {
            this.typeController = typeController;
            this.currentFile    = file;
            this.rmlPreviewFile = rmlPreviewFile;

            mvcContext = new AnomalousMvcContext();
            mvcContext.StartupAction = "Common/Start";
            mvcContext.FocusAction   = "Common/Focus";
            mvcContext.BlurAction    = "Common/Blur";
            mvcContext.SuspendAction = "Common/Suspended";
            mvcContext.ResumeAction  = "Common/Resumed";

            TextEditorView textEditorView = new TextEditorView("RmlEditor", () => this.typeController.loadText(currentFile), wordWrap: false, textHighlighter: XmlTextHighlighter.Instance);

            textEditorView.ElementName       = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Left);
            textEditorView.ComponentCreated += (view, component) =>
            {
                textEditorComponent = component;
            };
            mvcContext.Views.add(textEditorView);

            EditorTaskbarView taskbar = new EditorTaskbarView("InfoBar", currentFile, "Editor/Close");

            taskbar.addTask(new CallbackTask("SaveAll", "Save All", "Editor/SaveAllIcon", "", 0, true, item =>
            {
                saveAll();
            }));
            taskbar.addTask(new RunMvcContextActionTask("Save", "Save Rml File", "CommonToolstrip/Save", "File", "Editor/Save", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Cut", "Cut", "Editor/CutIcon", "Edit", "Editor/Cut", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Copy", "Copy", "Editor/CopyIcon", "Edit", "Editor/Copy", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Paste", "Paste", "Editor/PasteIcon", "Edit", "Editor/Paste", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("SelectAll", "Select All", "Editor/SelectAllIcon", "Edit", "Editor/SelectAll", mvcContext));
            mvcContext.Views.add(taskbar);

            mvcContext.Controllers.add(new MvcController("Editor",
                                                         new RunCommandsAction("Show",
                                                                               new ShowViewCommand("RmlEditor"),
                                                                               new ShowViewCommand("InfoBar")),
                                                         new RunCommandsAction("Close", new CloseAllViewsCommand()),
                                                         new CallbackAction("Save", context =>
            {
                save();
            }),
                                                         new CallbackAction("Cut", context =>
            {
                textEditorComponent.cut();
            }),
                                                         new CallbackAction("Copy", context =>
            {
                textEditorComponent.copy();
            }),
                                                         new CallbackAction("Paste", context =>
            {
                textEditorComponent.paste();
            }),
                                                         new CallbackAction("SelectAll", context =>
            {
                textEditorComponent.selectAll();
            })));

            mvcContext.Controllers.add(new MvcController("Common",
                                                         new RunCommandsAction("Start", new RunActionCommand("Editor/Show")),
                                                         new CallbackAction("Focus", context =>
            {
                GlobalContextEventHandler.setEventContext(eventContext);
                if (Focus != null)
                {
                    Focus.Invoke(this);
                }
            }),
                                                         new CallbackAction("Blur", context =>
            {
                GlobalContextEventHandler.disableEventContext(eventContext);
                if (Blur != null)
                {
                    Blur.Invoke(this);
                }
            }),
                                                         new RunCommandsAction("Suspended", new SaveViewLayoutCommand()),
                                                         new RunCommandsAction("Resumed", new RestoreViewLayoutCommand())));

            eventContext = new EventContext();
            ButtonEvent saveEvent = new ButtonEvent(EventLayers.Gui);

            saveEvent.addButton(KeyboardButtonCode.KC_LCONTROL);
            saveEvent.addButton(KeyboardButtonCode.KC_S);
            saveEvent.FirstFrameUpEvent += eventManager =>
            {
                saveAll();
            };
            eventContext.addEvent(saveEvent);
        }
Ejemplo n.º 33
0
 public int Insert(Focus entity)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 34
0
 public void CreateFocus(Focus focus)
 {
     focusRepository.Add(focus);
     SaveFocus();
 }
        private static List <Focus> prepareParse(List <Focus> listFoci)
        {
            List <Focus> SortedList = new List <Focus>();
            List <Focus> HoldedList = new List <Focus>();

            //Add the roots, the nodes without any perequisites. Helps with performance
            SortedList.AddRange(listFoci.Where((f) => !f.Prerequisite.Any()));
            int MaxY = listFoci.Max(i => i.Y);
            int MaxX = listFoci.Max(i => i.X);

            //For each X in the grid
            for (int i = 0; i < MaxX; i++)
            {
                //For each Y in the grid
                for (int j = 0; j < MaxY; j++)
                {
                    //If there is a focus with the current X and Y
                    Focus focus = listFoci.FirstOrDefault((f) => f.X == i && f.Y == j);
                    if (focus == null)
                    {
                        continue;
                    }
                    //If the prerequisites are not present
                    if (!CheckPrerequisite(focus, SortedList))
                    {
                        foreach (PrerequisitesSet set in focus.Prerequisite)
                        {
                            //check if any of the prerequisite can be added immediatly
                            foreach (Focus setFocus in set.FociList)
                            {
                                //If that focus has no prerequisites or the prerequisites are present
                                if ((CheckPrerequisite(setFocus, SortedList) || !setFocus.Prerequisite.Any()) &&
                                    !SortedList.Contains(setFocus))
                                {
                                    //Add it if it is not there already
                                    SortedList.Add(setFocus);
                                }
                            }
                        }
                        //Recheck prerequisite again
                        if (CheckPrerequisite(focus, SortedList) && !SortedList.Contains(focus))
                        {
                            //Add the focus to the sorted list
                            SortedList.Add(focus);
                        }
                        else
                        {
                            //Add the current focus to the holded list
                            HoldedList.Add(focus);
                            break;
                        }
                    }
                    else if (!SortedList.Contains(focus))
                    {
                        //Otherwise, add it to the list
                        SortedList.Add(focus);
                    }
                    //Check if we can add some of the holded focus
                    AddBackwardsPrerequisite(HoldedList, SortedList);
                }
                //Check if we can add some of the holded focus
                AddBackwardsPrerequisite(HoldedList, SortedList);
            }
            //Check if we can add some of the holded focus
            AddBackwardsPrerequisite(HoldedList, SortedList);
            //Just to be sure, add any prerequisite that are not in the list, but in the original
            SortedList.AddRange(listFoci.Except(SortedList));
            return(SortedList);
        }
Ejemplo n.º 36
0
    public void FindFocus()
    {
        Focus foundfocus = MagicChamber.Instance.focus;

        Debug.Log("Found focus: " + foundfocus.name);
    }
Ejemplo n.º 37
0
 /// <inheritdoc/>
 public override int GetHashCode()
 {
     return(StartColor.GetHashCode() ^ (EndColor.GetHashCode() << 1) ^
            ((Angle.GetHashCode() + 1) << 2) ^ ((Focus.GetHashCode() + 1) << 10) ^ ((Contrast.GetHashCode() + 1) << 20));
 }
Ejemplo n.º 38
0
 public Focus(Focus parent)
 {
     Parent = parent;
 }
Ejemplo n.º 39
0
 public void Emit(ParsingEvent parsingEvent)
 {
     _focus = _focus.Emit(parsingEvent);
 }
Ejemplo n.º 40
0
 public JTokenEmitter()
 {
     _focus = _root = new RootFocus(null);
 }
Ejemplo n.º 41
0
 public SequenceFocus(Focus parent)
     : base(parent)
 {
     _sequence = new JArray();
 }
Ejemplo n.º 42
0
 public PropertyFocus(Focus parent, string name)
     : base(parent)
 {
     _name = name;
 }
Ejemplo n.º 43
0
 public void SetFocus()
 {
     IsFocus = true;
     Focus?.Invoke();
 }
Ejemplo n.º 44
0
 public virtual void OnFocus()
 {
     Focus?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 45
0
        public TimelineEditorContext(Timeline timeline, Slide slide, String name, SlideshowEditController slideshowEditController, PropEditController propEditController, PropFactory propFactory, EditorController editorController, GuiFrameworkUICallback uiCallback, TimelineController timelineController)
        {
            this.slide                   = slide;
            this.currentTimeline         = timeline;
            this.slideshowEditController = slideshowEditController;
            this.propEditController      = propEditController;

            mvcContext = new AnomalousMvcContext();
            mvcContext.StartupAction = "Common/Start";
            mvcContext.FocusAction   = "Common/Focus";
            mvcContext.BlurAction    = "Common/Blur";
            mvcContext.SuspendAction = "Common/Suspended";
            mvcContext.ResumeAction  = "Common/Resumed";

            mvcContext.Models.add(new EditMenuManager());
            mvcContext.Models.add(new EditInterfaceHandler());

            var timelineEditorView = new TimelineEditorView("TimelineEditor", currentTimeline, timelineController, editorController, propEditController)
            {
                DisplayTitle = "Main Timeline"
            };

            timelineEditorView.ComponentCreated += timelineEditorView_ComponentCreated;
            mvcContext.Views.add(timelineEditorView);

            ExpandingGenericEditorView genericEditor = new ExpandingGenericEditorView("TimelinePropertiesEditor", currentTimeline.getEditInterface(), editorController, uiCallback)
            {
                DisplayTitle = "Properties"
            };

            genericEditor.ElementName = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Left)
            {
                AllowedDockLocations = DockLocation.Left | DockLocation.Right | DockLocation.Floating
            };
            mvcContext.Views.add(genericEditor);

            PropTimelineView propTimelineView = new PropTimelineView("PropTimeline", propEditController, propFactory)
            {
                DisplayTitle = "Prop Timeline"
            };

            propTimelineView.Buttons.add(new CloseButtonDefinition("Close", "PropTimeline/Close"));
            mvcContext.Views.add(propTimelineView);

            OpenPropManagerView propManagerView = new OpenPropManagerView("PropManager", propEditController)
            {
                DisplayTitle = "Prop Manager"
            };

            propManagerView.Buttons.add(new CloseButtonDefinition("Close", "PropManager/Close"));
            mvcContext.Views.add(propManagerView);

            MovementSequenceEditorView movementSequenceEditor = new MovementSequenceEditorView("MovementSequenceEditor", listenForSequenceChanges: true)
            {
                DisplayTitle = "Movement Sequence"
            };

            movementSequenceEditor.Buttons.add(new CloseButtonDefinition("Close", "MovementSequenceEditor/Close"));
            movementSequenceEditor.ElementName = new MDILayoutElementName(GUILocationNames.MDI, DockLocation.Top)
            {
                AllowedDockLocations = DockLocation.Top | DockLocation.Bottom | DockLocation.Floating
            };
            mvcContext.Views.add(movementSequenceEditor);

            SlideTaskbarView taskbar = new SlideTaskbarView("TimelineInfoBar", name);

            taskbar.addTask(new CallbackTask("SaveAll", "Save All", "CommonToolstrip/Save", "", 0, true, item =>
            {
                saveAll();
            }));
            taskbar.addTask(new RunMvcContextActionTask("Cut", "Cut", "Editor/CutIcon", "", "TimelineEditor/Cut", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Copy", "Copy", "Editor/CopyIcon", "", "TimelineEditor/Copy", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Paste", "Paste", "Editor/PasteIcon", "", "TimelineEditor/Paste", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("SelectAll", "Select All", "Editor/SelectAllIcon", "", "TimelineEditor/SelectAll", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Translation", "Translation", "Editor/TranslateIcon", "", "TimelineEditor/Translation", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("Rotation", "Rotation", "Editor/RotateIcon", "", "TimelineEditor/Rotation", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("PropTimeline", "Prop Timeline Editor", "Editor/PropTimelineEditorIcon", "", "PropTimeline/ShowIfNotOpen", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("PropManager", "Open Prop Manager", "Editor/PropManagerIcon", "", "PropManager/ShowIfNotOpen", mvcContext));
            taskbar.addTask(new RunMvcContextActionTask("MovementSequenceEditor", "Movement Sequence Editor", "Editor/MovementSequenceEditorIcon", "", "MovementSequenceEditor/ShowIfNotOpen", mvcContext));
            taskbar.addTask(new CallbackTask("EditSlide", "Edit Slide", "Lecture.Icon.EditSlide", "", 0, true, item =>
            {
                slideshowEditController.editSlide(slide);
            }));
            mvcContext.Views.add(taskbar);

            RunCommandsAction showCommand = new RunCommandsAction("Show",
                                                                  new ShowViewCommand("TimelineEditor"),
                                                                  new ShowViewCommand("TimelinePropertiesEditor"),
                                                                  new ShowViewCommand("TimelineInfoBar"));

            refreshPanelPreviews(showCommand);

            mvcContext.Controllers.add(new MvcController("TimelineEditor",
                                                         showCommand,
                                                         new RunCommandsAction("Close",
                                                                               new CloseAllViewsCommand()),
                                                         new CutAction(),
                                                         new CopyAction(),
                                                         new PasteAction(),
                                                         new SelectAllAction(),
                                                         new CallbackAction("Translation", context =>
            {
                propEditController.setMoveMode();
            }),
                                                         new CallbackAction("Rotation", context =>
            {
                propEditController.setRotateMode();
            })
                                                         ));

            mvcContext.Controllers.add(new MvcController("PropTimeline",
                                                         new RunCommandsAction("ShowIfNotOpen",
                                                                               new ShowViewIfNotOpenCommand("PropTimeline")
                                                                               ),
                                                         new RunCommandsAction("Close",
                                                                               new CloseViewCommand())));

            mvcContext.Controllers.add(new MvcController("PropManager",
                                                         new RunCommandsAction("ShowIfNotOpen",
                                                                               new ShowViewIfNotOpenCommand("PropManager")),
                                                         new RunCommandsAction("Close",
                                                                               new CloseViewCommand())));

            mvcContext.Controllers.add(new MvcController("MovementSequenceEditor",
                                                         new RunCommandsAction("ShowIfNotOpen",
                                                                               new ShowViewIfNotOpenCommand("MovementSequenceEditor")
                                                                               ),
                                                         new RunCommandsAction("Close",
                                                                               new CloseViewCommand())));

            mvcContext.Controllers.add(new MvcController("Common",
                                                         new RunCommandsAction("Start", new RunActionCommand("TimelineEditor/Show")),
                                                         new CallbackAction("Focus", context =>
            {
                GlobalContextEventHandler.setEventContext(eventContext);
                if (Focus != null)
                {
                    Focus.Invoke(this);
                }
            }),
                                                         new CallbackAction("Blur", context =>
            {
                GlobalContextEventHandler.disableEventContext(eventContext);
                propEditController.removeAllOpenProps();
                if (Blur != null)
                {
                    Blur.Invoke(this);
                }
            }),
                                                         new RunCommandsAction("Suspended", new SaveViewLayoutCommand()),
                                                         new RunCommandsAction("Resumed", new RestoreViewLayoutCommand())));

            eventContext = new EventContext();

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                saveAll();
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_S }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                if (timeline.TimelineController.Playing)
                {
                    timeline.TimelineController.stopPlayback();
                }
                else
                {
                    timeline.TimelineController.startPlayback(timeline, propEditController.MarkerPosition, false);
                }
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_SPACE }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Cut");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_X }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Copy");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_C }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Paste");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_V }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/SelectAll");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_A }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Translation");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_T }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: eventManager =>
            {
                mvcContext.runAction("TimelineEditor/Rotation");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_R }));

            eventContext.addEvent(new ButtonEvent(EventLayers.Gui,
                                                  frameUp: EventManager =>
            {
                mvcContext.runAction("PropTimeline/ShowIfNotOpen");
            },
                                                  keys: new KeyboardButtonCode[] { KeyboardButtonCode.KC_LCONTROL, KeyboardButtonCode.KC_P }));
        }
Ejemplo n.º 46
0
 public bool Update(Focus entity)
 {
     throw new NotImplementedException();
 }
        protected static List <IPrediction> DeserializePredictions(ModelType modelType,
                                                                   dynamic jsonObject)
        {
            var propertyValues = (JObject)jsonObject.data;

            var data = new List <IPrediction>();

            if (propertyValues.Count > 0)
            {
                string typeName = modelType.Prediction.Name;
                switch (typeName)
                {
                case "Color":
                {
                    foreach (dynamic color in jsonObject.data.colors)
                    {
                        data.Add(Color.Deserialize(color));
                    }
                    break;
                }

                case "Concept":
                {
                    foreach (dynamic concept in jsonObject.data.concepts)
                    {
                        data.Add(Concept.Deserialize(concept));
                    }
                    break;
                }

                case "Demographics":
                {
                    foreach (dynamic demographics in jsonObject.data.regions)
                    {
                        data.Add(Demographics.Deserialize(demographics));
                    }
                    break;
                }

                case "Embedding":
                {
                    foreach (dynamic embedding in jsonObject.data.embeddings)
                    {
                        data.Add(Embedding.Deserialize(embedding));
                    }
                    break;
                }

                case "FaceConcepts":
                {
                    foreach (dynamic faceConcepts in
                             jsonObject.data.regions)
                    {
                        data.Add(FaceConcepts.Deserialize(faceConcepts));
                    }
                    break;
                }

                case "FaceDetection":
                {
                    foreach (dynamic faceDetection in jsonObject.data.regions)
                    {
                        data.Add(FaceDetection.Deserialize(faceDetection));
                    }
                    break;
                }

                case "FaceEmbedding":
                {
                    foreach (dynamic faceEmbedding in jsonObject.data.regions)
                    {
                        data.Add(FaceEmbedding.Deserialize(faceEmbedding));
                    }
                    break;
                }

                case "Focus":
                {
                    foreach (dynamic focus in jsonObject.data.regions)
                    {
                        data.Add(Focus.Deserialize(focus,
                                                   (decimal)jsonObject.data.focus.value));
                    }
                    break;
                }

                case "Frame":
                {
                    foreach (dynamic frame in jsonObject.data.frames)
                    {
                        data.Add(Frame.Deserialize(frame));
                    }
                    break;
                }

                case "Logo":
                {
                    foreach (dynamic logo in jsonObject.data.regions)
                    {
                        data.Add(Logo.Deserialize(logo));
                    }
                    break;
                }

                default:
                {
                    throw new ClarifaiException(
                              string.Format("Unknown output type `{0}`", typeName));
                }
                }
            }
            return(data);
        }
Ejemplo n.º 48
0
 private void Focused()
 {
     Focus.Focus();
 }
        public static FociGridContainer CreateTreeFromScript(string fileName, Script script)
        {
            Dictionary <string, PrerequisitesSet> waitingList = new Dictionary <string, PrerequisitesSet>();
            FociGridContainer container = new FociGridContainer(Path.GetFileNameWithoutExtension(fileName));

            container.TAG = script.FindValue("tag") != null?script.FindValue("tag").Parse() : "";

            foreach (CodeBlock block in script.FindAllValuesOfType <CodeBlock>("focus"))
            {
                Focus newFocus = new Focus();
                newFocus.UniqueName = block.FindValue("id").Parse();
                newFocus.Image      = block.FindValue("icon").Parse().Replace("GFX_", "");
                newFocus.X          = int.Parse(block.FindValue("x").Parse());
                newFocus.Y          = int.Parse(block.FindValue("y").Parse());
                newFocus.Cost       = int.Parse(block.FindValue("cost").Parse());
                foreach (ICodeStruct exclusives in block.FindAllValuesOfType <ICodeStruct>("mutually_exclusive"))
                {
                    foreach (ICodeStruct focuses in exclusives.FindAllValuesOfType <ICodeStruct>("focus"))
                    {
                        //Check if focus exists in list
                        Focus found = container.FociList.FirstOrDefault((f) =>
                                                                        f.UniqueName == focuses.Parse());
                        if (found != null)
                        {
                            MutuallyExclusiveSet set = new MutuallyExclusiveSet(newFocus, found);
                            newFocus.MutualyExclusive.Add(set);
                            found.MutualyExclusive.Add(set);
                        }
                    }
                }
                foreach (ICodeStruct prerequistes in block.FindAllValuesOfType <ICodeStruct>("prerequisite"))
                {
                    if (!prerequistes.FindAllValuesOfType <ICodeStruct>("focus").Any())
                    {
                        break;
                    }
                    PrerequisitesSet set = new PrerequisitesSet(newFocus);
                    foreach (ICodeStruct focuses in prerequistes.FindAllValuesOfType <ICodeStruct>("focus"))
                    {
                        //Add the focus as a prerequisites in the current existing focuses
                        //or put into wait
                        Focus search = container.FociList.FirstOrDefault((f) =>
                                                                         f.UniqueName == focuses.Parse());
                        if (search != null)
                        {
                            set.FociList.Add(search);
                        }
                        else
                        {
                            waitingList[focuses.Parse()] = set;
                        }
                    }
                    //If any prerequisite was added (Poland has empty prerequisite blocks...)
                    if (set.FociList.Any())
                    {
                        newFocus.Prerequisite.Add(set);
                    }
                }
                //Get all core scripting elements
                Script InternalFocusScript = new Script();
                for (int i = 0; i < CORE_FOCUS_SCRIPTS_ELEMENTS.Length; i++)
                {
                    ICodeStruct found = block.FindAssignation(CORE_FOCUS_SCRIPTS_ELEMENTS[i]);
                    if (found != null)
                    {
                        InternalFocusScript.Code.Add(found);
                    }
                }
                newFocus.InternalScript = InternalFocusScript;
                container.FociList.Add(newFocus);
            }
            //Repair lost sets, shouldn't happen, but in case
            foreach (KeyValuePair <string, PrerequisitesSet> item in waitingList)
            {
                Focus search = container.FociList.FirstOrDefault((f) =>
                                                                 f.UniqueName == item.Key);
                if (search != null)
                {
                    item.Value.FociList.Add(search);
                }
            }
            return(container);
        }
Ejemplo n.º 50
0
 private void Unfocused()
 {
     Focus.Unfocus();
 }
Ejemplo n.º 51
0
 public void UpdateFocus(Focus focus)
 {
     focusRepository.Update(focus);
     //SaveFocus();
 }
Ejemplo n.º 52
0
 public static byte[] CameraFocus(uint deviceAddress, Focus action) => Message.GetMessage(deviceAddress, (byte)action, 0x00, 0x00, 0x00);
Ejemplo n.º 53
0
 public override Cupe CrearCupe()
 {
     autoc = new Focus();
     return(autoc);
 }
Ejemplo n.º 54
0
 internal void OnFocus()
 {
     Focus?.Invoke();
 }
Ejemplo n.º 55
0
 public byte[] CameraFocus(uint deviceAddress, Focus action)
 {
     return(Message.GetMessage(deviceAddress, (byte)action, 0x00, 0x00, 0x00));
 }
Ejemplo n.º 56
0
 private void OnFocusChanged(bool focused)
 {
     Focus?.Invoke(focused);
 }
Ejemplo n.º 57
0
 public RootFocus(Focus parent)
     : base(parent)
 {
 }
Ejemplo n.º 58
0
 public override void EnterState(Focus focus)
 {
     focus.DebugText.text = "RESTING";
 }
Ejemplo n.º 59
0
        /// <summary>
        /// 获得用户BODY
        /// </summary>
        /// <param name="accountId"></param>
        /// <returns></returns>
        public static UserBody GetUserBody(string accountId)
        {
            IMongoQuery x     = Query.EQ(nameof(UserBody.AccountId), accountId);
            var         cache = MongoDbRepository.GetFirstCacheRec <UserBody>(x);

            if (cache != null)
            {
                return(cache);
            }
            UserBody u = new UserBody();

            u.AccountId = accountId;
            u.UserInfo  = UserInfo.GetUserInfoBySn(accountId);

            switch (u.UserInfo.RegisterMethod)
            {
            case GithubAccount.Github:
                u.GitInfo = GithubAccount.GetGithubAccountBySn(u.UserInfo.RegisterAccountID);
                break;

            case QQAccount.QQ:
                u.QQInfo = QQAccount.GetQQAccountBySn(u.UserInfo.RegisterAccountID);
                break;

            default:
                break;
            }

            //获得用户文章列表
            u.ArticleList = new List <ArticleItemBody>();
            var alist = Article.GetListByOwnerId(accountId);

            foreach (var item in alist)
            {
                u.ArticleList.Add(ArticleListManager.GetArticleItemBodyById(item.Sn));
            }
            //关注的人
            u.FocusList = new List <UserInfo>();
            var focuslist = Focus.GetFocus(accountId);

            foreach (var item in focuslist)
            {
                u.FocusList.Add(UserInfo.GetUserInfoBySn(item));
            }
            //跟随的人
            u.FollowList = new List <UserInfo>();
            var followlist = Focus.GetFollow(accountId);

            foreach (var item in followlist)
            {
                u.FollowList.Add(UserInfo.GetUserInfoBySn(item));
            }
            //收藏
            u.StockList = new List <ArticleItemBody>();
            var slist = OwnerTableOperator.GetRecListByOwnerId <Stock>(accountId);

            foreach (var item in slist)
            {
                u.StockList.Add(ArticleListManager.GetArticleItemBodyById(item.ArticleID));
            }
            UserBody.InsertUserBody(u);
            return(u);
        }
Ejemplo n.º 60
0
 public MappingFocus(Focus parent)
     : base(parent)
 {
     _mapping = new JObject();
 }