示例#1
0
        private async void OutputSummaryButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Multiselect      = false;
            fd.CheckFileExists  = true;
            fd.RestoreDirectory = true;
            fd.InitialDirectory = "D:\\孙思杰\\桌面\\女王大人の任务\\花王\\新建文件夹";
            if (fd.ShowDialog() == DialogResult.OK)
            {
                statusLabel.Text = "正在输出数据";
                bool success = false;
                try
                {
                    await SummaryPanel.CopyToSummaryPanelExcelAsync(app, summaryPanelList, fd.FileName);

                    success = true;
                }
                catch (Exception exc)
                {
                    Trace.TraceError(exc.ToString());
                    statusLabel.Text = "失败:" + exc.Message;
                }
                if (success)
                {
                    statusLabel.Text = "复制成功";
                }
            }
            ;
        }
示例#2
0
    //
    // Public Methods
    //

    public void Init(GridData grid, PlanningOutput planningOutput)
    {
        this.grid           = grid;
        this.planningOutput = planningOutput;

        // Find Components
        map = ComponentManager.Instance.Get <MapController>();
        var canvas = GameObject.FindWithTag("Canvas").GetComponent <Canvas>();

        // Create pin container (inside map)
        pinContainer = new GameObject("PinContainer").transform;
        pinContainer.SetParent(map.transform, false);

        // Create flag container (inside UI canvas)
        flagContainer      = Instantiate(flagContainerPrefab, canvas.transform, false);
        flagContainer.name = flagContainerPrefab.name;
        flagContainer.transform.SetSiblingIndex(0);

        // Create summary flag container (inside UI canvas)
        summaryflagContainer      = Instantiate(flagContainerPrefab, canvas.transform, false);
        summaryflagContainer.name = "Summary" + flagContainerPrefab.name;
        summaryflagContainer.transform.SetSiblingIndex(0);

        // Create summary pin/flag
        summaryPanelFlag = Instantiate(summaryPanelPrefab, summaryflagContainer, false);
        summaryPanelFlag.Init("SummaryPanelFlag", grid, 3);
        summaryPanelFlag.SetPlanningOutput(planningOutput);
        summaryPanelFlag.gameObject.SetActive(showFlags);
        summaryPin = Instantiate(summaryPinPrefab, pinContainer, true);
        summaryPin.Init(Coordinate.Zero, groupPins, summaryPanelFlag);

        // Attach to events
        map.OnMapUpdate += OnMapUpdate;
    }
示例#3
0
    //
    // Public Methods
    //

    public void Init(PlanningGroup group, SummaryPanel summaryPanel)
    {
        base.Init(group.center, summaryPanel);

        this.group = group;
        UpdateLineCount(group.cells.Count);
    }
示例#4
0
            public StockLine(string symbol, StockList parentList, SummaryPanel infoPanel)
            {
                this.Size  = new System.Drawing.Size(275, 50);
                ParentList = parentList;

                TickerLabel          = new Label();
                TickerLabel.Size     = new System.Drawing.Size(50, 15);
                TickerLabel.Location = new System.Drawing.Point(5, (this.Size.Height / 2) - (TickerLabel.Size.Height / 2));
                TickerLabel.MouseUp += (sender, e) => { this.OnMouseUp(e); };
                Controls.Add(TickerLabel);

                SummaryChart                 = new StockChartBasic(symbol);
                SummaryChart.Canvas.Size     = new System.Drawing.Size(150, this.Size.Height);
                SummaryChart.Canvas.Location = new System.Drawing.Point((TickerLabel.Location.X + TickerLabel.Size.Width) + 5, 0);
                SummaryChart.Canvas.MouseUp += (sender, e) => { this.OnMouseUp(e); };
                SummaryChart.SetSubscritpion(infoPanel.StockSubscription);
                Controls.Add(SummaryChart.Canvas);

                InfoPanel            = infoPanel;
                InfoPanel.Location   = new System.Drawing.Point((SummaryChart.Canvas.Location.X + SummaryChart.Canvas.Width) + 5, 0);
                InfoPanel.Size       = new System.Drawing.Size(this.Size.Width - InfoPanel.Location.X, this.Height);
                InfoPanel.ParentLine = this;
                InfoPanel.Initialize();
                Controls.Add(InfoPanel);

                this.Symbol      = symbol;
                TickerLabel.Text = symbol;
            }
示例#5
0
    //
    // Unity Methods
    //

    private void OnDestroy()
    {
        if (summaryPanel != null)
        {
            Destroy(summaryPanel.gameObject);
            summaryPanel = null;
        }
    }
示例#6
0
    //
    // Public Methods
    //

    public void Init(Coordinate coords, List <GroupPin> groupPins, SummaryPanel summaryPanel)
    {
        base.Init(coords, summaryPanel);

        this.groupPins = groupPins;
        this.name      = "SummaryPin";

        Show(false);
    }
