コード例 #1
0
ファイル: Node.cs プロジェクト: psryland/rylogic_code
        // Notes:
        //  - A node is a chart element set up for connecting to other node elements via connectors.
        //  - 'Node' has support for text and size, but does not imply a particular shape (2d or 3d).

        /// <summary>Base node constructor</summary>
        /// <param name="id">Globally unique id for the element</param>
        /// <param name="size">The initial dimensions of the node</param>
        /// <param name="text">The text of the node</param>
        /// <param name="position">The position of the node on the diagram</param>
        /// <param name="style">Style properties for the node</param>
        protected Node(v4 size, Guid id, string text, m4x4?position = null, NodeStyle?style = null)
            : base(id, text, position)
        {
            Text       = text;
            Style      = style ?? new NodeStyle();
            SizeMax    = v4.MaxValue;
            SizeMin    = v4.Zero;
            Size       = size;
            Connectors = new BindingListEx <Connector>();
            TextFormat = new StringFormat(0);
        }
コード例 #2
0
ファイル: Model.cs プロジェクト: psryland/rylogic_code
 public Model(Control parent)
 {
     m_parent   = parent;
     Dispatcher = Dispatcher.CurrentDispatcher;
     Settings   = new Settings(Settings.DefaultLocalFilepath)
     {
         AutoSaveOnChanges = true
     };
     FInfoMap   = new FileInfoMap();
     Duplicates = new BindingListEx <FileInfo>();
     Errors     = new List <string>();
 }
コード例 #3
0
ファイル: Node.cs プロジェクト: psryland/rylogic_code
        protected Node(XElement node)
            : base(node)
        {
            Text       = node.Element(XmlTag.Text).As(Text);
            Style      = new NodeStyle(node.Element(XmlTag.Style).As <Guid>());
            SizeMax    = node.Element(XmlTag.SizeMax).As(SizeMax);
            Size       = node.Element(XmlTag.Size).As(Size);
            Connectors = new BindingListEx <Connector>();
            TextFormat = new StringFormat(0);

            // Be careful using Style in here, it's only a place-holder
            // instance until the element has been added to a diagram.
        }
コード例 #4
0
        public LogGraphPane(LogGraphPage parent, IModuleManager manager)
        {
            m_Parent                  = parent;
            m_Manager                 = manager;
            CheckedItems              = new BindingListEx <string>();
            CheckedItems.ListChanged += new ListChangedEventHandler(OnCheckedItemsChanged);
            Title.IsVisible           = false;

            base.XAxis.Type                  = AxisType.Date;
            base.XAxis.Title.Text            = "Time";
            base.XAxis.Scale.FontSpec.Family = "Verdana";
            base.XAxis.Scale.FontSpec.Size   = 10;
            //            base.XAxis.Grid = true;

            base.XAxis.Title.FontSpec.Family = "Verdana";
            base.XAxis.Title.FontSpec.Size   = 12;
            base.XAxis.Title.FontSpec.IsBold = false;


            base.Legend.FontSpec.Family = "Verdana";
            base.Legend.FontSpec.Size   = 10;


            base.YAxis.Title.Text = "Value";

            base.YAxis.Scale.FontSpec.Family = "Verdana";
            base.YAxis.Scale.FontSpec.Size   = 10;

            base.YAxis.Title.FontSpec.Family = "Verdana";
            base.YAxis.Title.FontSpec.Size   = 12;
            base.YAxis.Title.FontSpec.IsBold = false;
            //base.YAxis.IsShowGrid = true;

            base.Y2Axis.Title.Text            = "Value";
            base.Y2Axis.IsVisible             = false;
            base.Y2Axis.Title.FontSpec.Family = "Verdana";
            base.Y2Axis.Title.FontSpec.Size   = 12;
            base.Y2Axis.Title.FontSpec.IsBold = false;
            base.Y2Axis.Scale.FontSpec.Family = "Verdana";
            base.Y2Axis.Scale.FontSpec.Size   = 10;
            //base.Y2Axis.StepAuto = true;
            //base.Y2Axis.ScaleFormatAuto = true;
            //base.Y2Axis.ScaleMagAuto = true;

            base.IsFontsScaled = false;
            AxisChange();
        }
