Ejemplo n.º 1
0
        //static long nextTick = DateTime.Now.Ticks;

        public BusinessGraphicsForm(BusinessGraphicsSourceDesign sourceDesign, Window window)
        {
            InitializeComponent();
            if (window is ActiveWindow)
            {
                wnd = (ActiveWindow)window;
                BackColor = wnd.BorderColorFrienly;
            }
            sourceDesign.Wnd = wnd;
            sourceDesign.IsPlayerMode = true;
            _sourceCopy = SourceDesignClone(sourceDesign);
            this.sourceDesign = sourceDesign;
            this.sourceDesign.InitializeChart(true);

            Controls.Clear();
            this.sourceDesign.AddChartToContainer(this, wnd);

            FormClosing += BusinessGraphicsForm_FormClosing;

            if (sourceDesign.ODBCRefreshInterval > 0)
            {
                int time = sourceDesign.ODBCRefreshInterval*1000;
                if (((BusinessGraphicsResourceInfo) sourceDesign.ResourceDescriptor.ResourceInfo).ProviderType ==
                    ProviderTypeEnum.ODBC)
                    refreshTimer = new Timer(RefreshChart, "Timer", time, time);
            }
            //начал делать тут проверку, а она оказывается не нужна//
            //nextTick += time; 
        }
Ejemplo n.º 2
0
        public ChartSetupForm(BusinessGraphicsSourceDesign source)
        {
            InitializeComponent();

            // Устанавливаем размер документа, чтобы не было лишнего пустого поля.
            diagram1.Model.DocumentSize.Width = source.Chart.Width;
            diagram1.Model.DocumentSize.Height = source.Chart.Height;
            this.source = source;

            if (String.IsNullOrEmpty(source.DiagramStyle))
                source.DiagramStyle = defaultName;

            if (String.IsNullOrEmpty(source.SubDiagramStyle))
                source.SubDiagramStyle = defaultName;

            source.LoadStyles();
            this.DiagramStyleData = source.DiagramStyleData;
            this.DiagramStyle = source.DiagramStyle;
            this.SubDiagramStyleData = source.SubDiagramStyleData;
            this.SubDiagramStyle = source.SubDiagramStyle;

            if (source.DiagramStyle != defaultName && source.DiagramStyleData==null) this.DiagramStyleData = this.GetStyleData(source.DiagramStyle);
            if (source.SubDiagramStyle != defaultName && source.SubDiagramStyleData == null) this.SubDiagramStyleData = this.GetStyleData(source.SubDiagramStyle);

            this.tabControlAdv1.SelectedIndexChanged += new System.EventHandler(this.tabControlAdv1_SelectedIndexChanged);
            ReloadStyleList();
            styleComboBox.SelectedItem = DiagramStyle;

            source.InitializeChart(true);
            this.chart1 = source.Chart;

            LoadStyle();
            RefreshChart();
            this.FormClosing += new FormClosingEventHandler(ChartSetupForm_FormClosing);
            styleComboBox.SelectedValueChanged += new EventHandler(styleComboBox_SelectedValueChanged);

            saveButton.Enabled = styleComboBox.SelectedValue.ToString() != defaultName;
            removeButton.Enabled = styleComboBox.SelectedValue.ToString() != defaultName;
            if (!source.AllowSubDiagram)
            {
                this.tabControlAdv1.TabPages[1].Hide();
            }
            else
            {
                this.tabControlAdv1.TabPages[1].Show();
            }

            zoomCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
            zoomCombo.Items.AddRange(Percent.CreateList());
            zoomCombo.Text = "100%";
            
            tip = new SuperToolTip();
            tip.UseFading = SuperToolTip.FadingType.System;
        }
Ejemplo n.º 3
0
 private BusinessGraphicsSourceDesign SourceDesignClone(BusinessGraphicsSourceDesign source)
 {
     BusinessGraphicsSourceDesign result;
     BinaryFormatter _serializer = new BinaryFormatter();
     using (MemoryStream stream = new MemoryStream())
     {
         _serializer.Serialize(stream, source);
         stream.Seek(0, SeekOrigin.Begin);
         result = (BusinessGraphicsSourceDesign) _serializer.Deserialize(stream);
     }
     return result;
 }
Ejemplo n.º 4
0
 private void RefreshChart(object state)
 {
     Invoke(new MethodInvoker(() =>
                                  {
                                      if ((state is string) && ((state as string).Equals("default")))
                                          sourceDesign = SourceDesignClone(_sourceCopy);
                                      if (sourceDesign != null)
                                      {
                                          //Останавливаем перерисовку
                                          this.SetStyle(ControlStyles.UserPaint |
                                          ControlStyles.AllPaintingInWmPaint |
                                          ControlStyles.OptimizedDoubleBuffer, true);
                                          this.UpdateStyles();
                                          
                                          bool clearState = true;
                                          if ((state is string) && ((state as string).Equals("Timer")))
                                              clearState = false;
                                          sourceDesign.InitializeData(true);
                                          sourceDesign.InitializeChart(clearState);
                                          Controls.Clear();
                                          sourceDesign.AddChartToContainer(this, wnd);
                                          //Возобновляем перерисовку
                                          this.Visible = true;
                                          this.Update();
                                      }
                                  }));
 }