Ejemplo n.º 1
0
 protected void createChildDropDownsRec(Panel parent, DropDownNode ddn)
 {
     if (ddn.ddl.Items.Count > 0)
     {
         ddn.ddl.CssClass = "btn btn-default";
         DropDownButton ddb = new DropDownButton(ddn.ddl); //a drop-down button is just a button that knows a ddl.
         ddb.Text = "Select";
         ddb.CssClass = "btn btn-default";
         ddb.Click += new EventHandler(ddb_select_OnClick);
         parent.Controls.Add(ddn.ddl);
         parent.Controls.Add(ddb);
         parent.Controls.Add(new LiteralControl("<br />"));
         ddn.next = new DropDownNode(ddn.ddl.SelectedValue);
         ddn.next.ddl.DataBind();
         createChildDropDownsRec(parent, ddn.next);
     }
 }
Ejemplo n.º 2
0
 /// <summary>Khởi tạo các nút trên phiếu 
 /// </summary>
 public static void InitBtnPhieu(XtraForm frm, bool? IsAdd, DropDownButton NghiepVu, DropDownButton InPhieu, DropDownButton Chon,
     SimpleButton Save, SimpleButton Delete, SimpleButton Close)
 {
     if (Save != null) Save.Image = FWImageDic.SAVE_IMAGE16;
     if (Delete != null) Delete.Image = FWImageDic.DELETE_IMAGE16;
     if (Close != null) Close.Image = FWImageDic.CLOSE_IMAGE16;
     if (NghiepVu != null)
     {
         NghiepVu.Size = new System.Drawing.Size(101, 23);
         NghiepVu.Image = FWImageDic.BUSINESS_IMAGE16;
     }
     if (InPhieu != null)
     {
         InPhieu.Size = new System.Drawing.Size(84, 23);
         InPhieu.Image = FWImageDic.PRINT_IMAGE16;
     }
     if (Chon != null)
     {
         Chon.Size = new System.Drawing.Size(130, 23);
         Chon.Image = FWImageDic.CHOICE_POPUP_IMAGE16;
     }
     if (IsAdd == null)
     {
         if (Delete != null) Delete.Visible = false;
         if (Save != null) Save.Visible = false;
         if (NghiepVu != null) NghiepVu.Enabled = true;
         if (InPhieu != null) InPhieu.Enabled = true;
         if (Chon != null) Chon.Enabled = false;
     }
     else if (IsAdd == true)
     {
         if (Delete != null) Delete.Enabled = false;
         if (Save != null) Save.Enabled = true;
         if (NghiepVu != null) NghiepVu.Enabled = false;
         if (InPhieu != null) InPhieu.Enabled = false;
         if (Chon != null) Chon.Enabled = true;
     }
     else
     {
         if (Delete != null) Delete.Enabled = true;
         if (Save != null) Save.Enabled = true;
         if (NghiepVu != null) NghiepVu.Enabled = true;
         if (InPhieu != null) InPhieu.Enabled = true;
         if (Chon != null) Chon.Enabled = true;
     }
 }
 public BindingFormattingWindowsFormsEditorService()
 {
     this.BackColor = SystemColors.Window;
     this.Text = System.Design.SR.GetString("DataGridNoneString");
     base.SetStyle(ControlStyles.UserPaint, true);
     base.SetStyle(ControlStyles.Selectable, true);
     base.SetStyle(ControlStyles.UseTextForAccessibility, true);
     base.AccessibleRole = AccessibleRole.DropList;
     base.TabStop = true;
     this.button = new DropDownButton(this);
     this.button.FlatStyle = FlatStyle.Popup;
     this.button.Image = this.CreateDownArrow();
     this.button.Padding = new Padding(0);
     this.button.BackColor = SystemColors.Control;
     this.button.ForeColor = SystemColors.ControlText;
     this.button.Click += new EventHandler(this.button_Click);
     this.button.Size = new Size(SystemInformation.VerticalScrollBarArrowHeight, this.Font.Height + 2);
     this.button.AccessibleName = System.Design.SR.GetString("BindingFormattingDialogDataSourcePickerDropDownAccName");
     base.Controls.Add(this.button);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 设置子元素
        /// </summary>
        protected override void SetChildElements()
        {
            DropDownButton control = this.ControlHost.Content as DropDownButton;
            //设置文本值
            StringBuilder sbAttribute = new StringBuilder();

            if (!string.IsNullOrEmpty(this.ControlHost.Title))
            {
                this.HtmlWriter.RenderBeginTag("div");

                if (control.Width > 0)
                {
                    sbAttribute.AppendFormat("width:{0}px;", control.Width.ToString());
                }
                if (control.Height > 0)
                {
                    sbAttribute.AppendFormat("height:{0}px;", control.Height.ToString());
                }
                if (control.MinWidth > 0)
                {
                    if (control.Width == 0 || control.Width == null)
                    {
                        sbAttribute.AppendFormat("width:{0}px;", control.MinWidth.ToString());
                    }
                    sbAttribute.AppendFormat("min-width:{0}px;", control.MinWidth.ToString());
                }
                if (control.MinHeight > 0)
                {
                    if (control.Height == 0 || control.Height == null)
                    {
                        sbAttribute.AppendFormat("height:{0}px;", control.MinHeight.ToString());
                    }
                    sbAttribute.AppendFormat("min-height:{0}px;", control.MinHeight.ToString());
                }
                int pWidth   = 0,
                    width    = control.Width == null ? 0 : (int)control.Width,
                    minwidth = control.MinWidth,
                    maxwidth = control.MaxWidth == null ? 0 : (int)control.MaxWidth;
                if (width < minwidth)
                {
                    width = minwidth;
                }
                if (minwidth > maxwidth)
                {
                    maxwidth = minwidth;
                }
                if (width < maxwidth)
                {
                    width = maxwidth;
                }
                pWidth = width;
                int pHeight   = 0,
                    height    = control.Height == null ? 0 : (int)control.Height,
                    minheight = control.MinHeight,
                    maxheight = control.MaxHeight == null ? 0 : (int)control.MaxHeight;
                if (height < minheight)
                {
                    height = minheight;
                }
                if (minheight > maxheight)
                {
                    maxheight = minheight;
                }
                if (height < maxheight)
                {
                    height = maxheight;
                }
                pHeight = height;
                if (pHeight > 0)
                {
                    sbAttribute.AppendFormat("line-height:{0}px;", pHeight.ToString());
                }
                if (sbAttribute.ToString().Length > 0)
                {
                    this.HtmlWriter.AddAttribute("style", sbAttribute.ToString());
                }

                this.HtmlWriter.RenderBeginTag("div");
                this.HtmlWriter.WriteEncodedText(this.ControlHost.Title);

                this.HtmlWriter.RenderEndTag();
                this.HtmlWriter.RenderEndTag();
            }

            foreach (var child in this.ControlHost.Children)
            {
                var builder = child.GetBuilder(this.IsPreview, this.ScreenDefinition, this.Compile, this.ProjectDocument, this.PermissionData, this.HtmlWriter);
                builder.Parent = this;
                builder.Build();
            }
        }
Ejemplo n.º 5
0
        public SaveWindow(GameCanvas parent, Editor editor) : base(parent, editor)
        {
            Title = "Save Track As...";
            RichLabel l = new RichLabel(this);

            l.Dock = Dock.Top;
            l.AutoSizeToContents = true;
            l.AddText("Files are saved to Documents/LRA/Tracks", Skin.Colors.Text.Foreground);
            _errorbox = new Label(this)
            {
                Dock      = Dock.Top,
                TextColor = Color.Red,
                Text      = "",
                Margin    = new Margin(0, 0, 0, 5)
            };
            ControlBase bottomcontainer = new ControlBase(this)
            {
                Margin             = new Margin(0, 0, 0, 0),
                Dock               = Dock.Bottom,
                AutoSizeToContents = true
            };

            _savelist = new ComboBox(bottomcontainer)
            {
                Dock   = Dock.Top,
                Margin = new Margin(0, 0, 0, 5)
            };
            _namebox = new TextBox(bottomcontainer)
            {
                Dock = Dock.Fill,
            };
            _savebutton = new DropDownButton(bottomcontainer)
            {
                Dock     = Dock.Right,
                Text     = "Save (" + Settings.DefaultSaveFormat + ")",
                UserData = Settings.DefaultSaveFormat,
                Margin   = new Margin(2, 0, 0, 0),
            };
            _savebutton.DropDownClicked += (o, e) =>
            {
                Menu pop = new Menu(_canvas);
                pop.AddItem(".trk (recommended)").Clicked += (o2, e2) =>
                {
                    _savebutton.Text     = "Save (.trk)";
                    _savebutton.UserData = ".trk";
                };
                pop.AddItem(".track.json (for .com / regular LRA / other LRA mod support)").Clicked += (o2, e2) =>
                {
                    _savebutton.Text     = "Save (.json)";
                    _savebutton.UserData = ".json";
                };
                pop.AddItem(".sol (outdated)").Clicked += (o2, e2) =>
                {
                    _savebutton.Text     = "Save (.sol)";
                    _savebutton.UserData = ".sol";
                };
                pop.Open(Pos.Center);
            };
            _savebutton.Clicked += (o, e) =>
            {
                Save();
            };
            Padding            = new Padding(0, 0, 0, 0);
            AutoSizeToContents = true;
            MakeModal(true);
            Setup();
            MinimumSize = new Size(250, MinimumSize.Height);
        }
Ejemplo n.º 6
0
 public DropDownButtonAutomationPeer(DropDownButton owner) : base(owner)
 {
 }
Ejemplo n.º 7
0
        private void getRecentWorkspace()
        {
            IList<RecentFile> lRecentProjects = MainClass.Settings.RecentFiles.GetWorkspace();
            int no =0;
            foreach(RecentFile rf in lRecentProjects){

                WebButton lb = new WebButton();
                lb.Label = System.IO.Path.GetFileName(rf.DisplayName);
                lb.HoverMessage =rf.DisplayName;
                //lb.Description=" ";
                lb.WidthRequest = 150;
                string fileName = rf.FileName;
                lb.Clicked+= delegate(object sender, EventArgs e) {
                    Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(fileName);
                    if (workspace != null)
                        MainClass.MainWindow.ReloadWorkspace(workspace,false,true);
                };
                tblAction.Attach(lb,(uint)2,(uint)3,(uint)(no+2),(uint)(no+3),AttachOptions.Fill,AttachOptions.Shrink,0,0);
                no++;
                if (no>=2) break;
            }
            if(lRecentProjects.Count>2){
                DropDownButton.ComboItemSet otherSample = new DropDownButton.ComboItemSet ();

                DropDownButton ddbSample = new DropDownButton();
                ddbSample.Relief = ReliefStyle.None;
                ddbSample.HeightRequest = 25;
                ddbSample.MarkupFormat = "<span  foreground=\"#697077\"><b>{0}</b></span>";
                ddbSample.WidthRequest = 150;
                ddbSample.SetItemSet(otherSample);
                for (int i = 3;i<lRecentProjects.Count;i++){
                    DropDownButton.ComboItem addComboItem = new DropDownButton.ComboItem(System.IO.Path.GetFileName(lRecentProjects[i].DisplayName)
                                                                                       ,lRecentProjects[i].FileName);
                    otherSample.Add(addComboItem);
                }
                ddbSample.ActiveText="More...";
                ddbSample.Changed+= delegate(object sender, DropDownButton.ChangedEventArgs e) {
                    if(e.Item !=null){
                        string worksPath = (string)e.Item;
                        Workspace.Workspace workspace = Workspace.Workspace.OpenWorkspace(worksPath);
                        if (workspace != null)
                            MainClass.MainWindow.ReloadWorkspace(workspace,true,true);
                    }
                };
                tblAction.Attach(ddbSample,(uint)2,(uint)3,(uint)(no+2),(uint)(no+3),AttachOptions.Fill,AttachOptions.Fill,0,0);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        ///     Create the edit/drop-down controls when our handle is created.
        /// </summary>
        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);

            // create the edit box.  done before creating the button because
            // DockStyle.Right controls should be added first.
            switch (_editControlStyle)
            {
                case TypeEditorHostEditControlStyle.Editable:
                    InitializeEdit();
                    break;

                case TypeEditorHostEditControlStyle.ReadOnlyEdit:
                    InitializeEdit();
                    _edit.ReadOnly = true;
                    break;

                case TypeEditorHostEditControlStyle.InstructionLabel:
                    InitializeInstructionLabel();
                    UpdateInstructionLabelText();
                    break;
            }

            // create the drop-down button
            if (EditStyle != UITypeEditorEditStyle.None)
            {
                _button = new DropDownButton();
                _button.Dock = DockStyle.Right;
                _button.FlatStyle = FlatStyle.Flat;
                _button.FlatAppearance.BorderSize = 0;
                _button.FlatAppearance.MouseDownBackColor
                    = VSColorTheme.GetThemedColor(EnvironmentColors.ComboBoxButtonMouseDownBackgroundColorKey);
                _button.FlatAppearance.MouseOverBackColor
                    = VSColorTheme.GetThemedColor(EnvironmentColors.ComboBoxButtonMouseOverBackgroundColorKey);

                // only allow focus to go to the drop-down button if we don't have an edit control.
                // if we have an edit control, we want this to act like a combo box, where only the edit control
                // is focusable.  If there's no edit control, though, we need to make sure the button can be 
                // focused, to prevent WinForms from forwarding focus somewhere else.
                _button.TabStop = _edit == null;

                if (_editStyle == UITypeEditorEditStyle.DropDown)
                {
                    _button.Image = CreateArrowBitmap();
                    // set button name for accessibility purposes.
                    _button.AccessibleName = VirtualTreeStrings.GetString(VirtualTreeStrings.DropDownButtonAccessibleName);
                }
                else if (_editStyle == UITypeEditorEditStyle.Modal)
                {
                    _button.Image = CreateDotDotDotBitmap();

                    // set button name for accessibility purposes.
                    _button.AccessibleName = VirtualTreeStrings.GetString(VirtualTreeStrings.BrowseButtonAccessibleName);
                }
                // Bug 17449 (Currituck). Use the system prescribed one, property grid uses this approach in 
                // ndp\fx\src\winforms\managed\system\winforms\propertygridinternal\propertygridview.cs 
                _button.Size = new Size(SystemInformation.VerticalScrollBarArrowHeight, Font.Height);

                _button.BackColor = VSColorTheme.GetThemedColor(EnvironmentColors.ComboBoxBackgroundColorKey);

                Controls.Add(_button);
                _button.Click += OnDropDownButtonClick;
                _button.LostFocus += OnContainedControlLostFocus;
            }

            // Create the drop down control container.  Check for null here because this
            // may have already been created via a call to SetComponent.
            if (_dropDownHolder == null
                && EditStyle == UITypeEditorEditStyle.DropDown)
            {
                _dropDownHolder = new DropDownHolder(this);
                _dropDownHolder.Font = Font;
            }
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenDirectorySelector"/> class.
		/// </summary>
		/// <param name="serviceProvider"><para>Requires:</para>
		///		<para><see cref="INuGenButtonStateService"/></para>
		/// 	<para><see cref="INuGenControlStateService"/></para>
		///		<para><see cref="INuGenDirectorySelectorRenderer"/></para>
		///		<para><see cref="INuGenToolStripRenderer"/></para>
		///		<para><see cref="INuGenToolTipLayoutManager"/></para>
		///		<para><see cref="INuGenToolTipRenderer"/></para>
		/// </param>
		/// <exception cref="ArgumentNullException"><paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
		public NuGenDirectorySelector(INuGenServiceProvider serviceProvider)
			: base(serviceProvider)
		{
			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
			this.SetStyle(ControlStyles.ResizeRedraw, true);
			this.SetStyle(ControlStyles.Selectable, true);
			this.SetStyle(ControlStyles.UserPaint, true);

			this.BackColor = Color.Transparent;

			_toolTip = new NuGenToolTip(serviceProvider);

			_dropDownButton = new DropDownButton(serviceProvider);
			_dropDownButton.Bounds = this.GetDropDownButtonBounds();
			_dropDownButton.MouseDown += _dropDownButton_MouseDown;
			_dropDownButton.Parent = this;

			_contextMenu = new NuGenContextMenuStrip(serviceProvider);
		}
Ejemplo n.º 10
0
        private void ddbExport_Click(object sender, EventArgs e)
        {
            DropDownButton ddb2 = (DropDownButton)sender;

            ddb2.ShowDropDown();
        }
            /// <summary>
            /// Инициализация элементов управления объекта (создание, размещение)
            /// </summary>
            private void InitializeComponents()
            {
                Control ctrl   = null;
                int     posRow = -1  // позиция по оси "X" при позиционировании элемента управления
                , indx         = -1; // индекс п. меню лдя кнопки "Обновить-Загрузить"

                SuspendLayout();

                //Расчет - выполнить - макет
                //Расчет - выполнить - норматив
                addButtonRun(0);

                posRow = 5;
                //Признаки включения/исключения из расчета
                //Признаки включения/исключения из расчета - подпись
                ctrl      = new System.Windows.Forms.Label();
                ctrl.Dock = DockStyle.Bottom;
                (ctrl as System.Windows.Forms.Label).Text = @"Включить/исключить из расчета";
                this.Controls.Add(ctrl, 0, posRow         = posRow + 1);
                SetColumnSpan(ctrl, ColumnCount); //SetRowSpan(ctrl, 1);
                //Признак для включения/исключения из расчета компонента
                ctrl      = new CheckedListBoxTaskCalculate();
                ctrl.Name = INDEX_CONTROL.CLBX_COMP_CALCULATED.ToString();
                ctrl.Dock = DockStyle.Fill;
                this.Controls.Add(ctrl, 0, posRow = posRow + 1);
                SetColumnSpan(ctrl, ColumnCount); SetRowSpan(ctrl, 3);
                //Признак для включения/исключения из расчета параметра
                ctrl      = createControlNAlgParameterCalculated();
                ctrl.Name = INDEX_CONTROL.MIX_PARAMETER_CALCULATED.ToString();
                ctrl.Dock = DockStyle.Fill;
                this.Controls.Add(ctrl, 0, posRow = posRow + 3);
                SetColumnSpan(ctrl, ColumnCount); SetRowSpan(ctrl, 3);

                //Кнопки обновления/сохранения, импорта/экспорта
                //Кнопка - обновить
                ctrl                  = new DropDownButton();
                ctrl.Name             = INDEX_CONTROL.BUTTON_LOAD.ToString();
                ctrl.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
                indx                  = ctrl.ContextMenuStrip.Items.Add(new ToolStripMenuItem(@"Входные значения"));
                ctrl.ContextMenuStrip.Items[indx].Name = INDEX_CONTROL.MENUITEM_UPDATE.ToString();
                indx = ctrl.ContextMenuStrip.Items.Add(new ToolStripMenuItem(@"Архивные значения"));
                ctrl.ContextMenuStrip.Items[indx].Name = INDEX_CONTROL.MENUITEM_HISTORY.ToString();
                ctrl.Text = @"Загрузить";
                ctrl.Dock = DockStyle.Fill;
                this.Controls.Add(ctrl, 0, posRow = posRow + 3);
                SetColumnSpan(ctrl, 4); SetRowSpan(ctrl, 1);
                //Кнопка - импортировать
                ctrl      = new Button();
                ctrl.Name = INDEX_CONTROL.BUTTON_IMPORT.ToString();
                ctrl.Text = @"Импорт";
                ctrl.Dock = DockStyle.Fill;
                this.Controls.Add(ctrl, 4, posRow);
                SetColumnSpan(ctrl, 4); SetRowSpan(ctrl, 1);
                ctrl.Enabled = true;
                //Кнопка - сохранить
                ctrl      = new Button();
                ctrl.Name = INDEX_CONTROL.BUTTON_SAVE.ToString();
                ctrl.Text = @"Сохранить";
                ctrl.Dock = DockStyle.Fill;
                this.Controls.Add(ctrl, 0, posRow = posRow + 1);
                SetColumnSpan(ctrl, 4); SetRowSpan(ctrl, 1);
                //Кнопка - экспортировать
                ctrl      = new Button();
                ctrl.Name = INDEX_CONTROL.BUTTON_EXPORT.ToString();
                ctrl.Text = @"Экспорт";
                ctrl.Dock = DockStyle.Fill;
                this.Controls.Add(ctrl, 4, posRow);
                SetColumnSpan(ctrl, 4); SetRowSpan(ctrl, 1);
                ctrl.Enabled = false;

                //Признаки включения/исключения для отображения
                //Признак для включения/исключения для отображения компонента
                ctrl      = new System.Windows.Forms.Label();
                ctrl.Dock = DockStyle.Bottom;
                (ctrl as System.Windows.Forms.Label).Text = @"Включить/исключить для отображения";
                this.Controls.Add(ctrl, 0, posRow         = posRow + 1);
                SetColumnSpan(ctrl, 8); SetRowSpan(ctrl, 1);
                ctrl      = new CheckedListBoxTaskCalculate();
                ctrl.Name = INDEX_CONTROL.CLBX_COMP_VISIBLED.ToString();
                ctrl.Dock = DockStyle.Fill;
                this.Controls.Add(ctrl, 0, posRow = posRow + 1);
                SetColumnSpan(ctrl, 8); SetRowSpan(ctrl, 3);
                //Признак для включения/исключения для отображения параметра
                ctrl      = new CheckedListBoxTaskCalculate();
                ctrl.Name = INDEX_CONTROL.CLBX_PARAMETER_VISIBLED.ToString();
                ctrl.Dock = DockStyle.Fill;
                this.Controls.Add(ctrl, 0, posRow = posRow + 3);
                SetColumnSpan(ctrl, 8); SetRowSpan(ctrl, 3);

                ResumeLayout(false);
                PerformLayout();
            }
Ejemplo n.º 12
0
 /// <summary>
 /// 将用户输入的数据传递给业务模型层
 /// </summary>
 /// <param name="bucket"></param>
 /// <param name="operatoer"></param>
 /// <param name="pwd"></param>
 /// <param name="url"></param>
 /// <param name="ddbinternet"></param>
 /// <param name="ifremember"></param>
 /// <param name="ifauto"></param>
 /// <returns></returns>
 public UpYun_Model.UserInformation checkBeforeLogin(TextEdit bucket,TextEdit operatoer,TextEdit pwd,TextEdit url,DropDownButton ddbinternet,CheckEdit ifremember,CheckEdit ifauto)
 {
     UpYun_Model.UserInformation userinformaiton = new UpYun_Model.UserInformation(bucket.Text,operatoer.Text,pwd.Text,url.Text,ddbinternet.Text,ifremember.Checked,ifauto.Checked);
     return userinformaiton;
 }
Ejemplo n.º 13
0
        public EasingWindow(IServiceLocator services)
            : base(services)
        {
            _inputService     = services.GetInstance <IInputService>();
            _animationService = services.GetInstance <IAnimationService>();

            Title = "EasingWindow";

            StackPanel stackPanel = new StackPanel {
                Margin = new Vector4F(8)
            };

            Content = stackPanel;

            TextBlock textBlock = new TextBlock
            {
                Text   = "Test different Easing Functions in this window.",
                Margin = new Vector4F(0, 0, 0, 8),
            };

            stackPanel.Children.Add(textBlock);

            StackPanel horizontalPanel = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Vector4F(0, 0, 0, 8)
            };

            stackPanel.Children.Add(horizontalPanel);

            textBlock = new TextBlock
            {
                Text   = "Easing Function:",
                Width  = 80,
                Margin = new Vector4F(0, 0, 8, 0),
            };
            horizontalPanel.Children.Add(textBlock);

            _functionDropDown = new DropDownButton
            {
                Width = 100,

                // The DropDownButton automatically converts the items to string (using ToString) and
                // displays this string. This is not helpful for this sort of items. We want to display
                // the type name of the items instead. The following is a callback which creates a
                // TextBlock for each item. It is called when the drop-down list is opened.
                CreateControlForItem = item => new TextBlock {
                    Text = item.GetType().Name
                },
            };
            horizontalPanel.Children.Add(_functionDropDown);

            _functionDropDown.Items.Add(new BackEase());
            _functionDropDown.Items.Add(new BounceEase());
            _functionDropDown.Items.Add(new CircleEase());
            _functionDropDown.Items.Add(new CubicEase());
            _functionDropDown.Items.Add(new ElasticEase());
            _functionDropDown.Items.Add(new ExponentialEase());
            _functionDropDown.Items.Add(new LogarithmicEase());
            _functionDropDown.Items.Add(new HermiteEase());
            _functionDropDown.Items.Add(new PowerEase());
            _functionDropDown.Items.Add(new QuadraticEase());
            _functionDropDown.Items.Add(new QuinticEase());
            _functionDropDown.Items.Add(new SineEase());
            _functionDropDown.SelectedIndex = 0;

            horizontalPanel = new StackPanel
            {
                Orientation = Orientation.Horizontal,
                Margin      = new Vector4F(0, 0, 0, 8)
            };
            stackPanel.Children.Add(horizontalPanel);

            textBlock = new TextBlock
            {
                Text   = "Easing Mode:",
                Width  = 80,
                Margin = new Vector4F(0, 0, 8, 0),
            };
            horizontalPanel.Children.Add(textBlock);

            _modeDropDown = new DropDownButton
            {
                Width = 100,
            };
            horizontalPanel.Children.Add(_modeDropDown);

            _modeDropDown.Items.Add(EasingMode.EaseIn);
            _modeDropDown.Items.Add(EasingMode.EaseOut);
            _modeDropDown.Items.Add(EasingMode.EaseInOut);
            _modeDropDown.SelectedIndex = 0;

            _slider = new Slider
            {
                Margin              = new Vector4F(0, 16, 0, 0),
                SmallChange         = 0.01f,
                LargeChange         = 0.1f,
                Minimum             = -0.5f,
                Maximum             = 1.5f,
                Width               = 250,
                HorizontalAlignment = HorizontalAlignment.Center,
            };
            stackPanel.Children.Add(_slider);

            // Display the current value of the slider.
            var valueLabel = new TextBlock
            {
                Text = _slider.Value.ToString("F2"),
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin = new Vector4F(0, 0, 0, 8),
            };

            stackPanel.Children.Add(valueLabel);

            // Update the text every time the slider value changes.
            var valueProperty = _slider.Properties.Get <float>("Value");

            valueProperty.Changed += (s, e) => valueLabel.Text = e.NewValue.ToString("F2");

            Button button = new Button
            {
                Content = new TextBlock {
                    Text = "Animate"
                },
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin = new Vector4F(0, 0, 0, 8),
            };

            button.Click += OnButtonClicked;
            stackPanel.Children.Add(button);

            textBlock = new TextBlock
            {
                Text = "(Press the Animate button to animate the slider\n"
                       + "value using the selected EasingFunction.\n"
                       + "The slider goes from -0.5 to 1.5. The animation\n"
                       + "animates the value to 0 or to 1.)",
            };
            stackPanel.Children.Add(textBlock);

            // When the window is loaded, the window appears under the mouse cursor and flies to
            // its position.
            Vector2F mousePosition = _inputService.MousePosition;

            // The loading animation is a timeline group of three animations:
            // - One animations animates the RenderScale from (0, 0) to its current value.
            // - The other animations animate the X and Y positions from the mouse position
            //   to current values.
            // The base class AnimatedWindow will apply this timeline group on this window
            // when the window is loaded.
            TimelineGroup timelineGroup = new TimelineGroup
            {
                new Vector2FFromToByAnimation
                {
                    TargetProperty = "RenderScale",
                    From           = new Vector2F(0, 0),
                    Duration       = TimeSpan.FromSeconds(0.3),
                    EasingFunction = new HermiteEase {
                        Mode = EasingMode.EaseOut
                    },
                },
                new SingleFromToByAnimation
                {
                    TargetProperty = "X",
                    From           = mousePosition.X,
                    Duration       = TimeSpan.FromSeconds(0.3),
                },
                new SingleFromToByAnimation
                {
                    TargetProperty = "Y",
                    From           = mousePosition.Y,
                    Duration       = TimeSpan.FromSeconds(0.3),
                    EasingFunction = new QuadraticEase {
                        Mode = EasingMode.EaseIn
                    },
                },
            };

            // The default FillBehavior is "Hold". But this animation can be removed when it is finished.
            // It should not "Hold" the animation value. If FillBehavior is set to Hold, we cannot
            // drag the window with the mouse because the animation overrides the value.
            timelineGroup.FillBehavior = FillBehavior.Stop;
            LoadingAnimation           = timelineGroup;

            // The closing animation is a timeline group of three animations:
            // - One animations animates the RenderScale to (0, 0).
            // - The other animations animate the X and Y positions to the mouse position.
            // The base class AnimatedWindow will apply this timeline group on this window
            // when the window is loaded.
            ClosingAnimation = new TimelineGroup
            {
                new Vector2FFromToByAnimation
                {
                    TargetProperty = "RenderScale",
                    To             = new Vector2F(0, 0),
                    Duration       = TimeSpan.FromSeconds(0.3),
                    EasingFunction = new HermiteEase {
                        Mode = EasingMode.EaseIn
                    },
                },
                new SingleFromToByAnimation
                {
                    TargetProperty = "X",
                    To             = mousePosition.X,
                    Duration       = TimeSpan.FromSeconds(0.3),
                },
                new SingleFromToByAnimation
                {
                    TargetProperty = "Y",
                    To             = mousePosition.Y,
                    Duration       = TimeSpan.FromSeconds(0.3),
                    EasingFunction = new QuadraticEase {
                        Mode = EasingMode.EaseOut
                    },
                },
            };
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="button">DropDownButton to set</param>
 /// <param name="textEdit">TextEdit box to set</param>
 /// <param name="isCustom">Using a custom value or using an index</param>
 /// <param name="value">Custom value _settings.DocumentType or _settings.SecurityKey</param>
 private void SetDropDown(DropDownButton button, TextEdit textEdit, bool isCustom, string value)
 {
     if (isCustom)
     {
         button.Text = button.Equals(drbDocumentType) ? "Custom Document Type" : "Custom Security Key";
         textEdit.Text = value;
         textEdit.Enabled = true;
     }
     else
     {
         button.Text = value;
         textEdit.Enabled = false;
     }
 }
        private void PopulateDropDown(IIndexField[] indexFields, DropDownButton button, PopupMenu popupMenu, BarManager barManager, string text)
        {
            popupMenu.ClearLinks();

            popupMenu.AddItem(barManager.Items.CreateButton(text));

            foreach (IIndexField field in indexFields)
                popupMenu.AddItem(barManager.Items.CreateButton(field.Label));

            SetClickEvent(barManager);
            button.DropDownControl = popupMenu;
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Creates a new instance.
 /// </summary>
 public RibbonDropDownButtonAutomationPeer(DropDownButton owner)
     : base(owner)
 {
     this.OwnerDropDownButton = owner;
 }
Ejemplo n.º 17
0
        private static void CreateMoveDropDownContent(DropDownButton method)
        {
            StackPanel spParent = new StackPanel();

            spParent.Width         = 255;
            method.DropDownContent = spParent;

            // move from
            StackPanel spChild1 = new StackPanel();

            spChild1.Orientation = Orientation.Vertical;
            spParent.Children.Add(spChild1);

            Label lbMoveFrom = new Label();

            lbMoveFrom.Content = "Move from: ";

            TextBox tbMoveFrom = new TextBox();

            tbMoveFrom.Name              = "tbMoveFrom";
            tbMoveFrom.PreviewTextInput += TbMoveFrom_PreviewTextInput;

            spChild1.Children.Add(lbMoveFrom);
            spChild1.Children.Add(tbMoveFrom);

            // move count
            StackPanel spChild2 = new StackPanel();

            spChild2.Orientation = Orientation.Vertical;
            spParent.Children.Add(spChild2);

            Label lbMoveCount = new Label();

            lbMoveCount.Content = "Move count: ";

            TextBox tbMoveCount = new TextBox();

            tbMoveCount.Name              = "tbMoveCount";
            tbMoveCount.PreviewTextInput += TbMoveCount_PreviewTextInput;

            spChild2.Children.Add(lbMoveCount);
            spChild2.Children.Add(tbMoveCount);

            // move to
            StackPanel spChild3 = new StackPanel();

            spChild3.Orientation = Orientation.Vertical;
            spParent.Children.Add(spChild3);

            Label lbMoveTo = new Label();

            lbMoveTo.Content = "Move to: ";

            TextBox tbMoveTo = new TextBox();

            tbMoveTo.Name              = "tbMoveTo";
            tbMoveTo.PreviewTextInput += TbMoveTo_PreviewTextInput;

            spChild3.Children.Add(lbMoveTo);
            spChild3.Children.Add(tbMoveTo);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Инициализация компонентов
        /// </summary>
        private void InitializeComponent()
        {
            DataGridView dgv = null;
            // переменные для инициализации кнопок "Добавить", "Удалить"
            DropDownButton btnDropDown                        = null;
            int            iButtonDropDownMenuItem            = -1;
            string         strPartLabelButtonDropDownMenuItem = string.Empty;

            string[]      arLabelButtonDropDownMenuItem     = new string[] { @"точку", @"функцию" };
            INDEX_CONTROL indxControlButtonDropDownMenuItem = INDEX_CONTROL.UNKNOWN;
            ToolStripItem menuItem;

            this.SuspendLayout();

            //Добавить кнопки
            INDEX_CONTROL i = INDEX_CONTROL.BUTTON_SAVE;

            for (i = INDEX_CONTROL.BUTTON_ADD; i < (INDEX_CONTROL.BUTTON_UPDATE + 1); i++)
            {
                switch (i)
                {
                case INDEX_CONTROL.BUTTON_ADD:
                case INDEX_CONTROL.BUTTON_DELETE:
                    btnDropDown = new DropDownButton();
                    addButton(btnDropDown, i.ToString(), (int)i, m_arButtonText[(int)i]);

                    btnDropDown.ContextMenuStrip = new System.Windows.Forms.ContextMenuStrip();
                    if (i == INDEX_CONTROL.BUTTON_ADD)
                    {
                        strPartLabelButtonDropDownMenuItem = @"Добавить";
                    }
                    else
                    if (i == INDEX_CONTROL.BUTTON_DELETE)
                    {
                        strPartLabelButtonDropDownMenuItem = @"Удалить";
                    }
                    else
                    {
                        ;
                    }

                    // п.меню для операции с точкой
                    indxControlButtonDropDownMenuItem = i == INDEX_CONTROL.BUTTON_ADD ? INDEX_CONTROL.MENUITEM_ADD_POINT :
                                                        i == INDEX_CONTROL.BUTTON_DELETE ? INDEX_CONTROL.MENUITEM_DELETE_POINT : INDEX_CONTROL.UNKNOWN;
                    iButtonDropDownMenuItem = btnDropDown.ContextMenuStrip.Items.Add(new ToolStripMenuItem());
                    menuItem      = btnDropDown.ContextMenuStrip.Items[iButtonDropDownMenuItem];
                    menuItem.Text = strPartLabelButtonDropDownMenuItem + @" " + arLabelButtonDropDownMenuItem[iButtonDropDownMenuItem];
                    menuItem.Name = indxControlButtonDropDownMenuItem.ToString();

                    // п.меню для операции с функцией
                    indxControlButtonDropDownMenuItem = i == INDEX_CONTROL.BUTTON_ADD ? INDEX_CONTROL.MENUITEM_ADD_FUNCTION :
                                                        i == INDEX_CONTROL.BUTTON_DELETE ? INDEX_CONTROL.MENUITEM_DELETE_FUNCTION : INDEX_CONTROL.UNKNOWN;
                    iButtonDropDownMenuItem = btnDropDown.ContextMenuStrip.Items.Add(new ToolStripMenuItem());
                    menuItem      = btnDropDown.ContextMenuStrip.Items[iButtonDropDownMenuItem];
                    menuItem.Text = strPartLabelButtonDropDownMenuItem + @" " + arLabelButtonDropDownMenuItem[iButtonDropDownMenuItem];
                    menuItem.Name = indxControlButtonDropDownMenuItem.ToString();
                    break;

                default:
                    addButton(i.ToString(), (int)i, m_arButtonText[(int)i]);
                    break;
                }
            }

            //заблокировать кнопку добавить
            //Button btn = ((Button)Controls.Find(INDEX_CONTROL.BUTTON_ADD.ToString(), true)[0]);
            //btn.Enabled = false;

            //Поиск функции
            TextBox txtbx_find = new TextBox();

            txtbx_find.Name = INDEX_CONTROL.TEXTBOX_FIND.ToString();
            txtbx_find.Dock = DockStyle.Fill;

            //Подпись поиска
            System.Windows.Forms.Label lbl_find = new System.Windows.Forms.Label();
            lbl_find.Name = INDEX_CONTROL.LABEL_FIND.ToString();
            lbl_find.Dock = DockStyle.Bottom;
            (lbl_find as System.Windows.Forms.Label).Text = @"Поиск";

            //Группировка поиска
            //и его подписи
            TableLayoutPanel tlp = new TableLayoutPanel();

            tlp.Name         = INDEX_CONTROL.PANEL_FIND.ToString();
            tlp.Dock         = DockStyle.Fill;
            tlp.AutoSize     = true;
            tlp.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowOnly;
            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 15F));
            tlp.Controls.Add(lbl_find);
            tlp.Controls.Add(txtbx_find);
            this.Controls.Add(tlp, 1, 0);
            this.SetColumnSpan(tlp, 4);
            this.SetRowSpan(tlp, 1);

            //Таблица с функциями
            dgv      = new DataGridView();
            dgv.Name = INDEX_CONTROL.DGV_NALG.ToString();
            i        = INDEX_CONTROL.DGV_NALG;
            dgv.Dock = DockStyle.Fill;
            //Разместить эл-т упр-я
            this.Controls.Add(dgv, 1, 1);
            this.SetColumnSpan(dgv, 4);
            this.SetRowSpan(dgv, 5);

            dgv.ReadOnly = true;
            //Запретить выделение "много" строк
            dgv.MultiSelect = false;
            //Установить режим выделения - "полная" строка
            dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            //Установить режим "невидимые" заголовки столбцов
            dgv.ColumnHeadersVisible = true;
            //Отменить возможность добавления строк
            dgv.AllowUserToAddRows = false;
            //Отменить возможность удаления строк
            dgv.AllowUserToDeleteRows = false;
            //Отменить возможность изменения порядка следования столбцов строк
            dgv.AllowUserToOrderColumns = false;
            //Не отображать заголовки строк
            dgv.RowHeadersVisible = false;
            //Ширина столбцов под видимую область
            dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            //Отменить возможность изменения высоты строк
            dgv.AllowUserToResizeRows = false;
            dgv.ColumnCount           = 3;
            dgv.Columns[0].Name       = "Функция";
            dgv.Columns[1].Name       = "Описание";
            dgv.Columns[2].Name       = "ID_REC";
            dgv.Columns[2].Visible    = false;

            dgv.CellMouseDoubleClick += dgv_CellMouseDoubleClickNALG;
            dgv.CellEndEdit          += dgv_CellEndEditNALG;

            //Таблица с реперными точками
            dgv      = new DataGridView();
            dgv.Name = INDEX_CONTROL.DGV_VALUES.ToString();
            i        = INDEX_CONTROL.DGV_VALUES;
            dgv.Dock = DockStyle.Fill;
            //Разместить эл-т упр-я
            this.Controls.Add(dgv, 1, 6);
            this.SetColumnSpan(dgv, 4);
            this.SetRowSpan(dgv, 5);
            //Запретить редактирование
            dgv.ReadOnly = true;
            //Запретить выделение "много" строк
            dgv.MultiSelect = false;
            //Установить режим выделения - "полная" строка
            dgv.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            //Установить режим "невидимые" заголовки столбцов
            dgv.ColumnHeadersVisible = true;
            //Отменить возможность добавления строк
            dgv.AllowUserToAddRows = false;
            //Отменить возможность удаления строк
            dgv.AllowUserToDeleteRows = false;
            //Отменить возможность изменения порядка следования столбцов строк
            dgv.AllowUserToOrderColumns = false;
            //Не отображать заголовки строк
            dgv.RowHeadersVisible = false;
            //Ширина столбцов под видимую область
            dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            //Отменить возможность изменения высоты строк
            dgv.AllowUserToResizeRows = false;
            dgv.ColumnCount           = 5;
            dgv.Columns[0].Name       = "A1";
            dgv.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dgv.Columns[1].Name = "A2";
            dgv.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dgv.Columns[2].Name = "A3";
            dgv.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dgv.Columns[3].Name = "F";
            dgv.Columns[3].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
            dgv.Columns[4].Name    = "ID_REC";
            dgv.Columns[4].Visible = false;
            //обработчик нажатия мышки
            dgv.CellMouseDoubleClick += dgv_CellMouseDoubleClickValue;
            //обработчик редактирования ячейки
            dgv.CellEndEdit += dgv_CellEndEditValue;

            //Панель отображения графика
            this.m_zGraph_fTABLE             = new ZedGraphFTable();
            this.m_zGraph_fTABLE.m_This.Name = INDEX_CONTROL.ZGRAPH_fTABLE.ToString();
            this.m_zGraph_fTABLE.m_This.Dock = DockStyle.Fill;
            this.Controls.Add(this.m_zGraph_fTABLE.m_This, 2, 0);
            this.SetColumnSpan(this.m_zGraph_fTABLE.m_This, 8);
            this.SetRowSpan(this.m_zGraph_fTABLE.m_This, 10);
            this.m_zGraph_fTABLE.m_This.AutoScaleMode = AutoScaleMode.Font;

            //
            System.Windows.Forms.ComboBox cmb_bxParam = new ComboBox();
            cmb_bxParam.Name = INDEX_CONTROL.COMBOBOX_PARAM.ToString();
            cmb_bxParam.Dock = DockStyle.Fill;

            //Панель группировки калькулятора
            TableLayoutPanel tabl = new TableLayoutPanel();

            tabl.Name            = INDEX_CONTROL.TABLELAYOUTPANEL_CALC.ToString();
            tabl.Dock            = DockStyle.Fill;
            tabl.CellBorderStyle = System.Windows.Forms.TableLayoutPanelCellBorderStyle.None;
            tabl.AutoSizeMode    = System.Windows.Forms.AutoSizeMode.GrowAndShrink;

            //Подписи для калькулятора
            System.Windows.Forms.Label lblValue = new System.Windows.Forms.Label();
            lblValue.Dock = DockStyle.Bottom;
            lblValue.Text = @"Значение A1";
            tabl.Controls.Add(lblValue, 0, 0);
            //
            lblValue      = new System.Windows.Forms.Label();
            lblValue.Dock = DockStyle.Bottom;
            lblValue.Text = @"Значение A2";
            tabl.Controls.Add(lblValue, 1, 0);
            //
            lblValue      = new System.Windows.Forms.Label();
            lblValue.Dock = DockStyle.Bottom;
            lblValue.Text = @"Значение A3";
            tabl.Controls.Add(lblValue, 2, 0);
            ////
            //lblValue = new System.Windows.Forms.Label();
            //lblValue.Dock = DockStyle.Bottom;
            //lblValue.Text = @"Результат";
            //tabl.Controls.Add(lblValue, 0, 2);
            //
            lblValue      = new System.Windows.Forms.Label();
            lblValue.Dock = DockStyle.Bottom;
            (lblValue as System.Windows.Forms.Label).Text = @"Значение F";
            tabl.Controls.Add(lblValue, 3, 0);

            //Текстовые поля для данных калькулятора
            TextBox tbValue = new TextBox();

            tbValue.Name         = INDEX_CONTROL.TEXTBOX_A1.ToString();
            tbValue.TextChanged += tbCalcValue_onTextChanged;
            tbValue.TextAlign    = HorizontalAlignment.Right;
            tbValue.Dock         = DockStyle.Fill;
            tabl.Controls.Add(tbValue, 0, 1);

            tbValue              = new TextBox();
            tbValue.Name         = INDEX_CONTROL.TEXTBOX_A2.ToString();
            tbValue.TextChanged += tbCalcValue_onTextChanged;
            tbValue.TextAlign    = HorizontalAlignment.Right;
            tbValue.Dock         = DockStyle.Fill;
            tabl.Controls.Add(tbValue, 1, 1);

            tbValue              = new TextBox();
            tbValue.Name         = INDEX_CONTROL.TEXTBOX_A3.ToString();
            tbValue.TextChanged += tbCalcValue_onTextChanged;
            tbValue.TextAlign    = HorizontalAlignment.Right;
            tbValue.Dock         = DockStyle.Fill;
            tabl.Controls.Add(tbValue, 2, 1);

            tbValue      = new TextBox();
            tbValue.Name = INDEX_CONTROL.TEXTBOX_F.ToString();
            //tbValue.TextChanged += tbCalcValue_onTextChanged;
            tbValue.TextAlign = HorizontalAlignment.Right;
            tbValue.Dock      = DockStyle.Fill;
            tbValue.ReadOnly  = true;
            tabl.Controls.Add(tbValue, 3, 1);

            tabl.RowCount = 4;
            tabl.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            tabl.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            tabl.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.AutoSize));
            tabl.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
            tabl.ColumnCount = 4;
            tabl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tabl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tabl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            tabl.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
            //
            GroupBox gpBoxCalc = new GroupBox();

            gpBoxCalc.Name = INDEX_CONTROL.GRPBOX_CALC.ToString();
            gpBoxCalc.Text = @"Калькулятор значений";
            gpBoxCalc.Dock = DockStyle.Fill;
            gpBoxCalc.Controls.Add(tabl);
            this.Controls.Add(gpBoxCalc, 1, 11);
            this.SetColumnSpan(gpBoxCalc, 4);
            this.SetRowSpan(gpBoxCalc, 2);
            //
            addLabelDesc(INDEX_CONTROL.LABEL_DESC.ToString());

            ResumeLayout(false);
            PerformLayout();

            //Обработчика нажатия кнопок
            btnDropDown        = ((Button)Controls.Find(INDEX_CONTROL.BUTTON_ADD.ToString(), true)[0]) as DropDownButton;
            btnDropDown.Click += new System.EventHandler(btnAddToPoint_OnClick);
            menuItem           = (btnDropDown.ContextMenuStrip.Items.Find(INDEX_CONTROL.MENUITEM_ADD_POINT.ToString(), true)[0]);
            menuItem.Click    += new System.EventHandler(btnAddToPoint_OnClick);
            menuItem           = (btnDropDown.ContextMenuStrip.Items.Find(INDEX_CONTROL.MENUITEM_ADD_FUNCTION.ToString(), true)[0]);
            menuItem.Click    += new System.EventHandler(btnAddToFunction_OnClick);
            btnDropDown        = ((Button)Controls.Find(INDEX_CONTROL.BUTTON_DELETE.ToString(), true)[0]) as DropDownButton;
            btnDropDown.Click += new System.EventHandler(btnDeleteToPoint_OnClick);
            menuItem           = (btnDropDown.ContextMenuStrip.Items.Find(INDEX_CONTROL.MENUITEM_DELETE_POINT.ToString(), true)[0]);
            menuItem.Click    += new System.EventHandler(btnDeleteToPoint_OnClick);
            menuItem           = (btnDropDown.ContextMenuStrip.Items.Find(INDEX_CONTROL.MENUITEM_DELETE_FUNCTION.ToString(), true)[0]);
            menuItem.Click    += new System.EventHandler(btnDeleteToFunction_OnClick);
            ((Button)Controls.Find(INDEX_CONTROL.BUTTON_SAVE.ToString(), true)[0]).Click   += new System.EventHandler(HPanelTepCommon_btnSave_Click);
            ((Button)Controls.Find(INDEX_CONTROL.BUTTON_UPDATE.ToString(), true)[0]).Click += new System.EventHandler(HPanelTepCommon_btnUpdate_Click);
            //((Button)Controls.Find(INDEX_CONTROL.BUTTON_CALC.ToString(), true)[0]).Click += new EventHandler(PluginPrjTepFTable_ClickRez);

            //Обработчики событий
            // для отображения таблиц
            dgv = Controls.Find(INDEX_CONTROL.DGV_NALG.ToString(), true)[0] as DataGridView;
            dgv.SelectionChanged += new EventHandler(dgvnALG_onSelectionChanged);
            //// для определения признака удаления (ФУНКЦИЮ или точку)
            //dgv.RowEnter += new DataGridViewCellEventHandler(dgvnALG_OnRowEnter);
            //dgv.Leave += new EventHandler (dgvnALG_OnLeave);
            dgv = Controls.Find(INDEX_CONTROL.DGV_VALUES.ToString(), true)[0] as DataGridView;
            dgv.SelectionChanged += new EventHandler(dgvValues_onSelectionChanged);
            //// для определения признака удаления (функцию или ТОЧКУ)
            //dgv.RowEnter += new DataGridViewCellEventHandler(dgvValues_OnRowEnter);
            //dgv.Leave += new EventHandler(dgvValues_OnLeave);
            // для поля ввода при поиске функции
            ((TextBox)Controls.Find(INDEX_CONTROL.TEXTBOX_FIND.ToString(), true)[0]).TextChanged += new EventHandler(PluginPrjTepFTable_TextChanged);
        }
