コード例 #1
0
        public StreamTableControl(StreamPropertiesTable tableData,
                                  PFD.Streams.StreamControl parent, Workspace workspace, DrawingCanvas canvas)
        {
            InitializeComponent();

            m_table  = tableData;
            m_parent = parent;
            m_ws     = workspace;
            m_canvas = canvas;

            // Do the initial UI setup
            HeaderTextBlock.Text = "Stream #" + m_table.Stream.Id.ToString();
            Location             = new Point(tableData.Location.X, tableData.Location.Y);
            UpdateUI();

            // Ensure that the minimize button eats mouse events
            MinimizeButton.MouseLeftButtonDown += this.MinimizeButton_MouseButtonEvent;
            MinimizeButton.MouseLeftButtonUp   += this.MinimizeButton_MouseButtonEvent;

            // Monitor changes in the parent stream (all we care about is the Id)
            m_table.Stream.PropertyChanged += this.Stream_PropertyChanged;

            // Monitor changes in the row data
            m_table.RowPropertyChanged += new PropertyChangedEventHandler(RowPropertyChanged);

            m_table.RowsChanged += new EventHandler(TableRowsChanged);

            // Monitor changes to the difficulty level so we can show/hide the temperature row
            // for chemical stream property tables
            m_ws.PropertyChanged += new PropertyChangedEventHandler(WorkspacePropertyChanged);

            // Monitor changes to m_table
            m_table.PropertyChanged += new PropertyChangedEventHandler(TablePropertyChanged);
        }
コード例 #2
0
        protected void CreatePropertiesTable(StreamPropertiesTable table)
        {
            DrawingCanvas canvas = Core.App.Workspace.DrawingCanvas;

            m_table = new UI.StreamTableControl(table, this, canvas.GetWorkspace(), canvas);
            m_table.MinimizeButton.Click += new RoutedEventHandler(MinimizeTableButtonClick);
            UpdateStreamLocation();
        }
コード例 #3
0
        public HeatTableAdapter(StreamPropertiesTable itable)
        {
            // Make sure it's the right kind of table
            if (StreamType.Heat != table.StreamType)
            {
                throw new ArgumentException();
            }

            table = itable;
        }
コード例 #4
0
 /// <summary>
 /// This creates a TableAdapter for the table passed.
 /// </summary>
 /// <param name="table"></param>
 /// <returns></returns>
 public static ITableAdapter CreateTableAdapter(StreamPropertiesTable table)
 {
     if (StreamType.Chemical == table.StreamType)
     {
         return(new ChemicalTableAdapter(table));
     }
     else if (StreamType.Heat == table.StreamType)
     {
         return(new HeatTableAdapter(table));
     }
     return(new NullTableAdapter());
 }
コード例 #5
0
        private void PropertiesTable_RowPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            // We only care about the selected compounds
            if (!e.PropertyName.Equals("SelectedCompound"))
            {
                return;
            }

            // Backup the currently selected item
            string currentSelection = Compound_ComboBox.SelectedItem as string;

            // Clear the combo box items
            Compound_ComboBox.Items.Clear();

            // Go through all stream properties tables
            foreach (AbstractStream stream in m_ws.Streams)
            {
                StreamPropertiesTable table = stream.PropertiesTable;
                if (null == table)
                {
                    continue;
                }
                if (StreamType.Chemical != table.StreamType)
                {
                    continue;
                }

                // Go through the rows and look for at the selected compound. Add items to the
                // combo box as needed.
                foreach (IStreamDataRow data in table.Rows)
                {
                    string s = (data as ChemicalStreamData).SelectedCompound;
                    if (!string.IsNullOrEmpty(s) && !s.Equals("Overall") &&
                        !Compound_ComboBox.Items.Contains(s))
                    {
                        Compound_ComboBox.Items.Add(s);
                    }
                }
            }

            // Re-select what was previously selected
            if (!string.IsNullOrEmpty(currentSelection) &&
                Compound_ComboBox.Items.Contains(currentSelection))
            {
                Compound_ComboBox.SelectedItem = currentSelection;
            }

            // Invoke the selection-changed event to ensure that everything works
            Compound_ComboBox_SelectionChanged(this, EventArgs.Empty as SelectionChangedEventArgs);
        }
コード例 #6
0
        private void WorkspaceStreamsCollectionChanged(object sender, EventArgs e)
        {
            // Start by unsubscribing from the old list
            foreach (StreamPropertiesTable table in m_monitoredTables)
            {
                table.RowPropertyChanged -= this.TableRowPropertyChanged;
            }

            // Rebuild the list and subsribe to changes in chemical stream property tables
            m_monitoredTables.Clear();
            foreach (AbstractStream stream in m_workspace.Streams)
            {
                ChemicalStream cs = stream as ChemicalStream;
                if (null == cs)
                {
                    // Ignore it if it's not a chemical stream
                    continue;
                }

                StreamPropertiesTable table = cs.PropertiesTable;
                if (null == table)
                {
                    throw new InvalidOperationException(
                              "Stream in workspace has a null table");
                }
                m_monitoredTables.Add(table);
                table.RowPropertyChanged += this.TableRowPropertyChanged;
            }

            //this code handles changes made to streams for the purposes of the scopes menu
            foreach (AbstractStream stream in m_monitoredStreams)
            {
                stream.PropertyChanged -= this.StreamPropertyChanged;
            }
            m_monitoredStreams.Clear();
            foreach (AbstractStream stream in m_workspace.Streams)
            {
                m_monitoredStreams.Add(stream);
                stream.PropertyChanged += new PropertyChangedEventHandler(StreamPropertyChanged);
            }
            UpdateCompounds();
            updateScopes();
        }
コード例 #7
0
 public InsertTableRow(int index, IStreamDataRow row, StreamPropertiesTable table)
 {
     m_index = index;
     m_row   = row;
     m_table = table;
 }
コード例 #8
0
 /// <summary>
 /// This is the contsructor
 /// </summary>
 /// <param name="itable">This is the table we want data from</param>
 public ChemicalTableAdapter(StreamPropertiesTable itable)
 {
     table = itable;
 }
コード例 #9
0
 public RemoveTableRow(int index, StreamPropertiesTable table)
 {
     m_index = index;
     m_table = table;
 }