Example #1
0
        public Activity(IntroToORLibFrame.Activity activity)
        {
            InitializeComponent();
            name      = activity.name;
            this.from = activity.from;
            to        = activity.to;
            duration  = activity.duration;

            NameText.Text     = name;
            FromText.Text     = from.ToString();
            ToText.Text       = to.ToString();
            DurationText.Text = duration.ToString();
        }
        private void UpdateGraph(object sender, RoutedEventArgs e)
        {
            activities = new List <IntroToORLibFrame.Activity>();
            foreach (Activity activityCtrl in listBox.Items)
            {
                int    from     = activityCtrl.from;
                int    to       = activityCtrl.to;
                double duration = activityCtrl.duration;
                IntroToORLibFrame.Activity activity = new IntroToORLibFrame.Activity(activityCtrl.name, from, to, duration);
                activities.Add(activity);
            }
            int numNodes = int.MinValue;

            for (int i = 0; i < activities.Count; i++)
            {
                if (activities[i].to > numNodes)
                {
                    numNodes = activities[i].to;
                }
            }
            NumNodes.Text = numNodes.ToString();
            NumArcs.Text  = activities.Count.ToString();
            UpdateNumNodes();
        }