コード例 #5
0
        /// <summary>Initialise the list of directories to search</summary>
        private void SetupPathsList()
        {
            Paths = new BindingListEx <Path>();

            // Whenever the collections of paths changes, update the check boxes
            Paths.ListChanging += (s, a) =>
            {
                switch (a.ChangeType)
                {
                case ListChg.ItemPreAdd:
                {
                    // Ensure items are added in order
                    var idx = Paths.BinarySearch(a.Item, Path.Compare);
                    if (idx != a.Index && ~idx != a.Index)
                    {
                        throw new Exception("Paths must be inserted in order. Use Paths.AddOrdered()");
                    }
                    break;
                }

                case ListChg.ItemAdded:
                {
                    HandlePathAdded(a.Item);
                    break;
                }

                case ListChg.ItemRemoved:
                {
                    HandlePathRemoved(a.Item);
                    break;
                }

                case ListChg.Reset:
                {
                    UpdateTree();
                    break;
                }
                }
            };
        }
コード例 #6
0
ファイル: WebBrowser.cs プロジェクト: psryland/rylogic_code
        public WebBrowser()
        {
            m_wb = new System.Windows.Forms.WebBrowser {
                Dock = DockStyle.Fill
            };
            Controls.Add(m_wb);

            // Set up the URL history
            m_url_history = new BindingListEx <Visit>();
            UrlHistory    = new BindingSource <Visit> {
                DataSource = m_url_history
            };
            UrlHistory.PositionChanged += (s, a) =>
            {
                OnCanGoBackChanged(EventArgs.Empty);
                OnCanGoForwardChanged(EventArgs.Empty);
            };

            // Set up handlers on the web browser
            m_wb.Navigating        += HandleNavigating;
            m_wb.StatusTextChanged += (s, a) => StatusTextChanged?.Invoke(this, a);
        }
コード例 #7
0
ファイル: LogUI.cs プロジェクト: psryland/rylogic_code
        public LogUI(string title, string persist_name)
        {
            InitializeComponent();
            m_watch = new FileWatch {
                PollPeriod = TimeSpan.FromMilliseconds(FilePollPeriodMS)
            };

            Title = title;

            // Support for dock container controls
            DockControl = new DockControl(this, persist_name)
            {
                TabText             = Title,
                DefaultDockLocation = new DockContainer.DockLocation(auto_hide: EDockSite.Right),
                TabColoursActive    = new DockContainer.OptionData().TabStrip.ActiveTab,
            };

            // When docked in an auto-hide panel, pop out on new messages
            PopOutOnNewMessages = true;

            // Line wrap default
            SetLineWrap(false);

            // A buffer of the log entries.
            // This is populated by calls to AddMessage or from the log file.
            LogEntries = new BindingListEx <LogEntry>();

            // Define a line in the log
            LogEntryPattern = null;
            //new Regex(@"^(?<File>.*?)\|(?<Level>.*?)\|(?<Timestamp>.*?)\|(?<Message>.*)\n"
            //	,RegexOptions.Singleline|RegexOptions.Multiline|RegexOptions.CultureInvariant|RegexOptions.Compiled);
            //new Regex(@"^\u001b(?<lvl>\d),(?<time>.*?),(?<name>.*?),""(?<msg>.*?)"",""(?<except>.*?)"",(?<count>\d+)\s*\n"
            //	,RegexOptions.Singleline|RegexOptions.Multiline|RegexOptions.CultureInvariant|RegexOptions.Compiled);

            // Highlighting patterns
            Highlighting = new BindingListEx <HLPattern>();

            // Column fill weights
            FillWeights = new Dictionary <string, float>
            {
                { ColumnNames.Tag, 0.3f },
                { ColumnNames.Level, 0.3f },
                { ColumnNames.Timestamp, 0.6f },
                { ColumnNames.Message, 5.0f },
                { ColumnNames.File, 2.0f },
                { ColumnNames.Line, 0.02f },
                { ColumnNames.Occurrences, 0.02f },
            };

            // The log entry delimiter
            LineDelimiter = Log_.EntryDelimiter;

            // Limit the number of log entries to display
            MaxLines     = 500;
            MaxFileBytes = 2 * 1024 * 1024;

            // Hook up UI
            SetupUI();

            // Create straight away
            CreateHandle();
        }