Ejemplo n.º 19
0
        private void ddbView_Click(object sender, EventArgs e)
        {
            DropDownButton ddbV = (DropDownButton)sender;

            ddbV.ShowDropDown();
        }
Ejemplo n.º 20
0
        // Create a window which shows all controls.
        public WpWindow()
        {
            CanDrag             = false;
            CanResize           = false;
            HorizontalAlignment = HorizontalAlignment.Stretch;
            VerticalAlignment   = VerticalAlignment.Stretch;

            Title = "DigitalRune Game UI Sample";

            // We handle the Closed event.
            Closed += OnClosed;

            var applicationTitle = new TextBlock
            {
                Text   = "DIGITALRUNE GUI SAMPLE",
                Margin = new Vector4F(12, 0, 0, 0),
            };

            var pageTitle = new TextBlock
            {
                Text   = "controls",
                Style  = "TextBlockTitle",
                Margin = new Vector4F(9, -7, 0, 0),
            };

            var titlePanel = new StackPanel
            {
                Margin = new Vector4F(12, 24, 8, 8),
            };

            titlePanel.Children.Add(applicationTitle);
            titlePanel.Children.Add(pageTitle);

            var textBlock = new TextBlock
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin   = new Vector4F(0, 10, 0, 10),
                WrapText = true,
                Text     = "This is a window with a lot of controls.\n" +
                           "All controls are within a scroll viewer.\n" +
                           "Tap-and-hold in window area to display the context menu of the window.",
                Style = "TextBlockSubtle"
            };

            var buttonEnabled = new Button
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "Button"
                },
            };

            var buttonDisabled = new Button
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "Button (Disabled)"
                },
                IsEnabled = false,
            };

            var checkBoxEnabled = new CheckBox
            {
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "CheckBox"
                },
            };

            var checkBoxEnabledChecked = new CheckBox
            {
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "CheckBox"
                },
                IsChecked = true,
            };

            var checkBoxDisabled = new CheckBox
            {
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "CheckBox (Disabled)"
                },
                IsEnabled = false,
            };

            var checkBoxDisabledChecked = new CheckBox
            {
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "CheckBox (Disabled)"
                },
                IsEnabled = false,
                IsChecked = true,
            };

            var checkBoxLotsOfText = new CheckBox
            {
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "CheckBox with a lot of text that does not fit into a single line."
                },
            };

            var radioButton0 = new RadioButton
            {
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "RadioButton"
                },
            };

            var radioButton1 = new RadioButton
            {
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "RadioButton with a lot of text that does not fit into a single line."
                },
                IsChecked = true
            };

            var radioButton2 = new RadioButton
            {
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "RadioButton"
                },
                IsEnabled = false,
            };

            var radioButton3 = new RadioButton
            {
                Margin  = new Vector4F(0, 10, 0, 10),
                Content = new TextBlock {
                    Text = "RadioButton (Disabled)"
                },
                IsEnabled = false,
                IsChecked = true,
                GroupName = "OtherGroup", // Put in another group, so that the IsChecked state is not removed when the user clicks another radio button.
            };

            var dropDownButton = new DropDownButton
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin        = new Vector4F(0, 10, 0, 10),
                Title         = "DROPDOWN ITEMS",
                SelectedIndex = 0,
            };

            // Add drop down items - each items is a string. Per default, the DropDownButton
            // calls ToString() for each item and displays it in a text block.
            for (int i = 0; i < 30; i++)
            {
                dropDownButton.Items.Add("DropDownItem " + i);
            }

            var dropDownButtonDisabled = new DropDownButton
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin        = new Vector4F(0, 10, 0, 10),
                Title         = "DROPDOWN ITEMS",
                IsEnabled     = false,
                SelectedIndex = 0,
            };

            // Add drop down items - each items is a string. Per default, the DropDownButton
            // calls ToString() for each item and displays it in a text block.
            for (int i = 0; i < 30; i++)
            {
                dropDownButtonDisabled.Items.Add("DropDownItem " + i + "(Disabled)");
            }

            var textBoxEnabled = new TextBox
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin           = new Vector4F(0, 10, 0, 10),
                GuideTitle       = "GUIDE TITLE",
                GuideDescription = "Guide description:",
                Text             = "TextBox (Enabled)"
            };

            var textBoxDisabled = new TextBox
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin    = new Vector4F(0, 10, 0, 10),
                Text      = "TextBox (Disabled)",
                IsEnabled = false,
            };

            var slider = new Slider
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin = new Vector4F(0, 24, 0, 24),
                Value  = 33
            };

            var progressBar = new ProgressBar
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin = new Vector4F(0, 10, 0, 10),
                Value  = 66,
            };

            var progressBarIndeterminate = new ProgressBar
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin          = new Vector4F(0, 10, 0, 10),
                IsIndeterminate = true,
            };

            var stackPanel = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Margin = new Vector4F(0, 0, 8, 0),
            };

            stackPanel.Children.Add(textBlock);
            stackPanel.Children.Add(buttonEnabled);
            stackPanel.Children.Add(buttonDisabled);
            stackPanel.Children.Add(checkBoxEnabled);
            stackPanel.Children.Add(checkBoxEnabledChecked);
            stackPanel.Children.Add(checkBoxDisabled);
            stackPanel.Children.Add(checkBoxDisabledChecked);
            stackPanel.Children.Add(checkBoxLotsOfText);
            stackPanel.Children.Add(radioButton0);
            stackPanel.Children.Add(radioButton1);
            stackPanel.Children.Add(radioButton2);
            stackPanel.Children.Add(radioButton3);
            stackPanel.Children.Add(dropDownButton);
            stackPanel.Children.Add(dropDownButtonDisabled);
            stackPanel.Children.Add(textBoxEnabled);
            stackPanel.Children.Add(textBoxDisabled);
            stackPanel.Children.Add(slider);
            stackPanel.Children.Add(progressBar);
            stackPanel.Children.Add(progressBarIndeterminate);

            var scrollViewer = new ScrollViewer
            {
                HorizontalAlignment           = HorizontalAlignment.Stretch,
                VerticalAlignment             = VerticalAlignment.Stretch,
                Content                       = stackPanel,
                HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled,
                Margin = new Vector4F(24, 0, 8, 0)
            };

            var layoutRoot = new StackPanel
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Margin = new Vector4F(0, 0, 0, 0),
            };

            layoutRoot.Children.Add(titlePanel);
            layoutRoot.Children.Add(scrollViewer);

            Content = layoutRoot;

            // Add a context menu
            MenuItem item0 = new MenuItem {
                Content = new TextBlock {
                    Text = "Item 0"
                },
            };
            MenuItem item1 = new MenuItem {
                Content = new TextBlock {
                    Text = "Item 1"
                },
            };
            MenuItem item2 = new MenuItem {
                Content = new TextBlock {
                    Text = "Item 2"
                },
            };
            MenuItem item3 = new MenuItem {
                Content = new TextBlock {
                    Text = "Item 3"
                },
            };
            MenuItem item4 = new MenuItem {
                Content = new TextBlock {
                    Text = "Item 4"
                },
            };

            ContextMenu = new ContextMenu();
            ContextMenu.Items.Add(item0);
            ContextMenu.Items.Add(item1);
            ContextMenu.Items.Add(item2);
            ContextMenu.Items.Add(item3);
            ContextMenu.Items.Add(item4);
        }
