Пример #1
0
        private void MainFrm_Load(object sender, EventArgs e)
        {
            // Create an Instance of the Dashboard
            DashBoard nForm = new DashBoard(this);

            currentForm = MyForms.DashBoard;
            calledForm  = nForm;

            //Set New Form to show in Display
            // UpdateMainFormPanel(ref Form DisplayFrm);
            // Remove the Top Level desingation for the Form
            nForm.TopLevel = false;

            //Set the Border Style to None to remove normal window Borders
            nForm.FormBorderStyle = FormBorderStyle.None;

            //Anchor Form for Expansion and contraction of window
            nForm.Anchor = (AnchorStyles.Bottom |
                            AnchorStyles.Left |
                            AnchorStyles.Top |
                            AnchorStyles.Right);

            // Add Form to Panel then Show Form
            pnl_Main.Controls.Add(nForm);
            currentForm = MyForms.DashBoard;
            nForm.Show();
            // Toggle Menu Item Visibility
            ToggleMenuItems(currentForm);
        }
Пример #2
0
        private void mnu_Stock_View_Click(object sender, EventArgs e)
        {
            pnl_Main.Controls.Clear();

            //Create New instance of Form StockView
            StockView nForm = new StockView(stock, this);

            //Set CalledForm for the IValueUpdater Interface
            calledForm = nForm;

            // Remove the Top Level desingation for the Form
            nForm.TopLevel = false;

            //Set the Border Style to None to remove normal window Borders
            nForm.FormBorderStyle = FormBorderStyle.None;

            //Anchor Form for Expansion and contraction of window
            nForm.Anchor = (AnchorStyles.None);

            // Add Form to Panel then Show Form
            pnl_Main.Controls.Add(nForm);
            currentForm = MyForms.Stock;
            nForm.Show();
            ToggleMenuItems(currentForm);
        }
        /// <summary>
        /// Set the property value into the passed entry object.
        /// </summary>
        /// <param name="entry">
        /// The entry object.
        /// </param>
        /// <param name="value">
        /// A new property value.
        /// </param>
        /// <seealso cref="IValueUpdater.Update"/>
        protected virtual void Set(IInvocableCacheEntry entry, object value)
        {
            IValueManipulator manipulator = m_manipulator;

            if (m_manipulator != null)
            {
                IValueUpdater updater = manipulator.Updater;
                if (updater != null)
                {
                    entry.Update(updater, value);
                    return;
                }
            }
            entry.SetValue(value, false);
        }
        /// <summary>
        /// Process an <see cref="IInvocableCacheEntry"/>.
        /// </summary>
        /// <param name="entry">
        /// The <b>IInvocableCacheEntry</b> to process.
        /// </param>
        /// <returns>
        /// The result of the processing, if any.
        /// </returns>
        public override object Process(IInvocableCacheEntry entry)
        {
            IValueUpdater updater = m_updater;

            if (updater == null)
            {
                entry.SetValue(m_value, true);
            }
            else if (entry.IsPresent)
            {
                object target = entry.Value;
                updater.Update(target, m_value);
                entry.SetValue(target, true);
            }
            return(true);
        }
        public void TestCompositeUpdater()
        {
            IValueUpdater updater  = new CompositeUpdater("field");
            IValueUpdater updater1 = new CompositeUpdater("field");
            IValueUpdater updater2 = new ReflectionUpdater("field");

            Assert.IsNotNull(updater);
            Assert.AreEqual(updater, updater1);
            Assert.AreNotEqual(updater, updater2);
            Assert.AreEqual(updater.ToString(), updater1.ToString());
            Assert.AreEqual(updater.GetHashCode(), updater1.GetHashCode());

            IValueExtractor extractor = (updater as CompositeUpdater).Extractor;

            Assert.IsNotNull(extractor);
            IValueUpdater updter = (updater as CompositeUpdater).Updater;

            Assert.IsNotNull(updter);
            Assert.IsInstanceOf(typeof(IdentityExtractor), extractor);
            Assert.IsInstanceOf(typeof(ReflectionUpdater), updter);

            ReflectionTestType o = new ReflectionTestType();
            int value            = 100;

            o.field = 0;
            updater.Update(o, value);
            Assert.AreEqual(o.field, value);

            updater = new CompositeUpdater("InnerMember.field");

            IValueExtractor ext = new ChainedExtractor("InnerMember");
            IValueUpdater   upd = new ReflectionUpdater("field");

            updater1 = new CompositeUpdater(ext, upd);

            Assert.IsNotNull(updater);
            Assert.AreEqual(updater, updater1);
            Assert.AreEqual(updater.ToString(), updater1.ToString());
            Assert.AreEqual(updater.GetHashCode(), updater1.GetHashCode());

            updater.Update(o, value);
            Assert.AreEqual(o.InnerMember.field, value);
        }