コード例 #8
0
        public SubclassedControlsUI()
        {
            InitializeComponent();

            m_bl0 = new BindingListEx <Thing>();
            m_bl1 = new BindingListEx <Thing>();
            m_bs  = new BindingSource <Thing> {
                DataSource = m_bl0
            };

            m_bl0.Add(new Thing {
                Name = "One"
            });
            m_bl0.Add(new Thing {
                Name = "Two"
            });
            m_bl0.Add(new Thing {
                Name = "Three"
            });
            m_bl0.Add(new Thing {
                Name = "Four"
            });

            m_bl1.Add(new Thing {
                Name = "Apple"
            });
            m_bl1.Add(new Thing {
                Name = "Banana"
            });
            m_bl1.Add(new Thing {
                Name = "Cucumber"
            });

            // Tool strip combo box
            var tscb = new Rylogic.Gui.WinForms.ToolStripComboBox();

            tscb.ComboBox.DisplayProperty = nameof(Thing.Name);
            m_ts.Items.Add(tscb);

            // Tool strip date time picker
            var tsdtp = new Rylogic.Gui.WinForms.ToolStripDateTimePicker();

            tsdtp.Format                       = DateTimePickerFormat.Custom;
            tsdtp.CustomFormat                 = "yyyy-MM-dd HH:mm:ss";
            tsdtp.DateTimePicker.Kind          = DateTimeKind.Utc;
            tsdtp.DateTimePicker.ValueChanged += DateTimeValueChanged;
            m_ts.Items.Add(tsdtp);

            // Combo box
            m_cb.DisplayProperty = nameof(Thing.Name);
            m_cb.TextChanged    += (s, a) =>
            {
                // The selected item becomes null when the text is changed by the user.
                // Without this test, changing the selection causes the previously selected
                // item to have it's text changed because TextChanged is raised before the
                // binding source position and 'SelectedIndex' are changed.
                if (m_cb.SelectedItem == null)
                {
                    m_bs.Current.Name = m_cb.Text;
                }
            };

            // List Box
            m_lb.DisplayProperty = nameof(Thing.Name);

            // Date time picker
            m_dtp.Kind          = DateTimeKind.Utc;
            m_dtp.MinDate       = Rylogic.Gui.WinForms.DateTimePicker.MinimumDateTime.As(DateTimeKind.Utc);
            m_dtp.MaxDate       = Rylogic.Gui.WinForms.DateTimePicker.MaximumDateTime.As(DateTimeKind.Utc);
            m_dtp.Value         = DateTime.UtcNow;
            m_dtp.ValueChanged += DateTimeValueChanged;

            // Progress bar timer
            m_timer.Interval = 20;
            m_timer.Tick    += (s, a) =>
            {
                if (m_pb.Value < m_pb.Maximum)
                {
                    ++m_pb.Value;
                    m_pb.Text = $"{m_pb.Value}";
                }
                else
                {
                    m_timer.Enabled = false;
                }
            };

            // Browse path
            m_browse_path.Path         = "Some File";
            m_browse_path.History      = new[] { "File1", "File2" };
            m_browse_path.PathChanged += (s, a) =>
            {
                m_browse_path.AddPathToHistory();
            };

            // Button to make stuff happen
            m_btn_test.Click += ChangeSource;
            m_btn_test.Click += (s, a) =>
            {
                m_pb.Value      = m_pb.Minimum;
                m_timer.Enabled = true;
            };

            // Value Box
            var vb_value_flag = true;

            m_vb_value.Value         = 6.28;
            m_vb_value.ValueChanged += (s, a) =>
            {
                m_lbl_vb_value.Text = m_vb_value.Value.ToString();
            };
            m_vb_value.ValueCommitted += (s, a) =>
            {
                vb_value_flag        = !vb_value_flag;
                m_vb_value.BackColor = vb_value_flag ? Color.Red : Color.Blue;
            };

            // Init binding source
            ChangeSource();
        }
コード例 #9
0
        public IBindingListEx InitializeBindingList(IList list)
        {
            BindingListEx <object> bindingList = new BindingListEx <object>(list.Cast <object>().ToList());

            return(bindingList);
        }
コード例 #10
0
        public IBindingListEx InitializeBindingList()
        {
            BindingListEx <object> bindingList = new BindingListEx <object>();

            return(bindingList);
        }
コード例 #11
0
ファイル: Model.cs プロジェクト: psryland/rylogic_code
 public FileInfo(System.IO.FileInfo fi)
 {
     m_finfo    = fi;
     Key        = MakeKey(this);
     Duplicates = new BindingListEx <FileInfo>();
 }
コード例 #12
0
 public void Add <T>(BindingListEx <T> list) where T : IActiveRecord
 {
     list.ToList().ForEach(x => Add(new MyClass(x)));
 }