Ejemplo n.º 21
0
 void OnChangedDevice(object sender, DropDownButton.ChangedEventArgs args)
 {
     if(args.Item !=null){
         Rule actDevice = (Rule)args.Item;
         MainClass.Workspace.ActualDevice = actDevice.Id;
         FillResolution(actDevice.Id,false);
     }
 }
Ejemplo n.º 22
0
    void OnChangedProject(object sender, DropDownButton.ChangedEventArgs args)
    {
        if(args.Item !=null){
            Project actProject = (Project)args.Item;
            MainClass.Workspace.SetActualProject(actProject.FilePath);

            if(MainClass.Workspace.ActualProjectPath.Contains(" ")){

                string error =MainClass.Languages.Translate("error_whitespace");
                OutputConsole.WriteError( error );
                List<string> lst = new List<string>();
                lst.Add(error);
                LogOutput.WriteTask("","",lst);
                TaskNotebook.CurrentPage = 2;
            }
        }
    }
		/// <summary>
		/// </summary>
		/// <param name="disposing"><see langword="true"/> to release both managed and unmanaged resources; <see langword="false"/> to release only unmanaged resources.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (_dropDownButton != null)
				{
					_dropDownButton.MouseDown -= _dropDownButton_MouseDown;
					_dropDownButton.Dispose();
					_dropDownButton = null;
				}
			}

			base.Dispose(disposing);
		}
