Inheritance: Xwt.Widget
Ejemplo n.º 1
0
 Frame CreateFrame(string text, bool fixedp)
 {
     var f = new Frame (FrameType.Custom);
     f.BorderColor = fixedp ? new Color (1,0,0) : new Color (0,0,1);
     f.BorderWidth = 1;
     f.Margin = 10;
     f.Content = new Label (text);
     f.Content.Margin = 10;
     return f;
 }
Ejemplo n.º 2
0
		public Mnemonics ()
		{
			var windowsNoteLabel = new Label ()
			{
				Text = "Notes:\n" +
					"\t1) You must press the ALT key to make the mnemonics visible when using WPF backend.\n" +
					"\t2) Mnemonics are not supported on OS X.",
				Wrap = WrapMode.Word
			};
			PackStart (windowsNoteLabel);
			var withMnemonicsFrame = new Frame (GenerateFrameContents(true))
			{
				Label = "UseMnemonics == true"
			};
			PackStart (withMnemonicsFrame, true, true);
			var withoutMnemonicsFrame = new Frame (GenerateFrameContents(false))
			{
					Label = "UseMnemonics == false"
			};
			PackStart (withoutMnemonicsFrame, true, true);
		}
Ejemplo n.º 3
0
        public Frames()
        {
            Frame f = new Frame ();
            f.Label = "Simple widget box";
            f.Content = new SimpleBox (50);
            PackStart (f);

            f = new Frame ();
            f.Content = new Label ("No label");
            PackStart (f);

            f = new Frame ();
            f.Type = FrameType.Custom;
            f.BorderWidthLeft = 1;
            f.BorderWidthTop = 2;
            f.BorderWidthRight = 3;
            f.BorderWidthBottom = 4;
            f.BorderColor = new Color (0, 0, 1);
            f.Content = new Label ("Custom");
            PackStart (f);

            f = new Frame ();
            f.Type = FrameType.Custom;
            f.BorderWidth = 2;
            f.PaddingLeft = 10;
            f.PaddingTop = 20;
            f.PaddingRight = 30;
            f.PaddingBottom = 40;
            f.Content = new SimpleBox (50);
            PackStart (f);

            f = new Frame ();
            f.Type = FrameType.Custom;
            f.BorderWidth = 2;
            f.Padding = 10;
            f.Content = new Label ("With red background");
            f.BackgroundColor = new Color (1,0,0);
            PackStart (f);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initialize components.
        /// </summary>
        public override void _initializeComponents()
        {
            Frame f = new Frame()
            {
                Label = Director.Properties.Resources.ScenarioLabel,
                Padding = 10
            };
            VBox ScenarioSettings = new VBox();

            // Create scenario name
            ScenarioName = new TextEntry();
            ScenarioName.Changed += ScenarioName_Changed;
            ScenarioSettings.PackStart(new Label(Director.Properties.Resources.ScenarioName));
            ScenarioSettings.PackStart(ScenarioName);
            ScenarioSettings.PackStart(InvalidScenarioName);
            f.Content = ScenarioSettings;
            PackStart(f);

            Frame h = new Frame()
            {
                Label = Director.Properties.Resources.RunningOptionsLabel,
                Padding = 10
            };
            VBox RunningOptionsSettings = new VBox();

            // Select scenario run
            PeriodicityRunning = new RadioButton(Director.Properties.Resources.FrequencyLabel);
            TimeDelayRunning = new RadioButton(Director.Properties.Resources.TimeDelayLabel);
            PeriodicityRunning.Group = TimeDelayRunning.Group;
            RunningOptionsSettings.PackStart(PeriodicityRunning);
            RunningOptionsSettings.PackStart(TimeDelayRunning);
            PeriodicityRunning.Group.ActiveRadioButtonChanged += ChangeFrequencyOption;

            // Frequency settings
            RunningOptionsSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.RunningPeriodicity
            });
            FrequencyRunning = new ComboBox();
            FrequencyHelper.FillComboBox(FrequencyRunning);
            RunningOptionsSettings.PackStart(FrequencyRunning);
            FrequencyRunning.SelectedIndex = 0;
            FrequencyRunning.SelectionChanged += FrequencyRunning_SelectionChanged;

            // Time delay settings
            RunningOptionsSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.TimeDelayInSeconds
            });
            TimeDelay = new TextEntry()
            {
                Text = "0"
            };
            TimeDelay.Changed += delegate
            {
                try
                {
                    ActiveScenario.TimeAfterPrevious = int.Parse(TimeDelay.Text);

                    InvalidTimeDelay.Visible = false;
                }
                catch
                {
                    InvalidTimeDelay.Visible = true;
                }
            };
            RunningOptionsSettings.PackStart(TimeDelay);
            RunningOptionsSettings.PackStart(InvalidTimeDelay);

            // Add to form
            h.Content = RunningOptionsSettings;
            PackStart(h);

            // Scenario information
            ScenarioInformation = new VBox();
            ScrollView ScenarioInformationScrollView = new ScrollView()
            {
                VerticalScrollPolicy = ScrollPolicy.Automatic,
                Content = ScenarioInformation
            };

            Frame si = new Frame()
            {
                Label = Director.Properties.Resources.ScenarioOverview,
                Padding = 10,
                Content = ScenarioInformationScrollView
            };
            PackStart(si, true, true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initialize window.
        /// </summary>
        public override void _initializeComponents()
        {
            // Server Name + URL + Periodicity window
            Frame f = new Frame();
            f.Label = Director.Properties.Resources.ServerSettings;
            f.Padding = 10;

            // Create VBOX
            VBox ServerSettings = new VBox();

            // Prepare text box
            ServerSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.ServerName
            });
            ServerName = new TextEntry();
            ServerName.Changed += ServerName_Changed;
            ServerSettings.PackStart(ServerName);

            // Add invalid server name
            ServerSettings.PackStart(InvalidServerName);

            // Server URL
            ServerSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.ServerURL
            });
            ServerURL = new TextEntry();
            ServerURL.Changed += ServerURL_Changed;
            ServerSettings.PackStart(ServerURL);

            // Invalid URL
            ServerSettings.PackStart(InvalidServerURL);

            // Frequency settings
            ServerSettings.PackStart(new Label()
            {
                Text = Director.Properties.Resources.RunningPeriodicity
            });
            FrequencyRunning = new ComboBox();
            FrequencyHelper.FillComboBox(FrequencyRunning);
            ServerSettings.PackStart(FrequencyRunning);
            FrequencyRunning.SelectedIndex = 0;
            FrequencyRunning.SelectionChanged += FrequencyRunning_SelectionChanged;

            // Add Frame to server settings
            f.Content = ServerSettings;
            PackStart(f);

            // Authorization
            AuthRequired = new CheckBox(Director.Properties.Resources.Authorization);
            AuthRequired.MarginLeft = 10;
            PackStart(AuthRequired);

            // Create Authentication Frame
            Authentication = new Frame()
            {
                Label = Director.Properties.Resources.AuthorizationSettings,
                Padding = 10
            };

            // Login and Password fields
            VBox AuthBox = new VBox();

            AuthBox.PackStart(new Label()
            {
                Text = Director.Properties.Resources.Username
            });
            AuthUserName = new TextEntry();
            AuthUserName.Changed += AuthUserName_Changed;
            AuthBox.PackStart(AuthUserName);

            AuthBox.PackStart(new Label()
            {
                Text = Director.Properties.Resources.Password
            });
            AuthUserPassword = new PasswordEntry();
            AuthUserPassword.Changed += AuthUserPassword_Changed;
            AuthBox.PackStart(AuthUserPassword);

            // Authentication content
            Authentication.Content = AuthBox;
            PackStart(Authentication);

            // Change value
            AuthRequired.Toggled += AuthRequired_Toggled;

            // Email settings
            Frame EmailFrame = new Frame()
            {
                Label = Director.Properties.Resources.EmailNotifications,
                Padding = 10,
                MinHeight = 180
            };

            // Create EmailList widget
            EmailWidget = new EmailList();
            EmailFrame.Content = EmailWidget;
            PackStart(EmailFrame, expand: true, fill: true);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initialize components.
        /// </summary>
        private void _initializeComponents()
        {
            InfoBox _infoBox = new InfoBox(Director.Properties.Resources.ExportDialog, DirectorImages.SERVER_IMAGE);
            VBox _contentBox = new VBox();
            _contentBox.PackStart(_infoBox);

            // Create scenarios frame
            Frame f = new Frame()
            {
                Label = Director.Properties.Resources.SelectScenarios,
                Padding = 10
            };

            // Scenario view
            ScenarioListWidget = new ScenarioList(ActiveServer);
            f.Content = ScenarioListWidget;

            // Add to content box
            _contentBox.PackStart(f);

            // Add Export path
            ExportPath = new TextEntry()
            {
                Sensitive = false,
                HorizontalPlacement = WidgetPlacement.Fill
            };

            // Button for selecting path
            Button SelectPath = new Button("...")
            {
                WidthRequest = 35,
                MinWidth = 35,
                HorizontalPlacement = WidgetPlacement.End
            };
            SelectPath.Clicked += delegate
            {
                SaveFileDialog dlg = new SaveFileDialog(Director.Properties.Resources.DialogSaveScenario)
                {
                    Multiselect = false,
                    InitialFileName = ActiveServer.Name
                };
                dlg.Filters.Add(new FileDialogFilter("Director files", "*.adfe"));
                if (dlg.Run() && dlg.FileNames.Count() == 1) {
                    ExportPath.Text = dlg.FileName;
                    if (Path.GetExtension(dlg.FileName) != ".adfe") {
                        ExportPath.Text += ".adfe";
                    }
                }
            };
            Frame save = new Frame()
            {
                Label = Director.Properties.Resources.DialogSaveScenario,
                Padding = 10
            };
            HBox SaveBox = new HBox();
            SaveBox.PackStart(ExportPath, true, true);
            SaveBox.PackStart(SelectPath, false, false);
            save.Content = SaveBox;
            _contentBox.PackStart(save);

            // Save button
            Button SaveBtn = new Button(Director.Properties.Resources.SaveServer)
            {
                HorizontalPlacement = WidgetPlacement.End,
                ExpandHorizontal = false,
                ExpandVertical = false,
                WidthRequest = (Config.Cocoa) ? 95 : 80,
                MinWidth = (Config.Cocoa) ? 95 : 80,
                Image = Image.FromResource(DirectorImages.SAVE_SCENARIO_ICON)
            };
            SaveBtn.Clicked += SaveBtn_Clicked;

            // Add to form
            _contentBox.PackStart(SaveBtn, false, WidgetPlacement.End, WidgetPlacement.End);

            // Set content box as content
            Content = _contentBox;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initialize other components.
        /// </summary>
        public override void _initializeComponents()
        {
            ExpandVertical = false;
            ExpandHorizontal = false;

            // Frame Request Name
            Frame RequestNameFrame = new Frame()
            {
                Label = Director.Properties.Resources.RequestSettings,
                Padding = 10
            };
            VBox RequestNameBox = new VBox();
            RequestNameBox.PackStart(new Label(Director.Properties.Resources.RequestName));
            RequestName = new TextEntry()
            {
                ExpandHorizontal = true
            };
            RequestName.Changed += RequestName_Changed;
            RequestNameBox.PackStart(RequestName);
            RequestNameBox.PackStart(InvalidRequestName);
            RequestNameFrame.Content = RequestNameBox;
            PackStart(RequestNameFrame);

            // Init notebook
            RequestDetails = new Notebook()
            {
                ExpandHorizontal = true,
                ExpandVertical = true,
                TabOrientation = NotebookTabOrientation.Top
            };

            // Prepare tabs
            PackStart(RequestDetails, true, true);

            // Request overview
            RequestOverview = new VBox();
            ScrollView RequestOverviewSV = new ScrollView()
            {
                Content = RequestOverview, Margin = (Config.Windows()) ? 0 : 10
            };
            RequestDetails.Add(RequestOverviewSV, Director.Properties.Resources.RequestRequest);

            // Response overview
            RequestStatus = new VBox();
            ScrollView RequestStatusSV = new ScrollView()
            {
                Content = RequestStatus, Margin = (Config.Windows()) ? 0 : 10
            };
            RequestDetails.Add(RequestStatusSV, Director.Properties.Resources.RequestResponse);

            // Add edit button
            Button EditBtn = new Button(Image.FromResource(DirectorImages.EDIT_ICON),
                Director.Properties.Resources.MenuEditRequest)
            {
                WidthRequest = 150,
                ExpandHorizontal = false,
                ExpandVertical = false
            };
            EditBtn.Clicked += delegate { CurrentMainWindow.OpenEditRequest(ActiveRequest); };
            PackStart(EditBtn, expand: false, hpos: WidgetPlacement.End);
        }
Ejemplo n.º 8
0
        private void _initializeComponents()
        {
            // Parent Vbox
            VBox ParentContent = new VBox();

            // Request URL in frame
            Frame RequestUrl = new Frame()
            {
                Label = Director.Properties.Resources.RequestInfoBox,
                Padding = 10
            };
            VBox RequestUrlContent = new VBox();
            RequestUrlContent.PackStart(new Label(Director.Properties.Resources.RequestUrl));
            TextEntry RequestUrlField = new TextEntry()
            {
                Text = ActiveRequest.Url
            };
            RequestUrlContent.PackStart(RequestUrlField, expand: true, fill: true);
            RequestUrlContent.PackStart(InvalidRequestUrl, vpos: WidgetPlacement.End);

            // Method
            RequestUrlContent.PackStart(new Label(Director.Properties.Resources.RequestMethod));
            RequestHttpMethod = new ComboBox();
            RequestHttpMethod.Items.Add(1, "GET");
            RequestHttpMethod.Items.Add(2, "HEAD");
            RequestHttpMethod.Items.Add(3, "POST");
            RequestHttpMethod.Items.Add(4, "PUT");
            RequestHttpMethod.Items.Add(5, "PATCH");
            RequestHttpMethod.Items.Add(6, "DELETE");
            RequestHttpMethod.Items.Add(7, "OPTIONS");
            try
            {
                RequestHttpMethod.SelectedText = ActiveRequest.HTTP_METHOD;
            }
            catch
            {
                RequestHttpMethod.SelectedText = ActiveRequest.HTTP_METHOD = "GET";
            }
            RequestUrlContent.PackStart(RequestHttpMethod);
            RequestHttpMethod.SelectionChanged += delegate
            {
                ActiveRequest.HTTP_METHOD = RequestHttpMethod.SelectedText;
                if (RequestSettings.CurrentTab.Child is OverviewWidget)
                    ((OverviewWidget) RequestSettings.CurrentTab.Child).RefreshOverview();
            };

            // Wait in seconds
            RequestUrlContent.PackStart(new Label(Director.Properties.Resources.WaitPreviousRequest));
            TextEntry WaitTime = new TextEntry()
            {
                Text = ActiveRequest.WaitAfterPreviousRequest + ""
            };
            RequestUrlContent.PackStart(WaitTime, expand: true, fill: true);
            RequestUrlContent.PackStart(InvalidTime, vpos: WidgetPlacement.End);
            WaitTime.Changed += delegate
            {
                try
                {
                    ActiveRequest.WaitAfterPreviousRequest = int.Parse(WaitTime.Text);

                    if (ActiveRequest.WaitAfterPreviousRequest < 0)
                    {
                        ActiveRequest.WaitAfterPreviousRequest = 0;
                        WaitTime.Text = "0";
                        throw new InvalidCastException();
                    }

                    InvalidTime.Visible = false;
                }
                catch
                {
                    InvalidTime.Visible = true;
                }
            };

            // Repeat count
            RequestUrlContent.PackStart(new Label(Director.Properties.Resources.NumberOfCallRepeats));
            TextEntry RepeatCounter = new TextEntry()
            {
                Text = ActiveRequest.RepeatsCounter + ""
            };
            RequestUrlContent.PackStart(RepeatCounter, expand: true, fill: true);
            RequestUrlContent.PackStart(InvalidRepeatCount, vpos: WidgetPlacement.End);
            RepeatCounter.Changed += delegate
            {
                try
                {
                    ActiveRequest.RepeatsCounter = int.Parse(RepeatCounter.Text);

                    if (ActiveRequest.RepeatsCounter < 0)
                    {
                        ActiveRequest.RepeatsCounter = 0;
                        RepeatCounter.Text = "0";
                        throw new InvalidCastException();
                    }

                    InvalidRepeatCount.Visible = false;
                }
                catch
                {
                    InvalidRepeatCount.Visible = true;
                }
            };

            // Time between repeaters
            RequestUrlContent.PackStart(new Label(Director.Properties.Resources.TimeBetweenRequests));
            TextEntry RequestTimeouts = new TextEntry()
            {
                Text = ActiveRequest.RepeatsTimeout + ""
            };
            RequestUrlContent.PackStart(RequestTimeouts, expand: true, fill: true);
            RequestUrlContent.PackStart(InvalidBetweenRepeatTime, vpos: WidgetPlacement.End);
            RequestTimeouts.Changed += delegate
            {
                try
                {
                    ActiveRequest.RepeatsTimeout = int.Parse(RequestTimeouts.Text);

                    if (ActiveRequest.RepeatsTimeout < 0)
                    {
                        ActiveRequest.RepeatsTimeout = 0;
                        RequestTimeouts.Text = "0";
                        throw new InvalidCastException();
                    }

                    InvalidBetweenRepeatTime.Visible = false;
                }
                catch
                {
                    InvalidBetweenRepeatTime.Visible = true;
                }
            };

            // Set content
            RequestUrl.Content = RequestUrlContent;
            ParentContent.PackStart(RequestUrl, expand: false, fill: true);

            // Change request URL field
            RequestUrlField.Changed += delegate
            {
                try
                {
                    ActiveRequest.SetUrl(RequestUrlField.Text);
                    InvalidRequestUrl.Hide();
                }
                catch
                {
                    InvalidRequestUrl.Show();
                }
                if (RequestSettings.CurrentTab.Child is OverviewWidget)
                    ((OverviewWidget)RequestSettings.CurrentTab.Child).RefreshOverview();
            };

            // Create Notebook
            RequestSettings = new Notebook()
            {
                ExpandHorizontal = true,
                ExpandVertical = true,
                TabOrientation = NotebookTabOrientation.Top
            };
            _initializeTabs();
            RequestSettings.CurrentTabChanged += delegate
            {
                if (RequestSettings.CurrentTab.Child is OverviewWidget)
                    ((OverviewWidget) RequestSettings.CurrentTab.Child).RefreshOverview();
            };
            ParentContent.PackStart(RequestSettings, true, true);

            // Close btn
            Button ConfirmButton = new Button(Image.FromResource(DirectorImages.OK_ICON),
                Director.Properties.Resources.Confirm)
            {
                WidthRequest = 150,
                ExpandHorizontal = false,
                ExpandVertical = false
            };
            ConfirmButton.Clicked += delegate { Close(); };
            ParentContent.PackStart(ConfirmButton, expand: false, hpos: WidgetPlacement.End);

            // Set content
            Content = ParentContent;
        }