Пример #6
0
        private void mnu_FileDashBoard_Click(object sender, EventArgs e)
        {
            //Adjust The Visiblity of Menu Items
            mnu_FileDashBoard.Visible = false;
            mnu_Stock.Visible         = true;
            mnu_FileBroker.Visible    = true;
            mnu_Stock_View.Visible    = true;

            //Cleare the main Panel of controls
            pnl_Main.Controls.Clear();


            // Create an Instance of the Dashboard
            DashBoard nForm = new DashBoard(this);

            calledForm = nForm;

            //Set New Form to show in Display
            // UpdateMainFormPanel(ref Form DisplayFrm);
            // Remove the Top Level desingation for the Form
            nForm.TopLevel = false;

            //Set the Border Style to None to remove normal window Borders
            nForm.FormBorderStyle = FormBorderStyle.None;

            //Anchor Form for Expansion and contraction of window
            nForm.Anchor = (AnchorStyles.Bottom |
                            AnchorStyles.Left |
                            AnchorStyles.Top |
                            AnchorStyles.Right);

            // Add Form to Panel then Show Form
            pnl_Main.Controls.Add(nForm);
            currentForm = MyForms.DashBoard;
            nForm.Show();
            ToggleMenuItems(currentForm);
        }
 /// <summary>
 /// Construct an <b>UpdaterProcessor</b> based on the specified
 /// <see cref="IValueUpdater"/>.
 /// </summary>
 /// <param name="updater">
 /// An <b>IValueUpdater</b> object; passing <c>null</c> will simpy
 /// replace the entry's value with the specified one instead of
 /// updating it.
 /// </param>
 /// <param name="value">
 /// The value to update the target entry with.
 /// </param>
 public UpdaterProcessor(IValueUpdater updater, object value)
 {
     m_updater = updater;
     m_value   = value;
 }
Пример #8
0
 public override void OnActive(string topicPath, ITopicUpdater updater)
 {
     valueUpdater = updater.ValueUpdater <IJSON>();
 }
Пример #9
0
 public MyTopicUpdateSource(IValueUpdater <IJSON> valueUpdater)
 {
     this.valueUpdater = valueUpdater;
 }
Пример #10
0
 /// <summary>
 /// Construct a <b>CompositeUpdater</b> based on the specified
 /// extractor and updater.
 /// </summary>
 /// <remarks>
 /// <b>Note:</b> the extractor and updater here are not symmetrical
 /// in nature: the extractor is used to "drill-down" to the target
 /// object, while the updater will operate on that extracted object.
 /// </remarks>
 /// <param name="extractor">
 /// The <see cref="IValueExtractor"/>.
 /// </param>
 /// <param name="updater">
 /// The <see cref="IValueUpdater"/>.
 /// </param>
 public CompositeUpdater(IValueExtractor extractor, IValueUpdater updater)
 {
     Debug.Assert(extractor != null && updater != null);
     m_extractor = extractor;
     m_updater   = updater;
 }
 public override void OnActive( string topicPath, ITopicUpdater updater )
 {
     valueUpdater = updater.ValueUpdater<IJSON>();
 }
 public MyTopicUpdateSource( IValueUpdater<IJSON> valueUpdater )
 {
     this.valueUpdater = valueUpdater;
 }