示例#1
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;
        }
示例#2
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;
        }