示例#7
0
 /// <summary>
 /// Adds a new symbol to the list
 /// </summary>
 /// <param name="group">The group the symbol should be added as part of</param>
 /// <param name="symbol">The ticker symbol to add</param>
 /// <param name="infoPanel">A panel that displays information about the stock</param>
 public void Add(string group, string symbol, SummaryPanel infoPanel = null)
 {
     if (this.IsHandleCreated)
     {
         this.BeginInvoke((Action)(() =>
         {
             AddInternal(group, symbol, infoPanel);
         }));
     }
     else
     {
         AddInternal(group, symbol, infoPanel);
     }
 }
示例#8
0
        /// <summary>
        /// Adds a new symbol to the list
        /// </summary>
        /// <param name="group">The group the symbol should be added as part of</param>
        /// <param name="symbol">The ticker symbol to add</param>
        /// <param name="infoPanel">A panel that displays information about the stock</param>
        private void AddInternal(string group, string symbol, SummaryPanel infoPanel)
        {
            DataAccessor.Subscription sub = null;
            if (infoPanel == null)
            {
                sub       = DataAccessor.Subscribe(symbol, DataAccessor.SUBSCRIBE_FIVE_SEC);
                infoPanel = new PercentageChangeSummary(sub);
            }

            // Ensure the symbol is not already in the list
            bool             isNew = true;
            List <StockLine> stockList;

            if (!Stocks.TryGetValue(group, out stockList))
            {
                stockList = new List <StockLine>();
                Stocks.Add(group, stockList);
                if (!GroupOrder.Contains(group))
                {
                    GroupOrder.Add(group);
                }
                GroupLabels.Add(group, new Label());
                Controls.Add(GroupLabels[group]);
            }
            for (int i = 0; i < stockList.Count; i++)
            {
                if (stockList[i].Symbol.Equals(symbol))
                {
                    isNew = false;
                    break;
                }
            }
            if (isNew)
            {
                StockLine newLine = new StockLine(symbol, this, infoPanel);
                newLine.Location = new System.Drawing.Point(5, (int)((Stocks.Count + 0.5) * (newLine.Height + 5)));
                newLine.MouseUp += (sender, e) => { AddStockUi(symbol); };
                stockList.Add(newLine);
                this.Controls.Add(newLine);
                this.Refresh();

                // Request data to fill the summary chart
                newLine.SummaryChart.RequestData(DateTime.Now.Date.AddHours(-12), DateTime.Now.Date.AddHours(16), new TimeSpan(0, 1, 0));
            }
        }
示例#9
0
    private GroupPin AddGroupPin(PlanningGroup group)
    {
        // Create summary panel
        SummaryPanel groupSummary = Instantiate(summaryPanelPrefab, flagContainer, false);

        groupSummary.SetPlanningOutput(planningOutput);
        groupSummaries.Add(groupSummary);
        groupSummary.Init(summaryPanelPrefab.name, grid, 2);
        groupSummary.gameObject.SetActive(showFlags);

        // Create pin
        var groupPin = Instantiate(groupPinPrefab, pinContainer, true);

        groupPin.name = "Group_" + group.id;
        groupPin.Init(group, groupSummary);
        groupPin.globalCount = planningGroups.Count;
        groupPin.UpdatePosition(map);
        groupPins.Add(groupPin);

        return(groupPin);
    }
示例#10
0
        private async void SelectRowDataExcelButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();

            fd.Multiselect      = false;
            fd.CheckFileExists  = true;
            fd.RestoreDirectory = true;
            fd.InitialDirectory = "D:\\孙思杰\\桌面\\女王大人の任务\\花王\\新建文件夹";
            if (fd.ShowDialog() == DialogResult.OK)
            {
                statusLabel.Text = "正在读取数据";
                string filename = fd.FileName;
                bool   success  = false;
                try
                {
                    consumerPanelList = await ConsumerPanel.ReadConsumerPanelsAsync(app, filename);

                    summaryPanelList = await SummaryPanel.ReadSummaryPanelsAsync(app, filename);

                    filePath = filename;
                    success  = true;
                }
                catch (Exception exc)
                {
                    statusLabel.Text = "失败:" + exc.Message;
                    Trace.TraceError(exc.ToString());
                }
                if (success)
                {
                    statusLabel.Text            = "读取成功";
                    OutputModelButton.Enabled   = true;
                    OutputSummaryButton.Enabled = true;
                }
            }
            ;
        }
示例#11
0
    //
    // Public Methods
    //

    public void Init(Coordinate coords, SummaryPanel summaryPanel)
    {
        base.Init(coords);

        this.summaryPanel = summaryPanel;
    }
示例#12
0
 private void UpdateGroupSummary(SummaryPanel groupSummary, PlanningGroup group)
 {
     groupSummary.gameObject.SetActive(showFlags);
     groupSummary.UpdateGroupSummaryPanel(group);
     groupSummary.gridNoData = group.gridNoData;
 }
 private void RebuildView(IList <LogFile.Entry> entries, IList <Performance.Group> groups)
 {
     SummaryPanel.RebuildView(entries, groups);
     LogFileEvents.RebuildView(entries);
     FileTree.RebuildView(groups);
 }