Ejemplo n.º 24
0
 /// <summary>Khởi tạo các nút drop down trên phiếu
 /// </summary>
 public static void InitDropDownButton(DropDownButton NghiepVu, DropDownButton InPhieu, DropDownButton Chon,
     ContextMenuStrip mnuNghiepVu, ContextMenuStrip mnuInPhieu, ContextMenuStrip mnuChon)
 {
     if (NghiepVu != null)
     {
         NghiepVu.ArrowButtonClick += delegate(object sender, EventArgs e)
         {
             mnuNghiepVu.Show(NghiepVu, new Point(0, 23));
         };
     }
     if (InPhieu != null)
     {
         InPhieu.ArrowButtonClick += delegate(object sender, EventArgs e)
         {
             mnuInPhieu.Show(InPhieu, new Point(0, 23));
         };
     }
     if (Chon != null)
     {
         Chon.ArrowButtonClick += delegate(object sender, EventArgs e)
         {
             mnuChon.Show(Chon, new Point(0, 23));
         };
     }
 }
Ejemplo n.º 25
0
 public static void InitBtnPhieu(XtraForm frm, bool? IsAdd, DropDownButton NghiepVu, DropDownButton InPhieu, DropDownButton Chon,
     SimpleButton Save, SimpleButton Delete, SimpleButton Close)
 {
     try { //Save.Image = FWImageDic.SAVE_IMAGE16;
     }
     catch { }
     try { //Delete.Image = FWImageDic.DELETE_IMAGE16;
     }
     catch { }
     try { //Close.Image = FWImageDic.CLOSE_IMAGE16;
     }
     catch { }
     if (IsAdd == null)
     {
         if (Delete != null) Delete.Visible = false;
         if (Save != null) Save.Visible = false;
         if (NghiepVu != null) NghiepVu.Enabled = true;
         if (InPhieu != null) InPhieu.Enabled = true;
         if (Chon != null) Chon.Enabled = false;
     }
     else if (IsAdd == true)
     {
         if (Delete != null) Delete.Enabled = false;
         if (Save != null) Save.Enabled = true;
         if (NghiepVu != null) NghiepVu.Enabled = false;
         if (InPhieu != null) InPhieu.Enabled = false;
         if (Chon != null) Chon.Enabled = true;
     }
     else
     {
         if (Delete != null) Delete.Enabled = true;
         if (Save != null) Save.Enabled = true;
         if (NghiepVu != null) NghiepVu.Enabled = false;
         if (InPhieu != null) InPhieu.Enabled = false;
         if (Chon != null) Chon.Enabled = true;
     }
 }
Ejemplo n.º 26
0
    //private bool statusSplash = false;
    /*bool update_status ()
     	{
         	statusSplash = splash.WaitingSplash;
         	return true;
     	}*/
    public MainWindow(string[] arguments)
        : base(Gtk.WindowType.Toplevel)
    {
        this.HeightRequest = this.Screen.Height;//-50;
        this.WidthRequest = this.Screen.Width;//-50;

        bool showSplash = true;
        bool openFileFromArg = false;
        string openFileAgument = "";
        for (int i = 0; i < arguments.Length; i++){
            Logger.LogDebugInfo("arg->{0}",arguments[i]);

            string arg = arguments[i];
            if (arg.StartsWith("-nosplash")){
                if (arg == "-nosplash")
                    showSplash = false;
            }
            if(!arg.EndsWith(".exe")){ // argument file msw
                if(File.Exists(arg)){
                    openFileAgument =arg;
                    if(arg.ToLower().EndsWith(".msw"))
                        openFileFromArg = true;
                }
            }
        }

        StringBuilder sbError = new StringBuilder();
        if(!File.Exists(MainClass.Settings.FilePath)){

            if(showSplash)
                splash = new SplashScreenForm(false);

            //statusSplash = true;
            Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("Setting inicialize -{0}",DateTime.Now));
            string file = System.IO.Path.Combine(MainClass.Paths.SettingDir, "keybinding");
            if(MainClass.Platform.IsMac){
                Moscrif.IDE.Iface.KeyBindings.CreateKeyBindingsMac(file);
            } else{
                Moscrif.IDE.Iface.KeyBindings.CreateKeyBindingsWin(file);
            }
            MainClass.Settings.SaveSettings();

        } else {
            if(showSplash)
                splash = new SplashScreenForm(false);
        }

        if(MainClass.Platform.IsMac){
                ApplicationEvents.Quit += delegate (object sender, ApplicationQuitEventArgs e) {
                    Application.Quit ();
                    e.Handled = true;
                };

                ApplicationEvents.Reopen += delegate (object sender, ApplicationEventArgs e) {
                    MainClass.MainWindow.Deiconify ();
                    MainClass.MainWindow.Visible = true;
                    e.Handled = true;
                };
        }

        Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("splash.show-{0}",DateTime.Now));
        Console.WriteLine(String.Format("splash.show-{0}",DateTime.Now));

        if(showSplash)
            splash.ShowAll();
        StockIconsManager.Initialize();
        Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("mainwindow.build.start-{0}",DateTime.Now));
        Build();
        this.Maximize();

        Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("mainwindow.build.end-{0}",DateTime.Now));

        this.llcLogin = new LoginLogoutControl();
        this.llcLogin.Events = ((Gdk.EventMask)(256));
        this.llcLogin.Name = "llcLogin";
        this.statusbar1.Add (this.llcLogin);
        Gtk.Box.BoxChild w14 = ((Gtk.Box.BoxChild)(this.statusbar1 [this.llcLogin]));
        w14.Position = 2;
        w14.Expand = false;
        w14.Fill = false;

        SetSettingColor();

        lblMessage1.Text="";
        lblMessage2.Text="";
        if (String.IsNullOrEmpty(MainClass.Paths.TempDir))
        {

            MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("cannot_create_temp"),MainClass.Paths.TempDir, Gtk.MessageType.Error,null);
            md.ShowDialog();
            return;
        }
        string fullpath = MainClass.Paths.StylesDir;

        bool success = true;

        if (!Directory.Exists(fullpath))
            try {
                Directory.CreateDirectory(fullpath);
            } catch {
                success = false;
            }
        if (success){
            try {
                Mono.TextEditor.Highlighting.SyntaxModeService.LoadStylesAndModes(fullpath);
            } catch(Exception ex) {
                sbError.AppendLine("ERROR: " + ex.Message);
                Logger.Log(ex.Message);
            }
        }

        ActionUiManager.UI.AddWidget += new AddWidgetHandler(OnWidgetAdd);
        ActionUiManager.UI.ConnectProxy += new ConnectProxyHandler(OnProxyConnect);
        ActionUiManager.LoadInterface();
        this.AddAccelGroup(ActionUiManager.UI.AccelGroup);

        WorkspaceTree = new WorkspaceTree();
        FrameworkTree = new FrameworkTree();

        FileExplorer = new FileExplorer();

        FileNotebook.AppendPage(WorkspaceTree, new NotebookLabel("workspace-tree.png",MainClass.Languages.Translate("projects")));
        FileNotebook.BorderWidth = 2;

        FileNotebook.AppendPage(FrameworkTree, new NotebookLabel("libs.png",MainClass.Languages.Translate("libs")));
        FileNotebook.BorderWidth = 2;

        FileNotebook.AppendPage(FileExplorer, new NotebookLabel("workspace-tree.png",MainClass.Languages.Translate("files")));
        FileNotebook.BorderWidth = 2;

        FileNotebook.CurrentPage = 1;

        hpBodyMidle.Pack1(FileNotebook, false, true);
        hpRight = new HPaned();
        //hpRight.Fi

        hpRight.Pack1(EditorNotebook, true, true);
        hpRight.Pack2(PropertisNotebook, false, true);
        hpBodyMidle.Pack2(hpRight, true, true);
        FileNotebook.WidthRequest = 500;
        hpBodyMidle.ResizeMode = ResizeMode.Queue;

        try {
            ActionUiManager.SocetServerMenu();
            ActionUiManager.RecentAll(MainClass.Settings.RecentFiles.GetFiles(),
                                      MainClass.Settings.RecentFiles.GetProjects(),
                                                      MainClass.Settings.RecentFiles.GetWorkspace());
        } catch {
        }

        ddbProject = new DropDownButton();
        ddbProject.Changed+= OnChangedProject;
        ddbProject.WidthRequest = 175;
        ddbProject.SetItemSet(projectItems);

        ddbDevice = new DropDownButton();
        ddbDevice.Changed+= OnChangedDevice;
        ddbDevice.WidthRequest = 175;
        ddbDevice.SetItemSet(deviceItems);

        ddbResolution = new DropDownButton();
        ddbResolution.Changed+= OnChangedResolution;
        ddbResolution.WidthRequest = 175;
        ddbResolution.SetItemSet(resolutionItems);

        ReloadSettings(false);
        OpenFile("StartPage",false);

        PageIsChanged("StartPage");

        if ((MainClass.Settings.Account != null) && (MainClass.Settings.Account.Remember)){
            MainClass.User = MainClass.Settings.Account;
        } else {
            MainClass.User = null;
        }

        SetLogin();

        OutputConsole = new OutputConsole();

        Gtk.Menu outputMenu = new Gtk.Menu();
        GetOutputMenu(ref outputMenu);

        BookmarkOutput = new BookmarkOutput();

        OutputNotebook.AppendPage(OutputConsole, new NotebookMenuLabel("console.png",MainClass.Languages.Translate("console"),outputMenu));
        OutputNotebook.AppendPage(FindReplaceControl, new NotebookLabel("find.png",MainClass.Languages.Translate("find")));
        OutputNotebook.AppendPage(BookmarkOutput, new NotebookLabel("bookmark.png",MainClass.Languages.Translate("bookmarks")));

        LogMonitor = new LogMonitor();
        Gtk.Menu monMenu = new Gtk.Menu();
        GetOutputMenu(ref monMenu, LogMonitor);

        OutputNotebook.AppendPage(LogMonitor, new NotebookMenuLabel("log.png",MainClass.Languages.Translate("Monitor"),monMenu));

        LogGarbageCollector = new LogGarbageCollector();
        Gtk.Menu gcMenu = new Gtk.Menu();
        GetOutputMenu(ref gcMenu, LogGarbageCollector);

        garbageColectorLabel =new NotebookMenuLabel("garbage-collector.png",MainClass.Languages.Translate("garbage_collector",0),gcMenu);

        OutputNotebook.AppendPage(LogGarbageCollector,garbageColectorLabel );

        hpOutput.Add1(OutputNotebook);

        ProcessOutput = new ProcessOutput();
        Gtk.Menu taskMenu = new Gtk.Menu();
        GetOutputMenu(ref taskMenu, ProcessOutput);
        TaskNotebook.AppendPage(ProcessOutput, new NotebookMenuLabel("task.png",MainClass.Languages.Translate("process"),taskMenu));

        ErrorOutput = new ErrorOutput();
        Gtk.Menu errorMenu = new Gtk.Menu();
        GetOutputMenu(ref errorMenu, ErrorOutput);
        TaskNotebook.AppendPage(ErrorOutput, new NotebookMenuLabel("error.png",MainClass.Languages.Translate("errors"),errorMenu));

        LogOutput = new LogOutput();
        Gtk.Menu logMenu = new Gtk.Menu();
        GetOutputMenu(ref logMenu, LogOutput);
        TaskNotebook.AppendPage(LogOutput, new NotebookMenuLabel("log.png",MainClass.Languages.Translate("logs"),logMenu));

        TodoOutput = new TodoOutput();
        TaskNotebook.AppendPage(TodoOutput, new NotebookLabel("task.png",MainClass.Languages.Translate("task")));

        FindOutput = new FindOutput();
        Gtk.Menu findMenu = new Gtk.Menu();
        GetOutputMenu(ref findMenu, FindOutput);
        TaskNotebook.AppendPage(FindOutput, new NotebookMenuLabel("find.png",MainClass.Languages.Translate("find_result"),findMenu));

        hpOutput.Add2(TaskNotebook);
        FirstShow();

        EditorNotebook.PageIsChanged +=PageIsChanged;

        if (openFileFromArg){ // open workspace from argument file
         	Workspace workspace = Workspace.OpenWorkspace(openFileAgument);
            Console.WriteLine("Open File From Arg");
            if (workspace != null){
                ReloadWorkspace(workspace, false,false);
                Console.WriteLine("RecentFiles");
                MainClass.Settings.RecentFiles.AddWorkspace(workspace.FilePath, workspace.FilePath);
                ActionUiManager.RefreshRecentAll(MainClass.Settings.RecentFiles.GetFiles(),
                                      MainClass.Settings.RecentFiles.GetProjects(),
                                         MainClass.Settings.RecentFiles.GetWorkspace());
            } else
                openFileFromArg = false;
        } else if((MainClass.Settings.OpenLastOpenedWorkspace) && !openFileFromArg ){
            if(String.IsNullOrEmpty(MainClass.Workspace.FilePath) && (String.IsNullOrEmpty(MainClass.Settings.CurrentWorkspace) ) ){
                /*MessageDialogs md =
                new MessageDialogs(MessageDialogs.DialogButtonType.Ok, MainClass.Languages.Translate("workspace_is_corrupted"), null, Gtk.MessageType.Error,null);
                    md.ShowDialog();*/
                MainClass.Settings.CurrentWorkspace = "";
            } else{
                ReloadWorkspace(MainClass.Workspace, false,false);
            }
        } else if(!MainClass.Settings.OpenLastOpenedWorkspace && (!openFileFromArg) ){
            MainClass.Workspace = new Workspace();
            MainClass.Settings.CurrentWorkspace = "";
        }

        if(!String.IsNullOrEmpty(openFileAgument)){
            if(!openFileAgument.ToLower().EndsWith(".msw"))
                OpenFile(openFileAgument,true);
        }

        EditorNotebook.Page=0;

        WorkspaceTree.FileIsSelected+= delegate(string fileName, int fileType,string appFileName) {

            if(String.IsNullOrEmpty(fileName)){
                SetSensitiveMenu(false);
                return;
            }
            ActionUiManager.SetSensitive("propertyall",true);

            SetSensitiveMenu(true);

            if(MainClass.Settings.AutoSelectProject){

                if((TypeFile)fileType == TypeFile.AppFile)
                    SetActualProject(fileName);
                else if (!String.IsNullOrEmpty(appFileName))
                    SetActualProject(appFileName);
            }//PropertisNotebook
            PropertisNotebook.RemovePage(0);
            if((TypeFile)fileType == TypeFile.SourceFile || ((TypeFile)fileType == TypeFile.StartFile )
               || ((TypeFile)fileType == TypeFile.ExcludetFile ) ){
                string file = "";
                string appfile = "";
                int typ = -1;
                Gtk.TreeIter ti = new Gtk.TreeIter();
                WorkspaceTree.GetSelectedFile(out file, out typ, out ti);

                if (String.IsNullOrEmpty(file))
                    return;

                appfile = WorkspaceTree.GetSelectedProjectApp();

                Project p = MainClass.Workspace.FindProject_byApp(appfile, true);
                if (p == null)
                    return;

                FilePropertisData fpd = new FilePropertisData();
                fpd.Filename = MainClass.Workspace.GetRelativePath(file);
                fpd.Project = p;

                FilePropertyWidget fpw = new FilePropertyWidget( fpd);
                PropertisNotebook.AppendPage(fpw,new Label("Properties"));

            }else  if ((TypeFile)fileType == TypeFile.Directory){

                string file = "";
                string appfile = "";
                int typ = -1;
                Gtk.TreeIter ti = new Gtk.TreeIter();
                WorkspaceTree.GetSelectedFile(out file, out typ, out ti);

                if (String.IsNullOrEmpty(file)) return;

                appfile = WorkspaceTree.GetSelectedProjectApp();

                Project p = MainClass.Workspace.FindProject_byApp(appfile, true);
                if (p == null)
                    return;

                FilePropertisData fpd = new FilePropertisData();
                fpd.Filename = MainClass.Workspace.GetRelativePath(file);
                fpd.Project = p;

                DirPropertyWidget fpw = new DirPropertyWidget( fpd);
                PropertisNotebook.AppendPage(fpw,new Label("Properties"));

            }else  if ((TypeFile)fileType == TypeFile.AppFile){

                string file = "";
                int typ = -1;
                Gtk.TreeIter ti = new Gtk.TreeIter();
                WorkspaceTree.GetSelectedFile(out file, out typ, out ti);

                if (String.IsNullOrEmpty(file)) return;

                Project p = MainClass.Workspace.FindProject_byApp(file, true);
                if (p == null)
                    return;

                ProjectPropertyWidget fpw = new ProjectPropertyWidget( p);
                PropertisNotebook.AppendPage(fpw,new Label("Properties"));

            } else{

            }
        };

        SetSensitiveMenu(false);

        string newUpdater = System.IO.Path.Combine(MainClass.Paths.AppPath,"moscrif-updater.exe.new");

        if(System.IO.File.Exists(newUpdater)){

            string oldUpdater = System.IO.Path.Combine(MainClass.Paths.AppPath,"moscrif-updater.exe");
            try{
                if(File.Exists(oldUpdater))
                    File.Delete(oldUpdater);

                  File.Copy(newUpdater,oldUpdater);

                  File.Delete(newUpdater);
            }catch(Exception ex){
                sbError.AppendLine("WARNING: " + ex.Message);
                Logger.Error(ex.Message);
            }
        }

        Gtk.Drag.DestSet (this, 0, null, 0);
        this.DragDrop += delegate(object o, DragDropArgs args) {

            Gdk.DragContext dc=args.Context;

            foreach (object k in dc.Data.Keys){
                Console.WriteLine(k);
            }
            foreach (object v in dc.Data.Values){
                Console.WriteLine(v);
            }

            Atom [] targets = args.Context.Targets;
            foreach (Atom a in targets){
                if(a.Name == "text/uri-list")
                    Gtk.Drag.GetData (o as Widget, dc, a, args.Time);
            }
        };

        this.DragDataReceived += delegate(object o, DragDataReceivedArgs args) {

            if(args.SelectionData != null){
                string fullData = System.Text.Encoding.UTF8.GetString (args.SelectionData.Data);

                foreach (string individualFile in fullData.Split ('\n')) {
                    string file = individualFile.Trim ();
                    if (file.StartsWith ("file://")) {
                        file = new Uri(file).LocalPath;

                        try {
                            OpenFile(file,true);
                        } catch (Exception e) {
                            sbError.AppendLine("ERROR: " + String.Format("unable to open file {0} exception was :\n{1}", file, e.ToString()));
                            Logger.Error(String.Format("unable to open file {0} exception was :\n{1}", file, e.ToString()));
                        }
                    }
                }
            }
        };
        //table1.Attach(ddbSocketIP,2,3,0,1,AttachOptions.Shrink,AttachOptions.Shrink,0,0);
        this.ShowAll();
        //this.Maximize();

        int x, y, w, h, d = 0;
        hpOutput.Parent.ParentWindow.GetGeometry(out x, out y, out w, out h, out d);
        hpOutput.Position = w / 2;

        //vpMenuRight.Parent.ParentWindow.GetGeometry(out x, out y, out w, out h, out d);
        tblMenuRight.Parent.ParentWindow.GetGeometry(out x, out y, out w, out h, out d);
        tblMenuRight.RowSpacing = 0;
        tblMenuRight.ColumnSpacing = 0;
        tblMenuRight.BorderWidth = 0;
        if(w<1200){
            //vpMenuRight.WidthRequest =125;
            tblMenuRight.WidthRequest =220;
        } else {
            if(MainClass.Platform.IsMac)
                tblMenuRight.WidthRequest =320;
            else
                tblMenuRight.WidthRequest =300;
        }

        if (MainClass.Platform.IsMac) {
            try{
                ActionUiManager.CreateMacMenu(mainMenu);

            } catch (Exception ex){
                sbError.AppendLine(String.Format("ERROR: Mac IGE Main Menu failed."+ex.Message));
                Logger.Error("Mac IGE Main Menu failed."+ex.Message,null);
            }
        }
        ReloadPanel();
        Moscrif.IDE.Tool.Logger.LogDebugInfo(String.Format("splash.hide-{0}",DateTime.Now));
        // Send message to close splash screen on win
        Console.WriteLine(String.Format("splash.hide-{0}",DateTime.Now));

        if(showSplash)
            splash.HideAll();

        EditorNotebook.OnLoadFinish = true;

        OutputConsole.WriteError(sbError.ToString());

        Moscrif.IDE.Iface.SocketServer.OutputClientChanged+= delegate(object sndr, string message) {
            Gtk.Application.Invoke(delegate{
                    this.OutputConsole.WriteText(message);
                    Console.WriteLine(message);
                });
        };

        Thread ExecEditorThreads = new Thread(new ThreadStart(ExecEditorThreadLoop));

        ExecEditorThreads.Name = "ExecEditorThread";
        ExecEditorThreads.IsBackground = true;
        ExecEditorThreads.Start();
        //LoadDefaultBanner();

        toolbarBanner = new Toolbar ();
        toolbarBanner.WidthRequest = 220;
        tblMenuRight.Attach(toolbarBanner,0,1,0,2,AttachOptions.Fill,AttachOptions.Expand|AttachOptions.Fill,0,0);

        bannerImage.WidthRequest = 200;
        bannerImage.HeightRequest = 40;

        toolbarBanner.Add(bannerImage);//(bannerButton);
        toolbarBanner.ShowAll();
        LoadDefaultBanner();

        //bannerImage.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Hand2);

        Thread BannerThread = new Thread(new ThreadStart(BannerThreadLoop));

        BannerThread.Name = "BannerThread";
        BannerThread.IsBackground = true;
        BannerThread.Start();
    }
Ejemplo n.º 27
0
    void OnChangedResolution(object sender, DropDownButton.ChangedEventArgs args)
    {
        if(args.Item !=null){
            string devPath = (string)args.Item;

            if(devPath == "-1"){
                FillResolution(MainClass.Workspace.ActualDevice, true);
            }else if (devPath == "-2"){
                FillResolution(MainClass.Workspace.ActualDevice, false);
            } else {
                MainClass.Workspace.ActualResolution = devPath;
            }
        }
    }
Ejemplo n.º 28
0
 private void TableNameDropDown_ArrowButtonClick(object sender, EventArgs e)
 {
     LastDropDownButtonClicked = sender as DropDownButton;
     DelayedCallback.Schedule(ShowSelectTableMenu);
     return;
 }