コード例 #1
0
ファイル: MainWindow.cs プロジェクト: Eun/AddAnyDock
    protected void OnButtonClicked(object sender, EventArgs e)
    {
        if (sender == button1)
        {

            Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog ("Choose item...", this, FileChooserAction.Open, "Cancel",  ResponseType.Cancel, "Insert Spacer",  ResponseType.None, "Add", ResponseType.Accept);

            Gtk.Alignment align = new Alignment (1, 0, 0, 1);
            Gtk.Frame frame = new Frame ("Position");
            Gtk.HBox hbox = new HBox (false, 4);

            RadioButton rbRight;
            rbRight = new RadioButton ("Right");
            hbox.PackEnd(rbRight, false, false, 1);
            hbox.PackEnd(new RadioButton (rbRight, "Left"), false, false, 1);

            frame.Add (hbox);
            align.Add (frame);
            align.ShowAll ();
            dialog.ExtraWidget = align;

            ResponseType response = (ResponseType)dialog.Run ();
            if (response == ResponseType.Accept) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>" + dialog.Filename + "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' && /bin/sleep 1 &&/usr/bin/killall Dock");
            } else if (response == ResponseType.None) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '{tile-data={}; tile-type=\"spacer-tile\";}' && /bin/sleep 1 &&/usr/bin/killall Dock");
            }
            dialog.Destroy ();

        }
    }
コード例 #2
0
    public CatalogPropertiesDialog(Catalog catalog)
    {
        this.catalog = catalog;
        this.Title = String.Format (Mono.Posix.Catalog.GetString ("{0} properties"), catalog.Name);
        this.HasSeparator = false;

        cancelButton = (Button)this.AddButton (Stock.Cancel, 0);
        okButton     = (Button)this.AddButton (Stock.Ok, 1);
        cancelButton.Clicked += OnCancelButtonClicked;
        okButton.Clicked     += OnOkButtonClicked;
        VBox vBox = this.VBox;

        HBox titleBox = new HBox ();
        Gtk.Frame frame = new Frame ("<b>"+Mono.Posix.Catalog.GetString ("Columns to show")+"</b>");
        ((Label)(frame.LabelWidget)).UseMarkup = true;
        titleBox.PackEnd (frame);
        vBox.PackStart (titleBox);

        VBox columnsBox = new VBox ();

        columns = catalog.Columns;
        Hashtable columnsToShow = catalog.ColumnsToShow;
        checks = new Hashtable ();
        foreach (string colName in columns.Keys) {
            if (colName.Equals ("id")) continue;
            CheckButton check = new CheckButton ((string)columns[colName]);
            check.Active = (bool)columnsToShow[colName];
            checks.Add (columns[colName], check);
            columnsBox.PackStart (check);
        }

        frame.Add (columnsBox);

        this.ShowAll();
    }
コード例 #3
0
ファイル: HelperFrame.cs プロジェクト: Karnlie/almazovdata
        public static Frame AddButton(Frame parent, SpriteFont font, int x, int y, int w, int h, string text, FrameAnchor anchor, Action action, Color bcol, bool visibility = true)
        {
            var button = new Frame(parent.Game, x, y, w, h, text, Color.White)
            {
                Anchor = anchor,
                TextAlignment = Alignment.MiddleCenter,
                PaddingLeft = 0,
                Font = font,
                Visible = visibility,
            };

            if (action != null)
            {
                button.Click += (s, e) =>
                {
                    action();
                };
            }
            button.StatusChanged += (s, e) =>
            {
                if (e.Status == FrameStatus.None) { button.BackColor = bcol; }
                if (e.Status == FrameStatus.Hovered) { button.BackColor = new Color(25, 71, 138, 255); }
                if (e.Status == FrameStatus.Pushed) { button.BackColor = new Color(99, 132, 181, 255); }
            };
            parent.Add(button);
            return button;
        }
コード例 #4
0
ファイル: frame_gtk.cs プロジェクト: emtees/old-code
	static void SetUpGui ()
	{
		Window w = new Window ("Sign Up");
		
		Button b = new Button ("Testing");
		
		Frame f = new Frame ("My Frame");
		
		f.Add (b);
		
		w.Add (f);
		//w.SetDefaultSize (120, 120);
		w.ShowAll ();
	}
コード例 #5
0
    public LendItemDialog(Item item, Database database)
    {
        this.database = database;
        this.item = item;
        this.Title = Mono.Posix.Catalog.GetString ("Lend");
        this.Modal = true;
        this.HasSeparator = false;

        VBox vBox = this.VBox;
        HBox hBox1 = new HBox ();

        string pixbuf = item.LargeCover;
        if (pixbuf != null) {
            image = new Gtk.Image (pixbuf);
        }

        label = new Label ();
        // Escape specials Markups characters
        string title;
        title = item.Title.Replace ("&", "&amp;");
        title = title.Replace ("<", "&lt;");
        title = title.Replace (">", "&gt;");
        label.Text = "<b>"+title+"</b>";
        label.UseMarkup = true;

        Label label1 = new Label (Mono.Posix.Catalog.GetString ("Borrower:"));
        borrowerComboBox = ComboBoxEntry.NewText ();
        PopulateEntryComboBox ();

        hBox1.PackStart (label1);
        hBox1.PackStart (borrowerComboBox);

        Gtk.Frame frame = new Frame ();
        frame.Shadow = ShadowType.Out;
        frame.Add (image);

        vBox.PackStart (frame);
        vBox.PackStart (label);
        vBox.PackStart (hBox1);
        vBox.Spacing = 5;

        Button cancelButton = (Button)this.AddButton (Gtk.Stock.Cancel, 0);
        Button okButton = (Button)this.AddButton (Gtk.Stock.Ok, 1);

        cancelButton.Clicked += OnCancelButtonClicked;
        okButton.Clicked     += OnOkButtonClicked;

        this.ShowAll();
    }
コード例 #6
0
ファイル: dialbotgui-6-1.cs プロジェクト: dialmaster/DIALBOT
    // This requires that the perl program autorestart wraps this....
    public DialBOT()
        : base("DialBOT")
    {
        SetDefaultSize(800, 600);
        SetPosition(WindowPosition.Center);
        DeleteEvent += delegate { Application.Quit(); };

        // Top level container. This vertically divides the window into 3 sections:
        // Top is the 2 windows (balls-deep items and console output
        VBox topvbox = new VBox(false, 5);

        // Lets build the top 1/3rd here.
        Frame ballsdeepframe = new Frame("Balls-Deep Items");
        Frame consoleframe = new Frame("Console Output");
        // HBox mainhbox = new HBox(true,2);

        ballsdeeptree = new TreeView();

        bdstore = new TreeStore (typeof(string), typeof (string), typeof (string), typeof (string));
        LoadBalls();
        fillStore();

        // Put the TreeStore into a TreeModelSort so we can sort columns...
        // Sort by score for now
        bdsorted = new TreeModelSort(bdstore);
        bdsorted.SetSortColumnId(1,SortType.Descending);

        // Put the TreeModelSort into a TreeModelFilter so we can implement the filtering
        filterEntry = new Entry();
        // filter = new TreeModelFilter(bdsorted,null);
        // filter.VisibleFunc = FilterTreeFunc;   // Use this as the filter function.

        // And then set the visible TreeView to use the filter as it's store.
        ballsdeeptree.Model = bdsorted;

        ballsdeeptree.HeadersVisible = true;
        ballsdeeptree.HeadersClickable=true;
        ballsdeeptree.AppendColumn ("Added By", new CellRendererText (), "text", 0);
        ballsdeeptree.AppendColumn ("Score", new CellRendererText (), "text", 1);
        CellRendererText ballRenderer = new CellRendererText();
        ballsdeeptree.AppendColumn ("Text", ballRenderer, "text", 2);
        CellRendererText voteRenderer = new CellRendererText();
        voteRenderer.Editable=true;
        voteRenderer.Edited+=editVotes;
        ballsdeeptree.AppendColumn ("Votes", voteRenderer, "text", 3);

        TreeViewColumn col = ballsdeeptree.GetColumn(0);
        col.Clickable=true;
        col.Resizable = true;
        col.Clicked += new EventHandler (col_clicked0);

        col = ballsdeeptree.GetColumn(1);
        col.Resizable = true;
        col.Clickable=true;
        col.Clicked += new EventHandler (col_clicked1);

        col = ballsdeeptree.GetColumn(2);
        col.Resizable = true;
        col.Clickable=true;
        col.Clicked += new EventHandler (col_clicked2);

        col = ballsdeeptree.GetColumn(3);
        col.Clickable=true;
        col.Resizable = true;
        col.Clicked += new EventHandler (col_clicked3);

        ScrolledWindow ballsdeepscroll = new ScrolledWindow();

        ballsdeepscroll.Add(ballsdeeptree);

        Button deleteentry = new Button("Remove Entry");
        deleteentry.SetSizeRequest(70, 30);
        deleteentry.Clicked += new EventHandler(deleteBallMsg);

        ballsdeepframe.Add(ballsdeepscroll);
        ballsdeepframe.Add(deleteentry);

        // Entry box and label to filter on message as well as an HBox to put them next to each other
        filterEntry.Changed += OnFilterEntryTextChanged;
        Label filterLabel = new Label("Ball Message Search: ");
        HBox filterBox = new HBox();
        filterBox.PackStart(filterLabel,false,false,5);
        filterBox.PackStart(filterEntry,true,true,5);

        VBox ballvbox = new VBox(false,5);
        ballvbox.Add(ballsdeepframe);
        //ballvbox.PackStart(filterBox,false,false,1);

        topvbox.Add(ballvbox);

        consoleview = new TextView();
        consolebuffer=consoleview.Buffer;
        consolebuffer.Text = consoletext;

        ScrolledWindow consolescroll = new ScrolledWindow();
        consolescroll.SetPolicy(PolicyType.Automatic,PolicyType.Always);
        consolescroll.Add(consoleview);

        consoleframe.Add(consolescroll);

        followConsole = new CheckButton("Tail Console");
        followConsole.SetSizeRequest(70,30);

        VBox consolevbox = new VBox(false,5);
        consolevbox.Add(consoleframe);
        consolevbox.PackStart(followConsole,false,false,1);

        topvbox.Add(consolevbox);

        //        topvbox.PackStart(mainhbox, true,true,4);

        // Now the 2nd 3rd. This contains 2 buttons. A start/stop, and a close.
        HBox buttonhbox = new HBox(true, 3);
        startstop = new Button("Stop");
        startstop.SetSizeRequest(70, 30);
        startstop.Clicked += new EventHandler(startstopEvent);
        Button close = new Button("Close");
        close.Clicked += new EventHandler(quitEvent);

        buttonhbox.Add(startstop);
        buttonhbox.Add(close);

        Alignment halign = new Alignment(1, 0, 0, 0);
        halign.Add(buttonhbox);

        topvbox.PackStart(halign, false, false, 3);

        // Now the bottom 3rd. A status bar
        statusbar = new Statusbar();
        statusbar.Push(1,"Hey, it's a status");
        topvbox.PackStart(statusbar,false,false,0);

        // Add our top level container to the window
        Add(topvbox);

        ShowAll();
    }
コード例 #7
0
ファイル: PropertyView.cs プロジェクト: shenyczz/ApsimX
        /// <summary>
        /// Generate and initialise input widget for the given property.
        /// This involves attaching the appropriate event handlers and
        /// populating it with an initial value.
        /// </summary>
        /// <param name="property">The property to be presented.</param>
        private Widget GenerateInputWidget(Property property)
        {
            Widget component;

            switch (property.DisplayMethod)
            {
            case PropertyType.MultiLineText:
                TextView editor = new TextView();
                editor.SizeAllocated += OnTextViewSizeAllocated;
                string text = ReflectionUtilities.ObjectToString(property.Value, CultureInfo.CurrentCulture);
                editor.Buffer.Text             = text ?? "";
                originalEntryText[property.ID] = text;
                editor.Name = property.ID.ToString();
                Frame outline = new Frame();
                outline.Add(editor);
                component             = outline;
                editor.FocusOutEvent += OnEntryFocusOut;
                break;

            case PropertyType.SingleLineText:
                string entryValue = ReflectionUtilities.ObjectToString(property.Value, CultureInfo.InvariantCulture);
                Entry  textInput  = new Entry(entryValue ?? "");
                textInput.FocusOutEvent += OnEntryFocusOut;
                component = textInput;
                originalEntryText[property.ID] = textInput.Text;
                break;

            case PropertyType.Checkbox:
                CheckButton toggleButton = new CheckButton();
                toggleButton.Active   = (bool)property.Value;
                toggleButton.Toggled += OnToggleCheckButton;
                component             = toggleButton;
                break;

            case PropertyType.DropDown:
                // Dropdown list - use a DropDownView (which wraps GtkComboBox).
                DropDownView dropDown = new DropDownView(this);
                dropDown.Values        = property.DropDownOptions;
                dropDown.SelectedValue = property.Value?.ToString();
                dropDown.Changed      += OnDropDownChanged;
                component = dropDown.MainWidget;
                break;

            case PropertyType.File:
            case PropertyType.Files:
            case PropertyType.Directory:
                //case PropertyType.Directories:
                // Add an Entry and a Button inside a VBox.
                Entry fileNameInput = new Entry(property.Value?.ToString() ?? "");
                fileNameInput.Name             = property.ID.ToString();
                fileNameInput.FocusOutEvent   += OnEntryFocusOut;
                originalEntryText[property.ID] = fileNameInput.Text;

                Button fileChooserButton = new Button("...");
                fileChooserButton.Name = property.ID.ToString();
                if (property.DisplayMethod == PropertyType.File)
                {
                    fileChooserButton.Clicked += (o, _) => ChooseFile(o as Widget, false, false);
                }
                else if (property.DisplayMethod == PropertyType.Files)
                {
                    fileChooserButton.Clicked += (o, _) => ChooseFile(o as Widget, true, false);
                }
                else if (property.DisplayMethod == PropertyType.Directory)
                {
                    fileChooserButton.Clicked += (o, _) => ChooseFile(o as Widget, false, true);
                }

                Box container = new HBox();
                container.PackStart(fileNameInput, true, true, 0);
                container.PackStart(fileChooserButton, false, false, 0);
                component = container;
                break;

            case PropertyType.Colour:
                ColourDropDownView colourChooser = new ColourDropDownView(this);
                List <object>      colours       = new List <object>();
                foreach (var colour in ColourUtilities.Colours)
                {
                    colours.Add(colour);
                }
                colourChooser.Values          = colours.ToArray();
                colourChooser.SelectedValue   = property.Value;
                colourChooser.Changed        += OnDropDownChanged;
                colourChooser.MainWidget.Name = property.ID.ToString();
                component = colourChooser.MainWidget;
                break;

            default:
                throw new Exception($"Unknown display type {property.DisplayMethod}");
            }

            // Set the widget's name to the property name.
            // This allows us to provide the property name when firing off
            // the property changed event, despite the event handlers being
            // shared by multiple components.
            return(component);
        }
コード例 #8
0
ファイル: MainWindow.cs プロジェクト: jahangmar/GardenPlanner
    public MainWindow() : base(WindowType.Toplevel)
    {
        GardenData.LoadedData = GardenData.LoadedData = new GardenData("new project");
        Title = "Garden project '" + GardenData.LoadedData.Name + "'";

        //GardenData.LoadedData = GardenPlanner.MainClass.TestData();


        PlantSideVPaned.Add1(FamilyPlantVarietySelector);


        PlantAreaInfoVPaned.Add1(PlantBox);
        PlantAreaInfoVPaned.Add2(AreaInfo);

        PlantSideVPaned.Add2(PlantAreaInfoVPaned);

        TopPanedToolboxVPaned.Add1(GraphicsSidebarHPaned);
        TopPanedToolboxVPaned.Add2(ToolBox);

        Frame frame;

        PlantBox.Add(PlantAddButton);
        PlantBox.Add(PlantInfoButton);
        PlantBox.Add(PlantEditButton);

        ToolBox.Add(AreaNewButton);
        ToolBox.Add(AreaCancelButton);
        ToolBox.Add(AreaTypeComboBox);
        ToolBox.Add(AreaEditButton);
        ToolBox.Add(AreaDeleteButton);

        frame = new Frame("Zoom");
        frame.Add(ZoomButton);
        ToolBox.Add(frame);

        frame = new Frame("Date");
        VButtonBox buttonBox = new VButtonBox();

        //yearButton = new SpinButton(GardenData.GetFirstYear(), GardenData.GetLastYear(), 1);
        yearButton = new SpinButton(settings.MinYear, settings.MaxYear, 1);
        buttonBox.Add(yearButton);
        buttonBox.Add(monthButton);

        frame.Add(buttonBox);
        ToolBox.Add(frame);

        foreach (Widget w in TopVBox.Children)
        {
            TopVBox.Remove(w);
        }
        TopVBox.Add(MenuBar);
        TopVBox.Add(TopPanedToolboxVPaned);

        if (this.Child == null)
        {
            this.Add(TopVBox);
        }


        ResetForNewData();

        FamilyPlantVarietySelector.SetSizeRequest(100, 400);

        AreaInfo.WrapMode = WrapMode.Word;
        AreaInfo.Editable = false;


        PlantAddButton.Sensitive = false;
        PlantAddButton.Clicked  += (sender, e) =>
        {
            GardenDrawingArea area = GardenDrawingArea.ActiveInstance;
            if (area.SelectedArea is Planting planting && SelectedEntry is PlantVariety variety)
            {
                EditPlantingInfoWindow.ShowPlantingInfoWindow((PlantingInfo plantingInfo) =>
                {
                    planting.AddVariety(variety, plantingInfo);
                    GardenDrawingArea.ActiveInstance.Draw();
                    ShowAreaSelectionInfo(area.SelectedArea);
                }, planting, variety.Name);
            }
            ;
        };

        PlantInfoButton.Clicked += (object sender, System.EventArgs e) =>
        {
            if (SelectedEntry is PlantFamily family)
            {
                InfoPlantFamilyWindow.ShowWindow(family, false);
            }
            else if (SelectedEntry is Plant plant)
            {
                InfoPlantWindow.ShowWindow(plant, false);
            }
            else if (SelectedEntry is PlantVariety variety)
            {
                InfoPlantVarietyWindow.ShowWindow(variety, false);
            }
        };


        PlantEditButton.Clicked += (object sender, System.EventArgs e) =>
        {
            if (SelectedEntry is PlantFamily family)
            {
                EditPlantFamilyWindow.ShowWindow(family);
            }
            else if (SelectedEntry is Plant plant)
            {
                EditPlantWindow.ShowWindow(plant);
            }
            else if (SelectedEntry is PlantVariety variety)
            {
                EditPlantVarietyWindow.ShowWindow(variety);
            }
        };


        ZoomButton.Value       = GardenDrawingArea.Zoom;
        ZoomButton.Events      = Gdk.EventMask.ButtonPressMask | Gdk.EventMask.ButtonReleaseMask | Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
        ZoomButton.TooltipText = "Zoom";



        AreaNewButton.Clicked += (object sender, System.EventArgs e) =>
        {
            if (AreaCancelButtonClicked)
            {
                AreaCancelButtonClicked    = false;
                AreaCancelButton.Sensitive = false;
                if (GardenDrawingArea.ActiveInstance != null)
                {
                    GardenDrawingArea.ActiveInstance.UndoSelection();
                    GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                    GardenDrawingArea.ActiveInstance.Draw();
                }
            }
            else if (!AreaNewButton.Active)//deactivated
            {
                AreaCancelButton.Sensitive = false;
                if (GardenDrawingArea.ActiveInstance != null)
                {
                    List <GardenPoint> points = GardenDrawingArea.ActiveInstance.NewPoints;
                    switch (AreaTypeComboBox.Active)
                    {
                    case 0:    //garden
                        if (GardenDrawingArea.ActiveInstance.Garden.Shape.GetPoints().Count == 0)
                        {
                            GardenDrawingArea.ActiveInstance.Garden.Shape.AddPoints(points);
                            GardenDrawingArea.ActiveInstance.Garden.Shape.FinishPoints();
                            GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                            GardenDrawingArea.ActiveInstance.Draw();
                        }
                        break;

                    case 1:    //planting
                        PlantingCreationDialog.ShowPlantingCreationDialog(new List <GardenPoint>(points), (Planting planting) =>
                        {
                            GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                            GardenDrawingArea.ActiveInstance.Draw();
                            GardenDrawingArea.ActiveInstance.Garden.AddPlanting(GardenData.GenID(planting.Name), planting);
                        });


                        break;

                    case 2:    //method area
                        GardenAreaCreationDialog.ShowGardenAreaCreationDialog(new List <GardenPoint>(points), (GardenArea area) => {
                            GardenDrawingArea.ActiveInstance.NewPoints.Clear();
                            GardenDrawingArea.ActiveInstance.Draw();
                            GardenDrawingArea.ActiveInstance.Garden.AddMethodArea(GardenData.GenID(area.Name), area);
                        });

                        break;
                    }
                }
            }
            else //activated
            {
                if (AreaTypeComboBox.Active == 0) //garden
                {
                    if (GardenDrawingArea.ActiveInstance == null || GardenDrawingArea.ActiveInstance.Garden.Shape.GetPoints().Count > 0)
                    {
                        AreaNewButton.Active = false;
                        GardenCreationDialog.ShowGardenCreationDialog(new List <GardenPoint>(), ((Garden garden) =>
                        {
                            GardenData.LoadedData.AddGarden(GardenData.GenID(garden.Name), garden);
                            this.ResetForNewData();
                            GardenBedBook.Page = GardenBedBook.NPages - 1;
                            AreaNewButton.Active = true;
                        }));
                    }
                }

                AreaCancelButton.Sensitive = true;
            }
        };


        AreaCancelButton.Sensitive = false;
        AreaCancelButton.Clicked  += (object sender, System.EventArgs e) =>
        {
            AreaCancelButtonClicked    = true;
            AreaCancelButton.Sensitive = false;
            AreaNewButton.Active       = false;
        };


        AreaTypeComboBox.Active   = 0;
        AreaTypeComboBox.Changed += (object sender, System.EventArgs e) =>
        {
            switch (AreaTypeComboBox.Active)
            {
            case 0:
                AreaNewButton.Label = "New Garden";
                break;

            case 1:
                AreaNewButton.Label = "New Planting";
                break;

            case 2:
                AreaNewButton.Label = "New Method Area";
                break;
            }
        };

        AreaEditButton.Clicked += (object sender, System.EventArgs e) =>
        {
            GardenDrawingArea gardenDrawingArea = GardenDrawingArea.ActiveInstance;

            if (gardenDrawingArea == null || gardenDrawingArea.Garden == null || gardenDrawingArea.SelectedArea == null)
            {
                return;
            }

            if (gardenDrawingArea.SelectedArea is Planting planting)
            {
                PlantingCreationDialog.ShowPlantingEditDialog(planting);
            }
            else if (gardenDrawingArea.SelectedArea is Garden)
            {
                GardenAreaCreationDialog.ShowGardenAreaEditDialog(gardenDrawingArea.SelectedArea);
            }
            else
            {
                GardenAreaCreationDialog.ShowGardenAreaEditDialog(gardenDrawingArea.SelectedArea);
            }
        };

        AreaDeleteButton.Clicked += (object sender, System.EventArgs e) =>
        {
            GardenDrawingArea gardenDrawingArea = GardenDrawingArea.ActiveInstance;

            if (gardenDrawingArea == null || gardenDrawingArea.Garden == null)
            {
                return;
            }

            string name = gardenDrawingArea.SelectedArea != null ? gardenDrawingArea.SelectedArea.Name : gardenDrawingArea.Garden.Name;

            Dialog dialog = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.OkCancel, "Do you want to delete '" + name + "'?", new { });

            int response = dialog.Run();
            //System.Console.WriteLine("response " + result);
            if (response == (int)ResponseType.Cancel)
            {
            }
            else if (response == (int)ResponseType.Ok)
            {
                if (gardenDrawingArea.Garden != null && (gardenDrawingArea.SelectedArea == null || gardenDrawingArea.SelectedArea is Garden))
                {
                    var garden = gardenDrawingArea.Garden;

                    GardenData.LoadedData.Gardens.Remove(garden.ID);
                    GardenBedBook.Remove(GardenBedBook.GetNthPage(GardenBedBook.CurrentPage));
                    //System.Console.WriteLine("delete garden");
                    GardenDrawingArea.ActiveInstance = null;
                    gardenDrawingArea.UndoSelection();
                    SelectGardenEntry(null);
                    if (GardenBedBook.Page >= 0 && GardenBedBook.GetNthPage(GardenBedBook.Page) is GardenDrawingArea drawingArea)
                    {
                        GardenDrawingArea.ActiveInstance = drawingArea;
                        drawingArea.Draw();
                    }
                    GardenData.unsaved = true;
                }
                else if (gardenDrawingArea.SelectedArea is Planting planting)
                {
                    gardenDrawingArea.Garden.RemovePlanting(planting);
                    gardenDrawingArea.UndoSelection();
                    SelectGardenEntry(null);
                    gardenDrawingArea.Draw();
                    GardenData.unsaved = true;
                }
                else if (gardenDrawingArea.SelectedArea is GardenArea area)
                {
                    gardenDrawingArea.Garden.RemoveMethodArea(area);
                    gardenDrawingArea.UndoSelection();
                    SelectGardenEntry(null);
                    gardenDrawingArea.Draw();
                    GardenData.unsaved = true;
                }
            }
            dialog.Destroy();
        };



        int yearValue = yearButton.ValueAsInt;

        yearButton.ValueChanged += (sender, e) =>
        {
            if (yearButton.ValueAsInt > yearValue)
            {
                monthButton.Value = 1;
            }
            else
            {
                monthButton.Value = 12;
            }
            yearValue = yearButton.ValueAsInt;
            DateChanged();
        };
        monthButton.Changed += (sender, e) =>
        {
            DateChanged();
        };

        void DateChanged()
        {
            GardenDrawingArea gardenDrawingArea = GardenDrawingArea.ActiveInstance;

            if (gardenDrawingArea == null)
            {
                return;
            }

            if (gardenDrawingArea.SelectedArea != null && (!gardenDrawingArea.SelectedArea.CheckDate(GetYear(), GetMonth()) || !gardenDrawingArea.Garden.CheckDate(GetYear(), GetMonth())))
            {
                gardenDrawingArea.UndoSelection();
            }
            gardenDrawingArea.Draw();
            ShowAreaSelectionInfo(gardenDrawingArea.SelectedArea);
        }

        //FamilyPlantVarietySelector.Add1(PopulateFamilies(GardenData.LoadedData));
        //RepopulateGrowables();



        //Build();
        this.DeleteEvent += (object o, DeleteEventArgs args) =>
        {
            TryToClose();
            args.RetVal = true;
        };

        this.Destroyed += (sender, e) =>
        {
            GardenPlannerSettings.Save();
            Application.Quit();
        };
    }
コード例 #9
0
 protected void AddElement(UI.Element element)
 {
     Frame.Add(element);
 }
コード例 #10
0
ファイル: NaryType.cs プロジェクト: Ancestry/DotQL
        private static object PrepareValueIndexContext(Compiler compiler, ExpressionContext left, Parse.Statement statement, BaseType memberType, System.Type memberNative, Frame local)
        {
            // Register value argument
            var valueSymbol = new Object();
            local.Add(statement, Name.FromComponents(Parse.ReservedWords.Value), valueSymbol);
            compiler.ContextsBySymbol.Add
            (
                valueSymbol,
                new ExpressionContext
                (
                    null,
                    memberType,
                    left.Characteristics,
                    m => { m.IL.Emit(OpCodes.Ldarg_0); }
                )
            );

            // Register index argument
            var indexSymbol = new Object();
            local.Add(statement, Name.FromComponents(Parse.ReservedWords.Index), indexSymbol);
            compiler.ContextsBySymbol.Add
            (
                indexSymbol,
                new ExpressionContext
                (
                    null,
                    SystemTypes.Int32,
                    Characteristic.Default,
                    m => { m.IL.Emit(OpCodes.Ldarg_1); }
                )
            );

            // If the members are tuples, declare locals for each field
            if (memberType is TupleType)
            {
                var tupleType = (TupleType)memberType;
                foreach (var attribute in tupleType.Attributes)
                {
                    local.Add(attribute.Key.ToID(), attribute);
                    compiler.ContextsBySymbol.Add
                    (
                        attribute,
                        new ExpressionContext
                        (
                            null,
                            attribute.Value,
                            Characteristic.Default,
                            m =>
                            {
                                m.IL.Emit(OpCodes.Ldarg_0);	// value
                                m.IL.Emit(OpCodes.Ldfld, memberNative.GetField(attribute.Key.ToString()));
                            }
                        )
                    );
                }

                // TODO: Add references
            }
            return indexSymbol;
        }
コード例 #11
0
        internal MonoDevelopStatusBar()
        {
            mainContext   = new MainStatusBarContextImpl(this);
            activeContext = mainContext;
            contexts.Add(mainContext);

            Frame originalFrame = (Frame)Children[0];

//			originalFrame.WidthRequest = 8;
//			originalFrame.Shadow = ShadowType.In;
//			originalFrame.BorderWidth = 0;

            BorderWidth = 0;
            Spacing     = 0;

            // Feedback button

            CustomFrame fr = new CustomFrame(0, 0, 1, 1);

            Gdk.Pixbuf px = Gdk.Pixbuf.LoadFromResource("balloon.png");
            HBox       b  = new HBox(false, 3);

            b.PackStart(new Gtk.Image(px));
            b.PackStart(new Gtk.Label("Feedback"));
            Gtk.Alignment al = new Gtk.Alignment(0f, 0f, 1f, 1f);
            al.RightPadding = 5;
            al.LeftPadding  = 3;
            al.Add(b);
            feedbackButton = new MiniButton(al);
            //feedbackButton.BackroundColor = new Gdk.Color (200, 200, 255);
            fr.Add(feedbackButton);
            PackStart(fr, false, false, 0);
            feedbackButton.Clicked                += HandleFeedbackButtonClicked;
            feedbackButton.ButtonPressEvent       += HandleFeedbackButtonButtonPressEvent;;
            feedbackButton.ClickOnRelease          = true;
            FeedbackService.FeedbackPositionGetter = delegate {
                int x, y;
                feedbackButton.GdkWindow.GetOrigin(out x, out y);
                x += feedbackButton.Allocation.Width;
                y -= 6;
                return(new Gdk.Point(x, y));
            };

            // Dock area

            DefaultWorkbench wb = (DefaultWorkbench)IdeApp.Workbench.RootWindow;

            wb.DockFrame.ShadedContainer.Add(this);
            Gtk.Widget dockBar = wb.DockFrame.ExtractDockBar(PositionType.Bottom);
            dockBar.NoShowAll = true;
            PackStart(dockBar, false, false, 0);

            // Status panels

            progressBar           = new ProgressBar();
            progressBar.PulseStep = 0.1;
            progressBar.SizeRequest();
            progressBar.HeightRequest = 1;

            statusBox             = new HBox(false, 0);
            statusBox.BorderWidth = 0;

            statusLabel = new Label();
            statusLabel.SetAlignment(0, 0.5f);
            statusLabel.Wrap = false;
            int w, h;

            Gtk.Icon.SizeLookup(IconSize.Menu, out w, out h);
            statusLabel.HeightRequest = h;
            statusLabel.SetPadding(0, 0);

            EventBox eventMessageBox = new EventBox();

            messageBox = new HBox();
            messageBox.PackStart(progressBar, false, false, 0);
            messageBox.PackStart(statusLabel, true, true, 0);
            eventMessageBox.Add(messageBox);
            statusBox.PackStart(eventMessageBox, true, true, 0);
            eventMessageBox.ButtonPressEvent += HandleEventMessageBoxButtonPressEvent;

            textStatusBarPanel.BorderWidth = 0;
            textStatusBarPanel.ShadowType  = ShadowType.None;
            textStatusBarPanel.Add(statusBox);
            Label fillerLabel = new Label();

            fillerLabel.WidthRequest = 8;
            statusBox.PackEnd(fillerLabel, false, false, 0);

            modeLabel = new Label(" ");
            statusBox.PackEnd(modeLabel, false, false, 8);

            cursorLabel = new Label(" ");
            statusBox.PackEnd(cursorLabel, false, false, 0);

            statusIconBox             = new HBox();
            statusIconBox.BorderWidth = 0;
            statusIconBox.Spacing     = 3;
            statusBox.PackEnd(statusIconBox, false, false, 4);

            this.PackStart(textStatusBarPanel, true, true, 0);

            ShowReady();
            Gtk.Box.BoxChild boxChild = (Gtk.Box.BoxChild) this[textStatusBarPanel];
            boxChild.Position = 0;
            boxChild.Expand   = boxChild.Fill = true;

            //		boxChild = (Gtk.Box.BoxChild)this[originalFrame];
            //		boxChild.Padding = 0;
            //		boxChild.Expand = boxChild.Fill = false;

            this.progressBar.Fraction = 0.0;
            this.ShowAll();
            statusIconBox.HideAll();

            originalFrame.HideAll();
            progressBar.Visible = false;

            StatusBarContext completionStatus = null;

            // todo: Move this to the CompletionWindowManager when it's possible.
            CompletionWindowManager.WindowShown += delegate {
                CompletionListWindow wnd = CompletionWindowManager.Wnd;
                if (wnd != null && wnd.List != null && wnd.List.CategoryCount > 1)
                {
                    if (completionStatus == null)
                    {
                        completionStatus = CreateContext();
                    }
                    completionStatus.ShowMessage(string.Format(GettextCatalog.GetString("To toggle categorized completion mode press {0}."), IdeApp.CommandService.GetCommandInfo(Commands.TextEditorCommands.ShowCompletionWindow).AccelKey));
                }
            };

            CompletionWindowManager.WindowClosed += delegate {
                if (completionStatus != null)
                {
                    completionStatus.Dispose();
                    completionStatus = null;
                }
            };
        }
コード例 #12
0
ファイル: Program.cs プロジェクト: nasanos/BitTracker
        public static void Main(string[] args)
        {
            CoinStats coinStats = BitStats.GetCoinStats("BTC-USD");
            BlockList blockHash = BitStats.GetBlockStats();

            // Configure window
            Application.Init();
            win       = new MainWindow();
            win.Title = "BitTracker";
            //win.KeepAbove = true;

            HBox hbox1 = new HBox(false, 5);
            HBox hbox2 = new HBox(false, 5);
            VBox vbox  = new VBox(false, 5);

            win.Add(vbox);
            vbox.PackStart(hbox1, false, false, 10);
            vbox.PackStart(hbox2, false, false, 10);

            // Display 24-hour coin stats
            float  coinStatsChange      = ((coinStats.last / coinStats.open) * 100 - 100);
            string coinStatsLabelString = "Opening:\t\t" + coinStats.open.ToString("0.00") +
                                          "\nCurrent:\t\t" + coinStats.last.ToString("0.00") +
                                          "\nChange\t\t" + coinStatsChange.ToString("0.00") + "%" + (coinStatsChange > 0 ? "\u2191" : "\u2193");
            Label coinStatsLabel = new Label();

            coinStatsLabel.Text = coinStatsLabelString;
            Frame coinStatsFrame = new Frame();

            coinStatsFrame.Label = "24-hour Stats";
            coinStatsFrame.Add(coinStatsLabel);
            hbox1.PackStart(coinStatsFrame, false, false, 10);

            // Persistence of toggle
            ToggleButton persToggle = new ToggleButton("Keep on Top");

            persToggle.Clicked += persToggleCallback;
            hbox1.PackStart(persToggle, false, false, 10);

            // Display blocks
            string   prevblockHash = blockHash.blocks[0].hash;
            DateTime unixTimeBase  = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

            Table blockStatsTable = new Table(3, 6, false);

            blockStatsTable.SetColSpacing(0, 15);
            blockStatsTable.SetColSpacing(1, 15);

            Frame blockStatsFrame = new Frame();

            blockStatsFrame.Add(blockStatsTable);
            hbox2.PackStart(blockStatsFrame, false, false, 10);

            Label blockStatsLabel1 = new Label();

            blockStatsLabel1.Text = "Hash";
            Label blockStatsLabel2 = new Label();

            blockStatsLabel2.Text = "Height";
            Label blockStatsLabel3 = new Label();

            blockStatsLabel3.Text = "Time";
            blockStatsTable.Attach(blockStatsLabel1, 0, 1, 0, 1);
            blockStatsTable.Attach(blockStatsLabel2, 1, 2, 0, 1);
            blockStatsTable.Attach(blockStatsLabel3, 2, 3, 0, 1);

            List <Label> blockHashLabel = new List <Label>()
            {
                new Label(), new Label(), new Label(), new Label(), new Label()
            };
            List <Label> blockHeightLabel = new List <Label>()
            {
                new Label(), new Label(), new Label(), new Label(), new Label()
            };
            List <Label> blockTimeLabel = new List <Label>()
            {
                new Label(), new Label(), new Label(), new Label(), new Label()
            };

            for (int i = 0; i < 5; i++)
            {
                blockHashLabel[i].Text = blockHash.blocks[i].hash;
                blockHashLabel[i].SetAlignment(0, 1);
                blockStatsTable.Attach(blockHashLabel[i], 0, 1, 1 + (uint)i, 2 + (uint)i);

                blockHeightLabel[i].Text = blockHash.blocks[i].height.ToString();
                blockHeightLabel[i].SetAlignment(0, 1);
                blockStatsTable.Attach(blockHeightLabel[i], 1, 2, 1 + (uint)i, 2 + (uint)i);

                DateTime blockHashTime = unixTimeBase.AddSeconds(blockHash.blocks[i].time);
                blockTimeLabel[i].Text = blockHashTime.ToString("MM/dd/yy H:mm UTC");
                blockTimeLabel[i].SetAlignment(0, 1);
                blockStatsTable.Attach(blockTimeLabel[i], 2, 3, 1 + (uint)i, 2 + (uint)i);
            }

            // Update stats
            uint timer = GLib.Timeout.Add(10000, new GLib.TimeoutHandler(() =>
            {
                // Coin stats
                coinStats            = BitStats.GetCoinStats("BTC-USD");
                coinStatsChange      = ((coinStats.last / coinStats.open) * 100 - 100);
                coinStatsLabelString = "Opening:\t\t" + coinStats.open.ToString("0.00") +
                                       "\nCurrent:\t\t" + coinStats.last.ToString("0.00") +
                                       "\nChange\t\t" + coinStatsChange.ToString("0.00") + "%" + (coinStatsChange > 0 ? "\u2191" : "\u2193");                         coinStatsLabel.Text = coinStatsLabelString;

                // Blocks
                blockHash = BitStats.GetBlockStats();
                if (blockHash.blocks[0].hash == prevblockHash)
                {
                    prevblockHash = blockHash.blocks[0].hash;

                    for (int i = 0; i < 5; i++)
                    {
                        blockHashLabel[i].Text   = blockHash.blocks[i].hash;
                        blockHeightLabel[i].Text = blockHash.blocks[i].height.ToString();
                        DateTime blockHashTime   = unixTimeBase.AddSeconds(blockHash.blocks[i].time);
                        blockTimeLabel[i].Text   = blockHashTime.ToString("MM/dd/yy H:mm UTC");
                    }
                }

                return(true);
            }));

            win.ShowAll();
            Application.Run();
        }
コード例 #13
0
    private void addSidePanel()
    {
        sidePanel.SetSizeRequest (Constants.Constants.LEGEND_PANEL_WIDTH, Constants.Constants.LEGEND_PANEL_HEIGHT);

        //will store free and occupied legends
        legendContainer = new VBox ();

        //make holders
        HBox freeLegendBox = new HBox ();
        HBox allocatedLegendBox = new HBox ();

        Label legendText = new Label (Constants.Constants.LegendHeader);
        legendText.Style = sidePanelLabelStyle.Copy ();

        Label freeLabel = new Label (Constants.Constants.FREE_LEGEND);
        freeLabel.Style = sidePanelLabelStyle.Copy ();
        Label occupiedLabel = new Label (Constants.Constants.OCCUPIED_LEGEND);
        occupiedLabel.Style = sidePanelLabelStyle.Copy ();

        EventBox freeColorContainer = MakeFreeColorContainer();
        freeColorContainer.SetSizeRequest (Constants.Constants.LEGEND_BOX_SIDE, Constants.Constants.LEGEND_BOX_SIDE);
        freeLegendBox.PackStart (freeColorContainer, false, false, 10);
        freeLegendBox.PackStart (freeLabel, false, false, 10);

        EventBox occupiedColorContainer = MakeOccupiedColorContainer ();
        occupiedColorContainer.SetSizeRequest (Constants.Constants.LEGEND_BOX_SIDE, Constants.Constants.LEGEND_BOX_SIDE);
        allocatedLegendBox.PackStart (occupiedColorContainer, false, false, 10);
        allocatedLegendBox.PackStart (occupiedLabel, false, false, 10);

        //make information about to tatal heap size
        Label totalHeapSizeLabel = new Label (Constants.Constants.TotalHeapSizeLabel + FileParser.FileParser.TotalHeapSize);
        totalHeapSizeLabel.Style = sidePanelLabelStyle.Copy ();

        legendContainer.PackStart (totalHeapSizeLabel, false, false, 10);
        legendContainer.PackStart (legendText, false, false, 10);
        legendContainer.PackStart (freeLegendBox, false, false, 0);
        legendContainer.PackStart (allocatedLegendBox, false, false, 0);

        //give border to legend container
        Frame f = new Frame ();
        f.Add (legendContainer);

        sidePanel.PackStart (f, false, false, 10);

        AddFragInfo ();
    }
コード例 #14
0
ファイル: Proteins.cs プロジェクト: mukhinaks/proteins
        private void AddButton(Frame parent, Game game, int x, int y, int btnWidth, int btnHeight, string str, Color color, Action action)
        {
            var button = new Frame(game, x, y, btnWidth, btnHeight, str, color)
            {
                Font = font,
                Border = 1,
                BorderColor = Color.White,
                TextAlignment = Alignment.MiddleCenter,

            };

            button.StatusChanged += (s, e) =>
            {
                if (e.Status == FrameStatus.None)       { button.BackColor = Color.Zero; }
                if (e.Status == FrameStatus.Hovered)    { button.BackColor = new Color (20, 20, 20); }
            };

            if (action != null)
            {
                button.Click += (s, e) =>
                {
                    action();
                };
            }

            parent.Add(button);
        }
コード例 #15
0
    /**
     * Method will be responsible for creating all main visual information used in this tool.
     * Achieved with numerous helper methods.
     * **/
    private void addMainPanel()
    {
        //holds graph + mem row size info
        graphContainer = new VBox ();

        EventBox rowSizeLabelContainer = new EventBox ();

        Label rowSizeLabel = new Label ("Row size: " + FileParser.FileParser.MemRowSize);
        rowSizeLabel.Style = subHeaderLabelStyle.Copy ();

        rowSizeLabel.SetSizeRequest(Constants.Constants.GRAPH_SIDE, 50);
        rowSizeLabelContainer.Add (rowSizeLabel);
        graphContainer.PackStart (rowSizeLabelContainer, false, false, 10);
        populateGraph ();

        //create grid layout that will hold block information and visual representation of memory
        HBox graphHBox = new HBox ();
        graphHBox.PackStart (graph, true, true, 40);

        graphContainer.PackStart (graphHBox, false, false, 50);

        //give border to legend container
        graphFrame = new Frame ();
        graphFrame.SetSizeRequest (Constants.Constants.GRAPH_CONTAINER_SIDE, Constants.Constants.LINK_PANEL_HEIGHT + 100);

        Viewport graphViewPort = new Viewport ();

        graphViewPort.SetSizeRequest (Constants.Constants.GRAPH_CONTAINER_SIDE, Constants.Constants.LINK_PANEL_HEIGHT);
        graphViewPort.Add (graphContainer);

        //add the window for the graph frame
        graphWindow = new ScrolledWindow ();
        graphWindow.SetSizeRequest (Constants.Constants.GRAPH_SIDE, Constants.Constants.LINK_PANEL_HEIGHT);
        graphWindow.Add (graphViewPort);

        graphFrame.Add (graphWindow);
    }
コード例 #16
0
    /**
     * Creates the "link" panel, which shows links between free blocks
     * */
    private void addLinkPanel()
    {
        //master mid panel container
        midPanel = new VBox ();

        //will store links between free blocks
        linkPanel = new VBox ();
        linkPanel.SetSizeRequest(Constants.Constants.LINK_PANEL_WIDTH, Constants.Constants.LINK_PANEL_HEIGHT);

        Label linkHeader = new Label (Constants.Constants.LinkHeader);
        linkHeader.Style = subHeaderLabelStyle.Copy ();

        linkPanel.PackStart (linkHeader, false, false, 10);

        //get the address link and insert values in form list[i] -> list[i + 1]
        List<int> addresses = FileParser.FileParser.AddressList;

        String link = "";
        for (int i = 0; i < addresses.Count; i++)
        {
            //make the link string
            link += "0x";
            link += addresses [i].ToString ("X");
            link += " -> ";

            if (i < addresses.Count - 1)
                link += ("0x" + addresses [i + 1].ToString ("X"));
            else
                link += "NULL";

            //insert it into thepanel
            Label linkInfoLabel = new Label (link);
            linkInfoLabel.Style = linkInfoStyle.Copy ();
            linkPanel.PackStart (linkInfoLabel, false, false, 5);

            //reset link
            link = "";
        }

        Viewport linkViewPort = new Viewport ();
        linkViewPort.SetSizeRequest(Constants.Constants.LINK_PANEL_WIDTH, Constants.Constants.LINK_PANEL_HEIGHT);
        linkViewPort.Add (linkPanel);

        //add the window for the graph frame
        linkWindow = new ScrolledWindow ();
        linkViewPort.SetSizeRequest(Constants.Constants.LINK_PANEL_WIDTH, Constants.Constants.LINK_PANEL_HEIGHT);
        linkWindow.Add (linkViewPort);

        //give border to legend container
        Frame f = new Frame ();
        f.Add (linkWindow);

        midPanel.PackStart (f, false, false, 10);
    }
コード例 #17
0
    /**
     * Adds in the fragmentation information to the side panel directly below free/alloc legend
     * */
    private void AddFragInfo()
    {
        fragInfoContainer = new VBox ();
        fragInfoContainer.SetSizeRequest (Constants.Constants.FRAG_INFO_HOLDER_WIDTH, Constants.Constants.FRAG_INFO_HOLDER_HEIGHT);

        Label fragInfoLabel = new Label (Constants.Constants.FRAG_INFO_HOLDER_TITLE);
        fragInfoLabel.Style = sidePanelLabelStyle.Copy ();

        //get the amount of external fragmentation
        int externalFragAsPercent = FileParser.FileParser.getAmountExternalFragmentation();

        //get % free and occupied
        float percentFree = FileParser.FileParser.GetPercentFree ();
        float percentOccupied = FileParser.FileParser.GetPercentOccupied ();

        Label totalFreePercentHolder = new Label (percentFree.ToString("N2") + Constants.Constants.FREE_LABEL_END);
        totalFreePercentHolder.Style = sidePanelLabelStyle.Copy ();

        Label totalOccupiedPercentHolder = new Label (percentOccupied.ToString("N2") + Constants.Constants.OCCUPIED_LABEL_END);
        totalOccupiedPercentHolder.Style = sidePanelLabelStyle.Copy ();

        Label externalFragLabel = new Label (externalFragAsPercent + Constants.Constants.EXTERNAL_FRAG_LABEL_END);
        externalFragLabel.Style = externalFragLabelStyle.Copy ();

        fragInfoContainer.PackStart (fragInfoLabel, false, false, 50);
        fragInfoContainer.PackStart (totalFreePercentHolder, false, false, 0);
        fragInfoContainer.PackStart (totalOccupiedPercentHolder, false, false, 0);
        fragInfoContainer.PackStart (externalFragLabel, false, false, 50);

        Frame f = new Frame ();
        f.Add (fragInfoContainer);

        sidePanel.PackStart (f, false, false, 10);
    }
コード例 #18
0
        /// <summary>
        /// Displays a child window with a list of soils, from which the user can make a selection
        /// This should probabaly be re-factored into a separate class
        /// Code largely copied from the intellisense viewer
        /// </summary>
        /// <param name="soilList">The list of soils to display</param>
        /// <returns>The index within the list of the user's selection, or -2 if cancelled</returns>
        private int SelectSoil(List <XmlNode> soilList)
        {
            ListStore soilsModel;

            curSel    = -1;
            selWindow = new Window(WindowType.Toplevel)
            {
                HeightRequest   = 300,
                WidthRequest    = 750,
                Decorated       = false,
                SkipPagerHint   = true,
                SkipTaskbarHint = true,
                TransientFor    = dialog1,
                Parent          = dialog1,
                WindowPosition  = WindowPosition.CenterOnParent
            };

            Frame selFrame = new Frame();

            selWindow.Add(selFrame);

            ScrolledWindow selScroller = new ScrolledWindow();

            selFrame.Add(selScroller);

            soilsModel = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            soilsView  = new Gtk.TreeView(soilsModel);
            selScroller.Add(soilsView);

            TreeViewColumn column = new TreeViewColumn()
            {
                Title     = "Name",
                Resizable = true,
            };
            CellRendererText textRender = new CellRendererText()
            {
                Editable   = false,
                WidthChars = 25,
                Ellipsize  = Pango.EllipsizeMode.End
            };

            column.PackStart(textRender, true);
            column.SetAttributes(textRender, "text", 0);
            soilsView.AppendColumn(column);

            column = new TreeViewColumn("Apsoil number", textRender, "text", 1)
            {
                Resizable = true
            };
            soilsView.AppendColumn(column);

            column = new TreeViewColumn("Soil type", textRender, "text", 2)
            {
                Resizable = true
            };
            soilsView.AppendColumn(column);

            column = new TreeViewColumn("Distance", textRender, "text", 3)
            {
                Resizable = true
            };
            soilsView.AppendColumn(column);

            soilsView.HasTooltip        = true;
            soilsView.TooltipColumn     = 4;
            soilsView.ButtonPressEvent += OnButtonPress;
            soilsView.KeyPressEvent    += OnSoilListKeyDown;

            soilsModel.Clear();
            foreach (XmlNode node in soilList)
            {
                string name     = XmlUtilities.NameAttr(node);
                string number   = XmlUtilities.Value(node, "ApsoilNumber");
                string soilType = XmlUtilities.Value(node, "SoilType");
                string distance = XmlUtilities.Value(node, "distanceFromQueryLocation");
                string comments = XmlUtilities.Value(node, "Comments");
                soilsModel.AppendValues(name, number, soilType, distance, comments);
            }

            selWindow.ShowAll();
            while (curSel == -1)
            {
                GLib.MainContext.Iteration();
            }
            return(curSel);
        }
コード例 #19
0
    void AddItemToCurrentMarketGroup(ECM.EveItem item, TreeModel model, TreeIter iter)
    {
        if (vbbMarketGroups.IsRealized == false)
            vbbMarketGroups.Realize();

        Image itemPic = new Image();
        itemPic.PixbufAnimation = new Gdk.PixbufAnimation(ECM.Core.LoadingSpinnerGIF);
        itemPic.WidthRequest = 64;
        itemPic.HeightRequest = 64;

        BackgroundWorker fetchImage = new BackgroundWorker();
        fetchImage.DoWork += delegate(object sender, DoWorkEventArgs e)
        {
            itemPic.Pixbuf = ECM.API.ImageApi.GetItemImageGTK(item.ID, ECM.API.ImageApi.ImageRequestSize.Size64x64);
        };

        fetchImage.RunWorkerAsync();

        Gdk.Pixbuf buf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 22, 22);
        Gdk.Pixbuf book = new Gdk.Pixbuf(ECM.Core.Skillbook22PNG);

        EveItemUseability useability = Core.CurrentCharacter.GetItemUseability(item);

        if (useability == EveItemUseability.Untrainable)
            buf.Fill(m_Untrainable.ToUint());
        else if (useability == EveItemUseability.Trainable)
            buf.Fill(m_Trainable.ToUint());
        else
            buf.Fill(m_Useable.ToUint());

        book.Composite(buf, 0, 0, buf.Width, buf.Height, 0, 0, 1, 1, Gdk.InterpType.Hyper, 255);

        Image skillsMet = new Image(buf);
        skillsMet.WidthRequest = 22;
        skillsMet.HeightRequest = 22;
        skillsMet.Xalign = 0;

        Pango.FontDescription font = new Pango.FontDescription();
        font.Size = 24;

        Label itemName = new Label();
        itemName.UseMarkup = true;
        itemName.Markup = string.Format("<span size=\"large\" weight=\"bold\">{0}</span>", item.Name);
        itemName.Xalign = 0;
        //itemName.ModifyFont(font);

        Image infoPic = new Image(ECM.Core.Info16PNG);
        infoPic.WidthRequest = 16;
        infoPic.HeightRequest = 16;

        Button btnInfo = new Button();
        btnInfo.Relief = ReliefStyle.None;
        btnInfo.Add(infoPic);
        btnInfo.Clicked += delegate(object sender, EventArgs e)
        {
            m_ViewDetails.ShowItemDetails(item);
        };

        HBox itemNameHeader = new HBox();
        itemNameHeader.PackStart(itemName, false, false, 0);
        itemNameHeader.PackStart(btnInfo, false, false, 3);

        WrapLabel itemDesc = new WrapLabel(item.Description);

        Frame picFrame = new Frame();
        picFrame.Shadow = ShadowType.Out;
        picFrame.Add(itemPic);

        VBox heading = new VBox();
        heading.Spacing = 6;
        heading.PackEnd(itemNameHeader, false, false, 0);

        if(item.HasRequirements)
            heading.PackEnd(skillsMet, false, false, 0);

        HBox inner = new HBox();
        inner.PackStart(picFrame, false, false, 0);
        inner.PackStart(heading, true, true, 1);

        Button viewDets = new Button(new Label("View Market Details"));
        viewDets.Clicked += delegate(object sender, EventArgs e)
        {
            ShowItemMarketDetails(item, model, iter);
        };

        HButtonBox itemButtons = new HButtonBox();
        itemButtons.Layout = ButtonBoxStyle.End;
        itemButtons.BorderWidth = 3;
        itemButtons.Add(viewDets);
        itemButtons.ShowAll();

        HSeparator sep = new HSeparator();

        VBox itemBlock = new VBox();
        itemBlock.Spacing = 10;
        itemBlock.PackStart(inner, false, false, 0);
        itemBlock.PackStart(itemDesc, true, true, 0);
        itemBlock.PackEnd(itemButtons, false, false, 0);

        itemBlock.ShowAll();
        sep.ShowAll();

        vbbMarketGroups.PackStart(itemBlock, false, false, 3);
        vbbMarketGroups.PackStart(sep, false, false, 3);
    }
コード例 #20
0
ファイル: DialogArticleFamily.cs プロジェクト: sciux/logicPOS
        private void InitUI()
        {
            try
            {
                //Tab1
                VBox vboxTab1 = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };

                //Ord
                Entry       entryOrd = new Entry();
                BOWidgetBox boxLabel = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_order"), entryOrd);
                vboxTab1.PackStart(boxLabel, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true));

                //Code
                Entry       entryCode = new Entry();
                BOWidgetBox boxCode   = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_code"), entryCode);
                vboxTab1.PackStart(boxCode, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true));

                //Designation
                Entry       entryDesignation = new Entry();
                BOWidgetBox boxDesignation   = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_designation"), entryDesignation);
                vboxTab1.PackStart(boxDesignation, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDesignation, _dataSourceRow, "Designation", SettingsApp.RegexAlfaNumeric, true));

                //ButtonLabel
                Entry       entryButtonLabel = new Entry();
                BOWidgetBox boxButtonLabel   = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_button_name"), entryButtonLabel);
                vboxTab1.PackStart(boxButtonLabel, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxButtonLabel, _dataSourceRow, "ButtonLabel", SettingsApp.RegexAlfaNumericExtended, false));

                //ButtonImage
                FileChooserButton fileChooserButtonImage = new FileChooserButton(string.Empty, FileChooserAction.Open)
                {
                    HeightRequest = 23
                };
                Image fileChooserImagePreviewButtonImage = new Image()
                {
                    WidthRequest = _sizefileChooserPreview.Width, HeightRequest = _sizefileChooserPreview.Height
                };
                Frame fileChooserFrameImagePreviewButtonImage = new Frame();
                fileChooserFrameImagePreviewButtonImage.ShadowType = ShadowType.None;
                fileChooserFrameImagePreviewButtonImage.Add(fileChooserImagePreviewButtonImage);
                fileChooserButtonImage.SetFilename(((fin_articlefamily)DataSourceRow).ButtonImage);
                fileChooserButtonImage.Filter            = Utils.GetFileFilterImages();
                fileChooserButtonImage.SelectionChanged += (sender, eventArgs) => fileChooserImagePreviewButtonImage.Pixbuf = Utils.ResizeAndCropFileToPixBuf((sender as FileChooserButton).Filename, new System.Drawing.Size(fileChooserImagePreviewButtonImage.WidthRequest, fileChooserImagePreviewButtonImage.HeightRequest));
                BOWidgetBox boxfileChooserButtonImage = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_button_image"), fileChooserButtonImage);
                HBox        hboxfileChooserAndimagePreviewButtonImage = new HBox(false, _boxSpacing);
                hboxfileChooserAndimagePreviewButtonImage.PackStart(boxfileChooserButtonImage, true, true, 0);
                hboxfileChooserAndimagePreviewButtonImage.PackStart(fileChooserFrameImagePreviewButtonImage, false, false, 0);
                vboxTab1.PackStart(hboxfileChooserAndimagePreviewButtonImage, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxfileChooserButtonImage, _dataSourceRow, "ButtonImage", string.Empty, false));

                //CommissionGroup
                XPOComboBox xpoComboBoxCommissionGroup = new XPOComboBox(DataSourceRow.Session, typeof(pos_usercommissiongroup), (DataSourceRow as fin_articlefamily).CommissionGroup, "Designation", null);
                BOWidgetBox boxCommissionGroup         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_commission_group"), xpoComboBoxCommissionGroup);
                vboxTab1.PackStart(boxCommissionGroup, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCommissionGroup, DataSourceRow, "CommissionGroup", SettingsApp.RegexGuid, false));

                //Printer
                XPOComboBox xpoComboBoxPrinter = new XPOComboBox(DataSourceRow.Session, typeof(sys_configurationprinters), (DataSourceRow as fin_articlefamily).Printer, "Designation", null);
                BOWidgetBox boxPrinter         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_device_printer"), xpoComboBoxPrinter);
                vboxTab1.PackStart(boxPrinter, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPrinter, DataSourceRow, "Printer", SettingsApp.RegexGuid, false));

                //Template
                XPOComboBox xpoComboBoxTemplate = new XPOComboBox(DataSourceRow.Session, typeof(sys_configurationprinterstemplates), (DataSourceRow as fin_articlefamily).Template, "Designation", null);
                BOWidgetBox boxTemplate         = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_ConfigurationPrintersTemplates"), xpoComboBoxTemplate);
                vboxTab1.PackStart(boxTemplate, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxTemplate, DataSourceRow, "Template", SettingsApp.RegexGuid, false));

                //Disabled
                CheckButton checkButtonDisabled = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_disabled"));
                if (_dialogMode == DialogMode.Insert)
                {
                    checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled;
                }
                vboxTab1.PackStart(checkButtonDisabled, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled"));

                //Append Tab
                _notebook.AppendPage(vboxTab1, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_main_detail")));
            }
            catch (System.Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
コード例 #21
0
        private void InitComponents()
        {
            Resizable      = true;
            HeightRequest  = 425;
            WidthRequest   = 410;
            WindowPosition = WindowPosition.Center;
            Icon           = IconThemeUtils.LoadIcon("banshee", 16);

            var vbox = new VBox()
            {
                Spacing     = 6,
                BorderWidth = 12
            };

            track_info_display = new ClassicTrackInfoDisplay();
            vbox.PackStart(track_info_display, false, false, 0);

            lyrics_browser = new LyricsBrowser();

            lyrics_pane = new ScrolledWindow();
            lyrics_pane.Add(lyrics_browser);

            var frame = new Frame();

            frame.Add(lyrics_pane);

            vbox.PackStart(frame, true, true, 0);

            var button_box = new HButtonBox()
            {
                Spacing     = 6,
                BorderWidth = 1,
                LayoutStyle = ButtonBoxStyle.End
            };

            var copy_button = new Button("gtk-copy")
            {
                TooltipText = AddinManager.CurrentLocalizer.GetString("Copy lyrics to clipboard")
            };
            var close_button = new Button("gtk-close");

            refresh_button = new Button("gtk-refresh");
            save_button    = new Button("gtk-save");

            button_box.PackStart(copy_button, false, false, 0);
            button_box.PackStart(refresh_button, false, false, 0);
            button_box.PackStart(save_button, false, false, 0);
            button_box.PackStart(close_button, false, false, 0);

            vbox.PackStart(button_box, false, false, 0);

            Add(vbox);
            if (Child != null)
            {
                Child.ShowAll();
            }

            text_view          = new TextView();
            text_view.WrapMode = WrapMode.Word;

            Hide();

            KeyPressEvent += OnKeyPressed;
            DeleteEvent   += delegate(object o, DeleteEventArgs args) {
                OnClose(this, null);
                args.RetVal = true;
            };

            refresh_button.Clicked += OnRefresh;
            save_button.Clicked    += OnSaveLyrics;
            close_button.Clicked   += OnClose;
            copy_button.Clicked    += OnCopy;

            lyrics_browser.AddLinkClicked       += ManuallyAddLyrics;
            LyricsManager.Instance.LoadStarted  += lyrics_browser.OnLoading;
            LyricsManager.Instance.LoadFinished += lyrics_browser.LoadString;
            SwitchTo(HTML_MODE);
        }
コード例 #22
0
        /// <summary>
        /// Constructor. Initialises the jobs TreeView and the controls associated with it.
        /// </summary>
        /// <param name="owner"></param>
        public CloudJobDisplayView(ViewBase owner) : base(owner)
        {
            store = new ListStore(typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));

            Type[] types = new Type[columnTitles.Length];
            tree = new Gtk.TreeView()
            {
                CanFocus = true, RubberBanding = true, Name = "custom_treeview"
            };
            tree.Selection.Mode = SelectionMode.Multiple;

            for (int i = 0; i < columnTitles.Length; i++)
            {
                types[i] = typeof(string);
                TreeViewColumn col = new TreeViewColumn
                {
                    Title        = columnTitles[i],
                    SortColumnId = i,
                    Resizable    = true,
                    Sizing       = TreeViewColumnSizing.GrowOnly
                };
                CellRendererText cell = new CellRendererText();
                col.PackStart(cell, false);
                col.AddAttribute(cell, "text", i);
                tree.AppendColumn(col);
            }
            store = new ListStore(types);

            // this filter holds the model (data) and is used to filter jobs based on whether
            // they were submitted by the user
            filterOwner = new TreeModelFilter(store, null)
            {
                VisibleFunc = FilterOwnerFunc
            };
            filterOwner.Refilter();

            // the filter then goes into this TreeModelSort, which is used to sort results when
            // the user clicks on a column header
            sort = new TreeModelSort(filterOwner)
            {
                DefaultSortFunc = (model, a, b) => SortData(model, a, b, Array.IndexOf(columnTitles, "Start Time"))
            };
            for (int i = 0; i < columnTitles.Length; i++)
            {
                int count = i;
                sort.SetSortFunc(i, (model, a, b) => SortData(model, a, b, count));
            }


            // change the colour of every other row - makes it easier to read
            string style = "style \"custom-treestyle\"{ GtkTreeView::odd-row-color = \"#ECF2FD\" GtkTreeView::even-row-color = \"#FFFFFF\" GtkTreeView::allow-rules = 1 } widget \"*custom_treeview*\" style \"custom-treestyle\"";

            //tree.CanFocus = true;
            tree.RulesHint = true;
            Rc.ParseString(style);


            // the tree holds the sorted, filtered data
            tree.Model = sort;

            // the tree goes into this ScrolledWindow, allowing users to scroll down
            // to view more jobs
            ScrolledWindow scroll = new ScrolledWindow();

            scroll.Add(tree);
            // never allow horizontal scrolling, and only allow vertical scrolling when needed
            scroll.HscrollbarPolicy = PolicyType.Automatic;
            scroll.VscrollbarPolicy = PolicyType.Automatic;

            // the scrolled window goes into this frame to distinguish the job view
            // from the controls beside it
            Frame treeContainer = new Frame("Cloud Jobs");

            treeContainer.Add(scroll);

            chkFilterOwner = new CheckButton("Display my jobs only");
            // display the user's jobs only by default
            myJobsOnly              = true;
            chkFilterOwner.Active   = true;
            chkFilterOwner.Toggled += ApplyFilter;
            chkFilterOwner.Yalign   = 0;

            downloadProgress    = new ProgressBar(new Adjustment(0, 0, 1, 0.01, 0.01, 1));
            lblDownloadProgress = new Label("Downloading: ");

            downloadProgressContainer = new HBox();
            downloadProgressContainer.PackStart(lblDownloadProgress, false, false, 0);
            downloadProgressContainer.PackStart(downloadProgress, false, false, 0);

            loadingProgress = new ProgressBar(new Adjustment(0, 0, 100, 0.01, 0.01, 100));
            loadingProgress.Adjustment.Lower = 0;
            loadingProgress.Adjustment.Upper = 100;



            lblDownloadStatus        = new Label("");
            lblDownloadStatus.Xalign = 0;

            btnChangeDownloadDir          = new Button("Change Download Directory");
            btnChangeDownloadDir.Clicked += BtnChangeDownloadDir_Click;

            tblButtonContainer = new Table(1, 1, false);
            tblButtonContainer.Attach(btnChangeDownloadDir, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            btnDownload          = new Button("Download");
            btnDownload.Clicked += BtnDownload_Click;
            HBox downloadButtonContainer = new HBox();

            downloadButtonContainer.PackStart(btnDownload, false, true, 0);

            btnDelete          = new Button("Delete Job(s)");
            btnDelete.Clicked += BtnDelete_Click;
            HBox deleteButtonContainer = new HBox();

            deleteButtonContainer.PackStart(btnDelete, false, true, 0);

            btnStop          = new Button("Stop Job(s)");
            btnStop.Clicked += BtnStop_Click;
            HBox stopButtonContainer = new HBox();

            stopButtonContainer.PackStart(btnStop, false, true, 0);

            btnSetup          = new Button("Credentials");
            btnSetup.Clicked += BtnSetup_Click;
            HBox setupButtonContainer = new HBox();

            setupButtonContainer.PackStart(btnSetup, false, true, 0);

            progress = new HBox();
            progress.PackStart(new Label("Loading Jobs: "), false, false, 0);
            progress.PackStart(loadingProgress, false, false, 0);

            vboxDownloadStatuses = new VBox();

            controlsContainer = new VBox();
            controlsContainer.PackStart(chkFilterOwner, false, false, 0);
            controlsContainer.PackStart(downloadButtonContainer, false, false, 0);
            controlsContainer.PackStart(stopButtonContainer, false, false, 0);
            controlsContainer.PackStart(deleteButtonContainer, false, false, 0);
            controlsContainer.PackStart(setupButtonContainer, false, false, 0);
            controlsContainer.PackEnd(tblButtonContainer, false, false, 0);

            hboxPrimary = new HBox();
            hboxPrimary.PackStart(treeContainer, true, true, 0);
            hboxPrimary.PackStart(controlsContainer, false, true, 0);


            vboxPrimary = new VBox();
            vboxPrimary.PackStart(hboxPrimary);
            vboxPrimary.PackStart(lblDownloadStatus, false, false, 0);
            vboxPrimary.PackEnd(progress, false, false, 0);
            vboxPrimary.PackEnd(downloadProgressContainer, false, false, 0);

            mainWidget = vboxPrimary;
            vboxPrimary.ShowAll();

            downloadProgressContainer.HideAll();
            HideLoadingProgressBar();
        }
コード例 #23
0
        private void ShowCalendar()
        {
            popup        = new Window(WindowType.Popup);
            popup.Screen = tree.Screen;

            Frame frame = new Frame();

            frame.Shadow = ShadowType.Out;
            frame.Show();

            popup.Add(frame);

            VBox box = new VBox(false, 0);

            box.Show();
            frame.Add(box);

            cal = new Calendar();
            cal.DisplayOptions = CalendarDisplayOptions.ShowHeading
                                 | CalendarDisplayOptions.ShowDayNames
                                 | CalendarDisplayOptions.ShowWeekNumbers;

            cal.KeyPressEvent      += OnCalendarKeyPressed;
            popup.ButtonPressEvent += OnButtonPressed;

            cal.Show();

            Alignment calAlignment = new Alignment(0.0f, 0.0f, 1.0f, 1.0f);

            calAlignment.Show();
            calAlignment.SetPadding(4, 4, 4, 4);
            calAlignment.Add(cal);

            box.PackStart(calAlignment, false, false, 0);

            // FIXME: Make the popup appear directly below the date
            Gdk.Rectangle allocation = tree.Allocation;
//   Gtk.Requisition req = tree.SizeRequest ();
            int x = 0, y = 0;

            tree.GdkWindow.GetOrigin(out x, out y);
//   popup.Move(x + allocation.X, y + allocation.Y + req.Height + 3);
            popup.Move(x + allocation.X, y + allocation.Y);
            popup.Show();
            popup.GrabFocus();

            Grab.Add(popup);

            Gdk.GrabStatus grabbed = Gdk.Pointer.Grab(popup.GdkWindow, true,
                                                      Gdk.EventMask.ButtonPressMask
                                                      | Gdk.EventMask.ButtonReleaseMask
                                                      | Gdk.EventMask.PointerMotionMask, null, null, CURRENT_TIME);

            if (grabbed == Gdk.GrabStatus.Success)
            {
                grabbed = Gdk.Keyboard.Grab(popup.GdkWindow,
                                            true, CURRENT_TIME);

                if (grabbed != Gdk.GrabStatus.Success)
                {
                    Grab.Remove(popup);
                    popup.Destroy();
                    popup = null;
                }
            }
            else
            {
                Grab.Remove(popup);
                popup.Destroy();
                popup = null;
            }

            cal.DaySelectedDoubleClick += OnCalendarDaySelected;
            cal.ButtonPressEvent       += OnCalendarButtonPressed;

            cal.Date = date == DateTime.MinValue ? DateTime.Now : date;
        }
コード例 #24
0
	static void Main (string [] args)
	{
		if (args.Length > 0 && args [0] == "debug")
			BoardPiece.Debug = true;
		Program fifteen = new Program ("Fifteen", "0.1", Modules.UI, args);
		
		window = new Gtk.Window ("Fifteen #");
		VBox box = new VBox (false, 0);
		window.Add (box);
		window.DefaultWidth = 300;
		window.DefaultHeight = 300;
		
		VBox vbox = new VBox (false, 4);
		vbox.BorderWidth = 4;

		MenuBar menu = Create_Menu ();
		box.PackStart (menu, false, false, 0);
		box.PackStart (vbox, false, false, 0);
		window.DeleteEvent += new DeleteEventHandler (Window_Delete);

		Alignment alignment = new Alignment (0.5f, 0.5f, 0.0f, 0.0f);
		vbox.PackStart (alignment, true, true, 4);

		Frame frame = new Frame (null);
		frame.ShadowType = ShadowType.In;
		alignment.Add (frame);

		canvas = new Canvas ();
		canvas.SetSizeRequest (BoardPiece.PIECE_SIZE * 4 + 1, BoardPiece.PIECE_SIZE * 4 + 1);
		canvas.SetScrollRegion (0, 0, BoardPiece.PIECE_SIZE * 4 + 1, BoardPiece.PIECE_SIZE * 4 + 1);
		frame.Add (canvas);
		
		board = new BoardPiece [16];

		for (int i = 0; i < 15; i ++) {					
			int y = i /4;
			int x = i % 4;
			board [i] = new BoardPiece (canvas.Root (), board, x, y, i);
		}

		box.PackStart (new HSeparator (), false, false, 0);
		HBox hbox = new HBox (false, 4);
		box.PackStart (hbox, true, false, 4);

		// Scramble button here.
		Button scramble = new Button ("_Scramble");
		scramble.BorderWidth = 8;
		scramble.Clicked += new EventHandler (Scramble);
		scramble.CanDefault = true;
		hbox.PackStart (scramble, true, true, 4);
		scramble.GrabDefault ();

		// Close button
		Button close = new Button ("_Close");
		close.BorderWidth = 8;
		close.Clicked += new EventHandler (Quit);
		hbox.PackStart (close, true, true, 4);
		
		window.ShowAll ();
		fifteen.Run ();
	}
コード例 #25
0
    protected Widget CreateCharacterButton(ECM.Character character)
    {
        HBox box = new HBox();

        Frame frm = new Frame();
        frm.Shadow = ShadowType.EtchedOut;
        frm.BorderWidth = 3;

        Image img = new Image();
        img.WidthRequest = 64;
        img.HeightRequest = 64;

        if (character.Portrait != null)
            img.Pixbuf = ECM.API.ImageApi.StreamToPixbuf(character.Portrait).ScaleSimple(64, 64, Gdk.InterpType.Bilinear);
        else
            img.Pixbuf = ECM.API.ImageApi.StreamToPixbuf(ECM.Core.NoPortraitJPG).ScaleSimple(64, 64, Gdk.InterpType.Bilinear);

        frm.Add(img);

        box.PackStart(frm, false, false, 3);

        Label text = new Label();
        text.UseMarkup = true;
        text.Markup = string.Format("<span size=\"larger\" weight=\"bold\">{0}</span>\n<span size=\"small\">{1}\n{2:0,0.00} ISK\nLocation: {3}</span>",
                            character.Name, character.Background, character.AccountBalance, character.LastKnownLocation);
        text.Xalign = 0;
        text.Yalign = 0;

        box.PackStart(text, true, true, 0);
        Button btn = new Button(box);

        btn.Name = string.Format("btn{0}", character.ID);
        btn.Clicked += delegate(object sender, EventArgs e)
        {
            ECM.Core.CurrentCharacter = character;
        };

        btn.ShowAll();
        return btn;
    }
コード例 #26
0
 protected virtual void Build()
 {
     // Widget BizeeBirdBoarding.Ui.MainWindow
     Name           = "BizeeBirdBoarding.Ui.MainWindow";
     Title          = "BiZee Bird Boarding";
     WindowPosition = WindowPosition.CenterOnParent;
     DefaultWidth   = 1115;
     DefaultHeight  = 480;
     // Container child BizeeBirdBoarding.Ui.MainWindow.Container+ContainerChild
     topLevelVbox         = new VBox();
     topLevelVbox.Name    = "topLevelVbox";
     topLevelVbox.Spacing = 6;
     // Container child topLevelVbox.Box+BoxChild
     toolbarButtonBox             = new HButtonBox();
     toolbarButtonBox.Name        = "toolbarButtonBox";
     toolbarButtonBox.LayoutStyle = ButtonBoxStyle.Start;
     // Container child toolbarButtonBox.ButtonBox+ButtonBoxChild
     button1              = new Button();
     button1.CanFocus     = true;
     button1.Name         = "button1";
     button1.UseUnderline = true;
     button1.Label        = "New Customer";
     toolbarButtonBox.Add(button1);
     ButtonBox.ButtonBoxChild w1 = (ButtonBox.ButtonBoxChild)toolbarButtonBox[button1];
     w1.Expand = false;
     w1.Fill   = false;
     // Container child toolbarButtonBox.ButtonBox+ButtonBoxChild
     button2              = new Button();
     button2.CanFocus     = true;
     button2.Name         = "button2";
     button2.UseUnderline = true;
     button2.Label        = "New Appointment";
     toolbarButtonBox.Add(button2);
     ButtonBox.ButtonBoxChild w2 = (ButtonBox.ButtonBoxChild)toolbarButtonBox[button2];
     w2.Position = 1;
     w2.Expand   = false;
     w2.Fill     = false;
     topLevelVbox.Add(toolbarButtonBox);
     Box.BoxChild w3 = ((Box.BoxChild)(topLevelVbox[toolbarButtonBox]));
     w3.Position = 0;
     w3.Expand   = false;
     w3.Fill     = false;
     // Container child topLevelVbox.Box+BoxChild
     notebook             = new Notebook();
     notebook.CanFocus    = true;
     notebook.Name        = "notebook";
     notebook.CurrentPage = 0;
     // Container child notebook.Notebook+NotebookChild
     appointmentsTabHPaned      = new HPaned();
     appointmentsTabHPaned.Name = "appointmentsTabHPaned";
     // Container child appointmentsTabHPaned.Paned+PanedChild
     upcomingDropOffsFrame = new Frame();
     upcomingDropOffsFrame.WidthRequest = 450;
     upcomingDropOffsFrame.Name         = "upcomingDropOffsFrame";
     upcomingDropOffsFrame.ShadowType   = ShadowType.In;
     // Container child upcomingDropOffsFrame.Container+ContainerChild
     upcomingDropOffsGtkAlignment             = new Alignment(0F, 0F, 1F, 1F);
     upcomingDropOffsGtkAlignment.Name        = "upcomingDropOffsGtkAlignment";
     upcomingDropOffsGtkAlignment.LeftPadding = 12;
     // Container child upcomingDropOffsGtkAlignment.Container+ContainerChild
     upcomingDropOffsGtkScrolledWindow            = new ScrolledWindow();
     upcomingDropOffsGtkScrolledWindow.Name       = "upcomingDropOffsGtkScrolledWindow";
     upcomingDropOffsGtkScrolledWindow.ShadowType = ShadowType.In;
     // Container child upcomingDropOffsGtkScrolledWindow.Container+ContainerChild
     upcomingDropOffsTreeView          = new TreeView();
     upcomingDropOffsTreeView.CanFocus = true;
     upcomingDropOffsTreeView.Name     = "upcomingDropOffsTreeView";
     upcomingDropOffsGtkScrolledWindow.Add(upcomingDropOffsTreeView);
     upcomingDropOffsGtkAlignment.Add(upcomingDropOffsGtkScrolledWindow);
     upcomingDropOffsFrame.Add(upcomingDropOffsGtkAlignment);
     upcomingDropOffsLabel             = new Label();
     upcomingDropOffsLabel.Name        = "upcomingDropOffsLabel";
     upcomingDropOffsLabel.LabelProp   = "<b>Upcoming Drop Offs</b>";
     upcomingDropOffsLabel.UseMarkup   = true;
     upcomingDropOffsFrame.LabelWidget = upcomingDropOffsLabel;
     appointmentsTabHPaned.Add(upcomingDropOffsFrame);
     Paned.PanedChild w7 = (Paned.PanedChild)appointmentsTabHPaned[upcomingDropOffsFrame];
     w7.Resize = false;
     // Container child appointmentsTabHPaned.Paned+PanedChild
     upcomingPickupsFrame            = new Frame();
     upcomingPickupsFrame.Name       = "upcomingPickupsFrame";
     upcomingPickupsFrame.ShadowType = ShadowType.In;
     // Container child upcomingPickupsFrame.Container+ContainerChild
     upcomingPickupsAlignment             = new Alignment(0F, 0F, 1F, 1F);
     upcomingPickupsAlignment.Name        = "upcomingPickupsAlignment";
     upcomingPickupsAlignment.LeftPadding = 12;
     // Container child upcomingPickupsAlignment.Container+ContainerChild
     upcomingPickupsScrolledWindow            = new ScrolledWindow();
     upcomingPickupsScrolledWindow.Name       = "upcomingPickupsScrolledWindow";
     upcomingPickupsScrolledWindow.ShadowType = ShadowType.In;
     // Container child upcomingPickupsScrolledWindow.Container+ContainerChild
     upcomingPickupsTreeview          = new TreeView();
     upcomingPickupsTreeview.CanFocus = true;
     upcomingPickupsTreeview.Name     = "upcomingPickupsTreeview";
     upcomingPickupsScrolledWindow.Add(upcomingPickupsTreeview);
     upcomingPickupsAlignment.Add(upcomingPickupsScrolledWindow);
     upcomingPickupsFrame.Add(upcomingPickupsAlignment);
     upcomingPickupsLabel             = new Label();
     upcomingPickupsLabel.Name        = "upcomingPickupsLabel";
     upcomingPickupsLabel.LabelProp   = "<b>Upcoming Pickups</b>";
     upcomingPickupsLabel.UseMarkup   = true;
     upcomingPickupsFrame.LabelWidget = upcomingPickupsLabel;
     appointmentsTabHPaned.Add(upcomingPickupsFrame);
     notebook.Add(appointmentsTabHPaned);
     // Notebook tab
     appointmentsTabLabel           = new Label();
     appointmentsTabLabel.Name      = "appointmentsTabLabel";
     appointmentsTabLabel.LabelProp = "Appointments";
     notebook.SetTabLabel(appointmentsTabHPaned, appointmentsTabLabel);
     appointmentsTabLabel.ShowAll();
     // Container child notebook.Notebook+NotebookChild
     customerTabVbox         = new VBox();
     customerTabVbox.Name    = "customerTabVbox";
     customerTabVbox.Spacing = 6;
     // Container child customerTabVbox.Box+BoxChild
     hbox1         = new HBox();
     hbox1.Name    = "hbox1";
     hbox1.Spacing = 6;
     // Container child hbox1.Box+BoxChild
     customerSearchLabel           = new Label();
     customerSearchLabel.Name      = "customerSearchLabel";
     customerSearchLabel.LabelProp = "Search";
     hbox1.Add(customerSearchLabel);
     Box.BoxChild w13 = (Box.BoxChild)hbox1[customerSearchLabel];
     w13.Position = 0;
     w13.Expand   = false;
     w13.Fill     = false;
     // Container child hbox1.Box+BoxChild
     customerSearchEntry            = new Entry();
     customerSearchEntry.CanFocus   = true;
     customerSearchEntry.Name       = "customerSearchEntry";
     customerSearchEntry.IsEditable = true;
     hbox1.Add(customerSearchEntry);
     Box.BoxChild w14 = (Box.BoxChild)hbox1[customerSearchEntry];
     w14.Position = 1;
     customerTabVbox.Add(hbox1);
     Box.BoxChild w15 = (Box.BoxChild)customerTabVbox[hbox1];
     w15.Position = 0;
     w15.Expand   = false;
     w15.Fill     = false;
     // Container child customerTabVbox.Box+BoxChild
     customersScrolledWindow            = new ScrolledWindow();
     customersScrolledWindow.Name       = "customersScrolledWindow";
     customersScrolledWindow.ShadowType = ShadowType.In;
     // Container child customersScrolledWindow.Container+ContainerChild
     customersTreeview          = new TreeView();
     customersTreeview.CanFocus = true;
     customersTreeview.Name     = "customersTreeview";
     customersScrolledWindow.Add(customersTreeview);
     customerTabVbox.Add(customersScrolledWindow);
     Box.BoxChild w17 = (Box.BoxChild)customerTabVbox[customersScrolledWindow];
     w17.Position = 1;
     notebook.Add(customerTabVbox);
     Notebook.NotebookChild w18 = (Notebook.NotebookChild)notebook[customerTabVbox];
     w18.Position = 1;
     // Notebook tab
     customerTabLabel           = new Label();
     customerTabLabel.Name      = "customerTabLabel";
     customerTabLabel.LabelProp = "Customers";
     notebook.SetTabLabel(customerTabVbox, customerTabLabel);
     customerTabLabel.ShowAll();
     // Container child notebook.Notebook+NotebookChild
     historyTablVbox         = new VBox();
     historyTablVbox.Name    = "historyTablVbox";
     historyTablVbox.Spacing = 6;
     // Container child historyTablVbox.Box+BoxChild
     historySearchHbox         = new HBox();
     historySearchHbox.Name    = "historySearchHbox";
     historySearchHbox.Spacing = 6;
     // Container child historySearchHbox.Box+BoxChild
     historySearchLabel           = new Label();
     historySearchLabel.Name      = "historySearchLabel";
     historySearchLabel.LabelProp = "Search";
     historySearchHbox.Add(historySearchLabel);
     Box.BoxChild w19 = (Box.BoxChild)historySearchHbox[historySearchLabel];
     w19.Position = 0;
     w19.Expand   = false;
     w19.Fill     = false;
     // Container child historySearchHbox.Box+BoxChild
     historySearchEntry            = new Entry();
     historySearchEntry.CanFocus   = true;
     historySearchEntry.Name       = "historySearchEntry";
     historySearchEntry.IsEditable = true;
     historySearchHbox.Add(historySearchEntry);
     Box.BoxChild w20 = (Box.BoxChild)historySearchHbox[historySearchEntry];
     w20.Position = 1;
     historyTablVbox.Add(historySearchHbox);
     Box.BoxChild w21 = (Box.BoxChild)historyTablVbox[historySearchHbox];
     w21.Position = 0;
     w21.Expand   = false;
     w21.Fill     = false;
     // Container child historyTablVbox.Box+BoxChild
     historyScrolledWindow            = new ScrolledWindow();
     historyScrolledWindow.Name       = "historyScrolledWindow";
     historyScrolledWindow.ShadowType = ShadowType.In;
     // Container child historyScrolledWindow.Container+ContainerChild
     historyTreeview          = new TreeView();
     historyTreeview.CanFocus = true;
     historyTreeview.Name     = "historyTreeview";
     historyScrolledWindow.Add(historyTreeview);
     historyTablVbox.Add(historyScrolledWindow);
     Box.BoxChild w23 = (Box.BoxChild)historyTablVbox[historyScrolledWindow];
     w23.Position = 1;
     notebook.Add(historyTablVbox);
     Notebook.NotebookChild w24 = (Notebook.NotebookChild)notebook[historyTablVbox];
     w24.Position = 2;
     // Notebook tab
     historyTabLabel           = new Label();
     historyTabLabel.Name      = "historyTabLabel";
     historyTabLabel.LabelProp = "History";
     notebook.SetTabLabel(historyTablVbox, historyTabLabel);
     historyTabLabel.ShowAll();
     topLevelVbox.Add(notebook);
     Box.BoxChild w25 = (Box.BoxChild)topLevelVbox[notebook];
     w25.Position = 1;
     Add(topLevelVbox);
     if ((Child != null))
     {
         Child.ShowAll();
     }
     Show();
     DeleteEvent     += new DeleteEventHandler(OnDeleteEvent);
     button1.Clicked += new System.EventHandler(onNewCustomerClicked);
     button2.Clicked += new System.EventHandler(onNewApointmentButtonClicked);
     upcomingDropOffsTreeView.RowActivated += new RowActivatedHandler(onUpcomingDropOffsRowActivated);
     upcomingPickupsTreeview.RowActivated  += new RowActivatedHandler(onUpcomingPickupsRowActivated);
     customerSearchEntry.Changed           += new System.EventHandler(onCustomerSearchEntryChanged);
     customersTreeview.RowActivated        += new RowActivatedHandler(onCustomersRowActivated);
     historySearchEntry.Changed            += new System.EventHandler(onHistorySearchEntryChanged);
     historyTreeview.RowActivated          += new RowActivatedHandler(onHistoryRowActivated);
 }
コード例 #27
0
ファイル: ImageBrowser.cs プロジェクト: emtees/old-code
	public ImageFileFrame (FileInfo fileInfo)
		: base (fileInfo.Name)
	{
		string filename = String.Format ("{0}/{1}", fileInfo.DirectoryName, fileInfo.Name);

		Image image = new Image (filename);
		image.Scale (64, 64);
 		
		Frame inner_frame = new Frame (String.Empty);
				
		inner_frame.Add (image);
		//inner_frame.ShadowType = ShadowType.In;
		//inner_frame.BorderWidth = 10;
		this.Add (inner_frame);
		//this.ShadowType = ShadowType.Out;
	}		
コード例 #28
0
            private Frame GetCollectionDetailsFrame()
            {
                collectionEntry = new Entry ();
                ScrolledWindow scroll = new ScrolledWindow ();
                scroll.HscrollbarPolicy = PolicyType.Never;
                scroll.VscrollbarPolicy =
                    PolicyType.Automatic;

                description = new TextView ();
                description.WrapMode = WrapMode.Word;
                scroll.Add (description);

                addCollectionToggle =
                    new CheckButton (Catalog.
                             GetString
                             ("Create a collection"));
                addCollectionToggle.Toggled += OnToggled;
                addCollectionToggle.Active = false;
                addCollectionToggle.Toggle ();

                Frame frame = new Frame ();
                Table table = new Table (4, 2, false);
                Label label;
                uint row = 0;

                table.RowSpacing = table.ColumnSpacing = 4;

                table.Attach (addCollectionToggle, 0, 2, row,
                          row + 1);

                row++;
                label = new Label ();
                label.Markup =
                    Catalog.GetString ("<b>Title</b>");
                label.Xalign = 0;
                table.Attach (label, 0, 1, row, row + 1);
                table.Attach (collectionEntry, 1, 2, row,
                          row + 1);
                row++;
                label = new Label ();
                label.Xalign = 0;
                label.Markup =
                    Catalog.
                    GetString
                    ("<i><small>Create a collection with this title</small></i>");
                table.Attach (label, 0, 2, row, row + 1);

                label = new Label ();
                label.Markup =
                    Catalog.
                    GetString ("<b>Description</b>");
                label.Xalign = 0;
                row++;
                table.Attach (label, 0, 2, row, row + 1);

                row++;
                table.Attach (scroll, 0, 2, row, row + 1);
                frame.Add (table);
                return frame;
            }
コード例 #29
0
ファイル: HelperFrame.cs プロジェクト: Karnlie/almazovdata
        public static Frame AddMapButton(Frame parent, SpriteFont font, int x, int y, int w, int h, string img, string text, Action action)
        {
            var button = new Frame(parent.Game, x, y, w, h, text, Color.Zero)
            {
                Image = parent.Game.Content.Load<Texture2D>(img),
                ImageColor = Color.Orange,
                ImageMode = FrameImageMode.Stretched,
                Font = font,
                ImageOffsetX = 0,
                TextAlignment = Alignment.MiddleCenter,
                TextOffsetY = 0,
                TextOffsetX = 0,
                Anchor = FrameAnchor.Top | FrameAnchor.Left,
                ForeColor = Color.Red,
                TextEffect = TextEffect.Shadow
            };
            button.StatusChanged += (s, e) =>
            {
                if (e.Status == FrameStatus.None) { button.ImageColor = new Color(255, 255, 255, 128); button.ForeColor = Color.Black; button.BackColor = Color.Zero; }
                if (e.Status == FrameStatus.Hovered) { button.ImageColor = Color.Orange; button.ForeColor = Color.White; button.BackColor = Color.Zero; }
                if (e.Status == FrameStatus.Pushed) { button.ImageColor = Color.LightGray; button.ForeColor = Color.White; button.BackColor = Color.Zero; }
            };

            if (action != null)
            {
                button.Click += (s, e) => action();
            }
            parent.Add(button);
            return button;
        }
コード例 #30
0
ファイル: DownloadWindow.cs プロジェクト: markje153/ApsimX-1
        /// <summary>
        /// Adds the controls (buttons, checkbuttons, progress bars etc.) to the window.
        /// </summary>
        private void InitialiseWindow()
        {
            vboxPrimary = new VBox();
            HBox downloadDirectoryContainer = new HBox();

            // Checkbox initialisation
            includeDebugFiles = new CheckButton("Include Debugging Files");

            runAsync = new CheckButton("Download asynchronously")
            {
                TooltipText = "If this is disabled, the UI will be unresponsive for the duration of the download. On the other hand, this functionality has not been thoroughly tested. Use at your own risk.",
                Active      = false
            };

            chkDownloadResults = new CheckButton("Download results")
            {
                Active      = true,
                TooltipText = "Results will be downloaded if and only if this option is enabled."
            };
            chkDownloadResults.Toggled += DownloadResultsToggle;
            downloadResults             = true;

            unzipResults = new CheckButton("Unzip results")
            {
                Active      = true,
                TooltipText = "Check this option to automatically unzip the results."
            };
            unzipResults.Toggled += UnzipToggle;
            unzipResultFiles      = true;

            generateCsv = new CheckButton("Collate Results")
            {
                Active      = true,
                TooltipText = "Check this option to automatically combine results into a CSV file."
            };
            collateResults       = true;
            generateCsv.Toggled += GenerateCsvToggle;

            keepRawOutputs = new CheckButton("Keep raw output files")
            {
                Active      = true,
                TooltipText = "By default, the raw output files are deleted after being combined into a CSV. Check this option to keep the raw outputs."
            };

            unzipResults.Active = false;

            // Button initialisation
            btnDownload          = new Button("Download");
            btnDownload.Clicked += Download;

            btnChangeOutputDir          = new Button("...");
            btnChangeOutputDir.Clicked += ChangeOutputDir;

            entryOutputDir = new Entry((string)AzureSettings.Default["OutputDir"])
            {
                Sensitive = false
            };
            entryOutputDir.WidthChars = entryOutputDir.Text.Length;

            downloadDirectoryContainer.PackStart(new Label("Output Directory: "), false, false, 0);
            downloadDirectoryContainer.PackStart(entryOutputDir, true, true, 0);
            downloadDirectoryContainer.PackStart(btnChangeOutputDir, false, false, 0);

            // Put all form controls into the primary vbox
            vboxPrimary.PackStart(includeDebugFiles);
            vboxPrimary.PackStart(runAsync);
            vboxPrimary.PackStart(chkDownloadResults);
            vboxPrimary.PackStart(unzipResults);
            vboxPrimary.PackStart(generateCsv);
            vboxPrimary.PackStart(keepRawOutputs);
            vboxPrimary.PackStart(downloadDirectoryContainer);

            // This empty label will put a gap between the controls above it and below it.
            vboxPrimary.PackStart(new Label(""));

            vboxPrimary.PackEnd(btnDownload, false, false, 0);

            Frame primaryContainer = new Frame("Download Settings");

            primaryContainer.Add(vboxPrimary);
            Add(primaryContainer);
            ShowAll();
        }
コード例 #31
0
        Widget CreateExceptionHeader()
        {
            var icon = new ImageView(WarningIconPixbuf);

            icon.Yalign = 0;

            ExceptionTypeLabel = new Label {
                Xalign = 0.0f, Selectable = true, CanFocus = false
            };
            ExceptionMessageLabel = new Label {
                Wrap = true, Xalign = 0.0f, Selectable = true, CanFocus = false
            };
            ExceptionHelpLinkButton = new Button {
                HasFocus = true, Xalign = 0, Relief = ReliefStyle.None, BorderWidth = 0
            };
            ExceptionHelpLinkButton.Name = "exception_help_link_label";
            Gtk.Rc.ParseString(@"style ""exception-help-link-label""
{
	GtkWidget::link-color = ""#ffffff""
	GtkWidget::visited-link-color = ""#ffffff""
}
widget ""*.exception_help_link_label"" style ""exception-help-link-label""
");
            var textColor   = Styles.ExceptionCaughtDialog.HeaderTextColor.ToGdkColor();
            var headerColor = Styles.ExceptionCaughtDialog.HeaderBackgroundColor.ToGdkColor();

            ExceptionHelpLinkButton.ModifyBg(StateType.Selected, headerColor);

            ExceptionHelpLinkButton.Clicked       += ExceptionHelpLinkLabel_Clicked;
            ExceptionHelpLinkButton.KeyPressEvent += EventBoxLink_KeyPressEvent;

            ExceptionTypeLabel.ModifyFg(StateType.Normal, textColor);
            ExceptionMessageLabel.ModifyFg(StateType.Normal, textColor);
            ExceptionHelpLinkButton.ModifyFg(StateType.Normal, textColor);

            if (Platform.IsWindows)
            {
                ExceptionTypeLabel.ModifyFont(Pango.FontDescription.FromString("bold 19"));
                ExceptionMessageLabel.ModifyFont(Pango.FontDescription.FromString("10"));
                ExceptionHelpLinkButton.ModifyFont(Pango.FontDescription.FromString("10"));
            }
            else
            {
                ExceptionTypeLabel.ModifyFont(Pango.FontDescription.FromString("21"));
                ExceptionMessageLabel.ModifyFont(Pango.FontDescription.FromString("12"));
                ExceptionHelpLinkButton.ModifyFont(Pango.FontDescription.FromString("12"));
            }

            //Force rendering of background with EventBox
            var eventBox = new EventBox();
            var hBox     = new HBox();
            var leftVBox = new VBox();

            rightVBox = new VBox();
            leftVBox.PackStart(icon, false, false, (uint)(Platform.IsWindows ? 5 : 0));              // as we change frame.BorderWidth below, we need to compensate

            rightVBox.PackStart(ExceptionTypeLabel, false, false, (uint)(Platform.IsWindows ? 0 : 2));

            var exceptionHContainer = new HBox();

            exceptionHContainer.PackStart(ExceptionHelpLinkButton, false, false, 0);
            exceptionHContainer.PackStart(new Fixed(), true, true, 0);

            rightVBox.PackStart(ExceptionMessageLabel, true, true, (uint)(Platform.IsWindows ? 6 : 5));
            rightVBox.PackStart(exceptionHContainer, false, false, 2);

            hBox.PackStart(leftVBox, false, false, (uint)(Platform.IsWindows ? 5 : 0));              // as we change frame.BorderWidth below, we need to compensate
            hBox.PackStart(rightVBox, true, true, (uint)(Platform.IsWindows ? 5 : 10));

            var frame = new Frame();

            frame.Add(hBox);
            frame.BorderWidth = (uint)(Platform.IsWindows ? 5 : 10);             // on Windows we need to have smaller border due to ExceptionTypeLabel vertical misalignment
            frame.Shadow      = ShadowType.None;
            frame.ShadowType  = ShadowType.None;

            eventBox.Add(frame);
            eventBox.ShowAll();
            eventBox.ModifyBg(StateType.Normal, headerColor);

            return(eventBox);
        }
コード例 #32
0
        /// <summary>
        /// Initialises and populates the TreeView.
        /// </summary>
        /// <param name="columnNames">The names of the columns.</param>
        /// <param name="simulations">List of simulations. Each simulation is a tuple comprised of the simulation name, the list of factor levels, and an enabled/disabled flag.</param>
        public void Initialise(List <string> columnNames)
        {
            //primaryContainer = new HBox();
            //_mainWidget = primaryContainer;

            Type[] types = new Type[columnNames.Count];
            tree = new TreeView();
            tree.ButtonPressEvent += TreeClicked;
            columns = new List <TreeViewColumn>();
            cells   = new List <CellRendererText>();

            // initialise column headers
            for (int i = 0; i < columnNames.Count; i++)
            {
                types[i] = typeof(string);
                cells.Add(new CellRendererText());
                columns.Add(new TreeViewColumn {
                    Title = columnNames[i], Resizable = true, Sizing = TreeViewColumnSizing.GrowOnly
                });
                columns[i].PackStart(cells[i], false);
                columns[i].AddAttribute(cells[i], "text", i);
                columns[i].AddNotification("width", ColWidthChange);
                tree.AppendColumn(columns[i]);
            }

            store               = new ListStore(types);
            tree.Model          = store;
            tree.Selection.Mode = SelectionMode.Multiple;
            tree.RubberBanding  = true;
            tree.CanFocus       = true;
            tree.RulesHint      = true;
            string style = "style \"custom-treestyle\"{ GtkTreeView::odd-row-color = \"#ECF2FD\" GtkTreeView::even-row-color = \"#FFFFFF\" GtkTreeView::allow-rules = 1 } widget \"*custom_treeview*\" style \"custom-treestyle\"";

            tree.Name = "custom_treeview";
            Rc.ParseString(style);

            btnEnable          = new Button("Enable");
            btnEnable.Clicked += (sender, e) => { BtnToggle(true); };
            HBox enableButtonContainer = new HBox();

            enableButtonContainer.PackStart(btnEnable, true, true, 0);

            btnDisable          = new Button("Disable");
            btnDisable.Clicked += (sender, e) => { BtnToggle(false); };
            HBox disableButtonContainer = new HBox();

            disableButtonContainer.PackStart(btnDisable, true, true, 0);

            btnExportCsv          = new Button("Generate CSV");
            btnExportCsv.Clicked += (sender, e) => { Presenter.GenerateCsv(AskUserForFileName("Export to CSV", "CSV file | .csv", Gtk.FileChooserAction.Save, (string)ApsimNG.Properties.Settings.Default["OutputDir"])); };
            HBox csvExportButtonContainer = new HBox();

            csvExportButtonContainer.PackStart(btnExportCsv, true, true, 0);

            btnImportCsv          = new Button("Import factor information from CSV file");
            btnImportCsv.Clicked += (sender, e) => { Presenter.ImportCsv(AskUserForFileName("Choose a .csv file", "CSV file | *.csv")); };
            HBox csvImportButtonCOntainer = new HBox();

            csvImportButtonCOntainer.PackStart(btnImportCsv, true, true, 0);

            btnSobol           = new Button("Sobol Analysis");
            btnSobol.Clicked  += (sender, e) => { Presenter.Sobol(); };
            btnSobol.Sensitive = false;

            btnMorris           = new Button("Morris method analysis");
            btnMorris.Clicked  += (sender, e) => { Presenter.Morris(); };
            btnMorris.Sensitive = false;

            VBox sensitivityContainer = new VBox();

            sensitivityContainer.PackStart(btnSobol, false, false, 0);
            sensitivityContainer.PackStart(btnMorris, false, false, 0);

            Frame analysis = new Frame("Sensitivity Analysis");

            analysis.Add(sensitivityContainer);

            entryMaxSims        = new Entry(Presenters.FactorControlPresenter.DEFAULT_MAX_SIMS.ToString());
            btnMaxSims          = new Button("Apply");
            btnMaxSims.Clicked += BtnMaxSims_Click;

            HBox maxSimsContainer = new HBox();

            maxSimsContainer.PackStart(entryMaxSims, true, true, 0);
            maxSimsContainer.PackStart(btnMaxSims, false, false, 0);

            lblNumSims = new Label {
                Xalign = 0f
            };

            VBox controlsContainer = new VBox();

            controlsContainer.PackStart(new Label("Max number of simulations to display:"), false, false, 0);
            controlsContainer.PackStart(maxSimsContainer, false, false, 0);
            controlsContainer.PackStart(new Label(""), false, false, 0);
            controlsContainer.PackStart(enableButtonContainer, false, false, 0);
            controlsContainer.PackStart(disableButtonContainer, false, false, 0);
            controlsContainer.PackStart(csvExportButtonContainer, false, false, 0);
            controlsContainer.PackStart(csvImportButtonCOntainer, false, false, 0);
            controlsContainer.PackStart(new Label(""), false, false, 0);
            controlsContainer.PackStart(analysis, false, false, 0);
            controlsContainer.PackEnd(lblNumSims, false, false, 0);

            //(((Presenter.explorerPresenter.GetView().MainWidget as VBox).Children[1] as HPaned).Child2 as ScrolledWindow).HscrollbarPolicy = PolicyType.Always;
            ScrolledWindow sw = new ScrolledWindow();

            sw.Add(tree);
            sw.HscrollbarPolicy = PolicyType.Automatic;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            //Frame test = new Frame("Factor Control");
            //test.Add(sw);

            AccelGroup agr = new AccelGroup();

            entryMaxSims.AddAccelerator("activate", agr, new AccelKey(Gdk.Key.Return, Gdk.ModifierType.ControlMask, AccelFlags.Visible));
            entryMaxSims.Activated += BtnMaxSims_Click;
            Application.Invoke(delegate
            {
                primaryContainer.PackStart(sw, true, true, 0);
                primaryContainer.PackStart(controlsContainer, false, false, 0);

                primaryContainer.ShowAll();
            });

            contextMenu           = new Menu();
            run                   = new MenuItem("Run this simulation");
            run.ButtonPressEvent += RunSim;
            contextMenu.Add(run);
        }
コード例 #33
0
        public PhotoView(IBrowsableCollection query)
        {
            Query = query;

            commit_delay = new DelayedOperation(1000, new GLib.IdleHandler(CommitPendingChanges));
            Destroyed   += HandleDestroy;

            Name = "ImageContainer";
            Box vbox = new VBox(false, 6);

            Add(vbox);

            background = new EventBox();
            Frame frame = new Frame();

            background.Add(frame);

            frame.ShadowType = ShadowType.In;
            vbox.PackStart(background, true, true, 0);

            inner_vbox = new VBox(false, 2);
            inner_hbox = new HBox(false, 2);

            frame.Add(inner_hbox);

            BrowsablePointer bp = new BrowsablePointer(query, -1);

            View = new PhotoImageView(bp);

            filmstrip             = new Filmstrip(bp);
            filmstrip.ThumbOffset = 1;
            filmstrip.Spacing     = 4;
            filmstrip.ThumbSize   = 75;
            PlaceFilmstrip((Orientation)Preferences.Get <int> (Preferences.FILMSTRIP_ORIENTATION), true);

            View.PhotoChanged += HandlePhotoChanged;

            photo_view_scrolled = new ScrolledWindow(null, null);

            photo_view_scrolled.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            photo_view_scrolled.ShadowType = ShadowType.None;
            photo_view_scrolled.Add(View);
            photo_view_scrolled.Child.ButtonPressEvent += HandleButtonPressEvent;
            View.AddEvents((int)EventMask.KeyPressMask);
            inner_vbox.PackStart(photo_view_scrolled, true, true, 0);
            inner_hbox.PackStart(inner_vbox, true, true, 0);

            HBox lower_hbox = new HBox(false, 2);

            //inner_hbox.BorderWidth = 6;

            tag_view = new TagView();
            lower_hbox.PackStart(tag_view, false, true, 0);

            Label comment = new Label(Catalog.GetString("Description:"));

            lower_hbox.PackStart(comment, false, false, 0);
            description_entry = new Entry();
            lower_hbox.PackStart(description_entry, true, true, 0);
            description_entry.Changed += HandleDescriptionChanged;

            rating = new RatingEntry {
                HasFrame             = false,
                AlwaysShowEmptyStars = true
            };
            lower_hbox.PackStart(rating, false, false, 0);
            rating.Changed += HandleRatingChanged;

            SetColors();

            inner_vbox.PackStart(lower_hbox, false, true, 0);

            vbox.ShowAll();

            Realized += (o, e) => SetColors();
            Preferences.SettingChanged += OnPreferencesChanged;
        }
コード例 #34
0
        public static void CreateFrames()
        {
            // Set up the non-empty layer data we'll use.
            Bond.IBonded goodLayerObject = new Bond.Bonded <Dummy>(dummyObject);
            var          outputBuffer    = new OutputBuffer();
            var          compactWriter   = new CompactBinaryWriter <OutputBuffer>(outputBuffer);

            compactWriter.WriteVersion();
            goodLayerObject.Serialize(compactWriter);
            goodLayerData = outputBuffer.Data;

            // Good frames, from which we can pull good framelets to build bad frames.
            goodRequestFrame = EpoxyConnection.MessageToFrame(
                GoodRequestId, GoodService, GoodMethod, EpoxyMessageType.REQUEST, meaninglessPayload, null, LoggerTests.BlackHole);
            goodRequestLayerDataFrame = EpoxyConnection.MessageToFrame(
                GoodRequestId, GoodService, GoodMethod, EpoxyMessageType.REQUEST, meaninglessPayload, goodLayerObject, LoggerTests.BlackHole);

            goodResponseFrame = EpoxyConnection.MessageToFrame(
                GoodResponseId, GoodService, GoodMethod, EpoxyMessageType.RESPONSE, meaninglessPayload, null, LoggerTests.BlackHole);
            goodErrorResponseFrame = EpoxyConnection.MessageToFrame(
                GoodResponseId, GoodService, GoodMethod, EpoxyMessageType.RESPONSE, meaninglessError, null, LoggerTests.BlackHole);

            goodEventFrame = EpoxyConnection.MessageToFrame(
                GoodRequestId, GoodService, GoodMethod, EpoxyMessageType.EVENT, meaninglessPayload, null, LoggerTests.BlackHole);

            configFrame        = EpoxyConnection.MakeConfigFrame(LoggerTests.BlackHole);
            protocolErrorFrame = EpoxyConnection.MakeProtocolErrorFrame(MeaninglessErrorCode, null, LoggerTests.BlackHole);

            var goodFrameletCount = goodRequestFrame.Count;

            // Bad frames made of good framelets.
            shortRequestFrame = new Frame(goodFrameletCount - 1, LoggerTests.BlackHole);
            for (var i = 0; i < goodFrameletCount - 1; i++)
            {
                shortRequestFrame.Add(goodRequestFrame.Framelets[i]);
            }

            doubleHeadersRequestFrame = new Frame(goodFrameletCount + 1, LoggerTests.BlackHole);
            doubleHeadersRequestFrame.Add(goodRequestFrame.Framelets[0]);
            for (var i = 0; i < goodFrameletCount; i++)
            {
                doubleHeadersRequestFrame.Add(goodRequestFrame.Framelets[i]);
            }

            headersConfigRequestFrame = new Frame(2, LoggerTests.BlackHole);
            headersConfigRequestFrame.Add(goodRequestFrame.Framelets[0]);
            headersConfigRequestFrame.Add(configFrame.Framelets[0]);

            doublePayloadRequestFrame = new Frame(goodFrameletCount + 1, LoggerTests.BlackHole);
            for (var i = 0; i < goodFrameletCount; i++)
            {
                doublePayloadRequestFrame.Add(goodRequestFrame.Framelets[i]);
            }
            doublePayloadRequestFrame.Add(goodRequestFrame.Framelets[goodFrameletCount - 1]);

            backwardsRequestFrame = new Frame(goodFrameletCount, LoggerTests.BlackHole);
            foreach (var framelet in goodRequestFrame.Framelets.Reverse())
            {
                backwardsRequestFrame.Add(framelet);
            }

            doubleProtocolErrorFrame = EpoxyConnection.MakeProtocolErrorFrame(MeaninglessErrorCode, null, LoggerTests.BlackHole);
            doubleProtocolErrorFrame.Add(doubleProtocolErrorFrame.Framelets[0]);

            configFrameExtra = EpoxyConnection.MakeConfigFrame(LoggerTests.BlackHole);
            configFrameExtra.Add(goodRequestFrame.Framelets[0]);

            // Bad frames made of bad framelets.
            var invalidConfigData = new ArraySegment <byte>(new byte[] { 0x01 });

            configFrameBadConfigData = new Frame(1, LoggerTests.BlackHole);
            configFrameBadConfigData.Add(new Framelet(FrameletType.EpoxyConfig, invalidConfigData));
        }
コード例 #35
0
ファイル: FrameTest.cs プロジェクト: aloneplayer/BenProjects
 public void TestAddOneThrow()
 {
     Frame f = new Frame();
     f.Add(5);
     Assert.AreEqual(5, f.Score);
 }
コード例 #36
0
ファイル: IntellisenseView.cs プロジェクト: jcbowden/ApsimX
        /// <summary>
        /// Default constructor. Initialises intellisense popup, but doesn't display anything.
        /// </summary>
        public IntellisenseView()
        {
            completionForm = new Window(WindowType.Toplevel)
            {
                HeightRequest   = 300,
                WidthRequest    = 750,
                Decorated       = false,
                SkipPagerHint   = true,
                SkipTaskbarHint = true,
            };

            Frame completionFrame = new Frame();

            completionForm.Add(completionFrame);

            ScrolledWindow completionScroller = new ScrolledWindow();

            completionFrame.Add(completionScroller);

            completionModel = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            completionView  = new Gtk.TreeView(completionModel);
            completionScroller.Add(completionView);

            TreeViewColumn column = new TreeViewColumn()
            {
                Title     = "Item",
                Resizable = true,
            };
            CellRendererPixbuf iconRender = new CellRendererPixbuf();

            column.PackStart(iconRender, false);
            CellRendererText textRender = new CellRendererText()
            {
                Editable   = false,
                WidthChars = 25,
                Ellipsize  = Pango.EllipsizeMode.End
            };

            column.PackStart(textRender, true);
            column.SetAttributes(iconRender, "pixbuf", 0);
            column.SetAttributes(textRender, "text", 1);
            completionView.AppendColumn(column);

            textRender = new CellRendererText()
            {
                Editable   = false,
                WidthChars = 10,
                Ellipsize  = Pango.EllipsizeMode.End
            };
            column = new TreeViewColumn("Units", textRender, "text", 2)
            {
                Resizable = true
            };
            completionView.AppendColumn(column);

            textRender = new CellRendererText()
            {
                Editable   = false,
                WidthChars = 15,
                Ellipsize  = Pango.EllipsizeMode.End
            };
            column = new TreeViewColumn("Type", textRender, "text", 3)
            {
                Resizable = true
            };
            completionView.AppendColumn(column);

            textRender = new CellRendererText()
            {
                Editable = false,
            };
            column = new TreeViewColumn("Descr", textRender, "text", 4)
            {
                Resizable = true
            };
            completionView.AppendColumn(column);

            completionView.HasTooltip        = true;
            completionView.TooltipColumn     = 5;
            completionForm.FocusOutEvent    += OnLeaveCompletion;
            completionView.ButtonPressEvent += OnButtonPress;
            completionView.KeyPressEvent    += OnContextListKeyDown;
            completionView.KeyReleaseEvent  += OnKeyRelease;
        }
コード例 #37
0
        public ExampleListView() : base(true, (int)AppSettings.Margin)
        {
            Examples = new List <Example>();

            var exampleListContainer = new VBox(true, (int)AppSettings.Margin);

            exampleList = new ScrolledWindow();
            exampleList.Add(new Label("No examples"));
            exampleListContainer.PackStart(
                exampleList, true, true, AppSettings.Margin
                );
            PackStart(exampleListContainer, true, true, AppSettings.Margin);

            var exampleCreatorCont   = new Frame("Create New Example");
            var exampleCreatorScroll = new ScrolledWindow();
            var exampleCreator       = new VBox(true, 0);

            exampleCreator.PackStart(
                new Label("Romanization:"), false, false, 0
                );
            var romInput = new Entry();

            exampleCreator.PackStart(romInput, false, false, 0);
            exampleCreator.PackStart(
                new Label("IPA:"), false, false, 0
                );
            var ipaInput = new Entry();

            exampleCreator.PackStart(ipaInput, false, false, 0);
            exampleCreator.PackStart(
                new Label("Gloss:"), false, false, 0
                );
            var glossInput = new Entry();

            exampleCreator.PackStart(glossInput, false, false, 0);
            exampleCreator.PackStart(
                new Label("Translation:"), false, false, 0
                );
            var transInput = new Entry();

            exampleCreator.PackStart(transInput, false, false, 0);
            var submitButton = new Button("Submit");

            submitButton.Clicked += (object sender, EventArgs args) => {
                Examples.Add(new Example {
                    Romanization = romInput.Buffer.Text,
                    Ipa          = ipaInput.Buffer.Text,
                    Gloss        = glossInput.Buffer.Text,
                    Translation  = transInput.Buffer.Text
                });
                romInput.Buffer.Text   = "";
                ipaInput.Buffer.Text   = "";
                glossInput.Buffer.Text = "";
                transInput.Buffer.Text = "";
                updateExampleList();
            };
            exampleCreator.PackStart(
                submitButton, false, false, 0
                );
            exampleCreatorScroll.Add(exampleCreator);
            exampleCreatorCont.Add(exampleCreatorScroll);
            PackStart(exampleCreatorCont, true, true, AppSettings.Margin);
        }
コード例 #38
0
        private void InitUI()
        {
            try
            {
                //Init Local Vars
                _article = (_dataSourceRow as FIN_Article);

                if (_dialogMode != DialogMode.Insert)
                {
                    //Get totalNumberOfFinanceDocuments to check if article has already used in Finance Documents, to protect name changes etc
                    string sql       = string.Format("SELECT COUNT(*) as Count FROM fin_documentfinancedetail WHERE Article = '{0}';", _article.Oid);
                    var    sqlResult = GlobalFramework.SessionXpo.ExecuteScalar(sql);
                    _totalNumberOfFinanceDocuments = Convert.ToUInt16(sqlResult);
                }

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Tab1
                VBox vboxTab1 = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };

                //Ord
                Entry       entryOrd = new Entry();
                BOWidgetBox boxLabel = new BOWidgetBox(Resx.global_record_order, entryOrd);
                vboxTab1.PackStart(boxLabel, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true));

                //Code
                Entry       entryCode = new Entry();
                BOWidgetBox boxCode   = new BOWidgetBox(Resx.global_record_code, entryCode);
                vboxTab1.PackStart(boxCode, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexAlfaNumericArticleCode, true));

                //CodeDealer
                Entry       entryCodeDealer = new Entry();
                BOWidgetBox boxCodeDealer   = new BOWidgetBox(Resx.global_record_code_dealer, entryCodeDealer);
                vboxTab1.PackStart(boxCodeDealer, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCodeDealer, _dataSourceRow, "CodeDealer", SettingsApp.RegexAlfaNumeric, false));

                //Designation
                Entry       entryDesignation = new Entry();
                BOWidgetBox boxDesignation   = new BOWidgetBox(Resx.global_designation, entryDesignation);
                vboxTab1.PackStart(boxDesignation, false, false, 0);
                // Changed from RegexAlfaNumeric to  RegexAlfaNumericExtended 2017-1011
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDesignation, _dataSourceRow, "Designation", SettingsApp.RegexAlfaNumericExtended, true));

                //ButtonLabel
                Entry       entryButtonLabel = new Entry();
                BOWidgetBox boxButtonLabel   = new BOWidgetBox(Resx.global_button_name, entryButtonLabel);
                vboxTab1.PackStart(boxButtonLabel, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxButtonLabel, _dataSourceRow, "ButtonLabel", SettingsApp.RegexAlfaNumericArticleButtonLabel, false));

                //Family
                _xpoComboBoxFamily = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleFamily), (DataSourceRow as FIN_Article).Family, "Designation");
                BOWidgetBox boxFamily = new BOWidgetBox(Resx.global_article_family, _xpoComboBoxFamily);
                vboxTab1.PackStart(boxFamily, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxFamily, DataSourceRow, "Family", SettingsApp.RegexGuid, true));

                //SubFamily
                _xpoComboBoxSubFamily = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleSubFamily), (DataSourceRow as FIN_Article).SubFamily, "Designation");
                BOWidgetBox boxSubFamily = new BOWidgetBox(Resx.global_article_subfamily, _xpoComboBoxSubFamily);
                vboxTab1.PackStart(boxSubFamily, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxSubFamily, DataSourceRow, "SubFamily", SettingsApp.RegexGuid, true));

                //Type
                XPOComboBox xpoComboBoxType = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleType), (DataSourceRow as FIN_Article).Type, "Designation");
                BOWidgetBox boxType         = new BOWidgetBox(Resx.global_article_type, xpoComboBoxType);
                vboxTab1.PackStart(boxType, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxType, DataSourceRow, "Type", SettingsApp.RegexGuid, true));

                //ButtonImage
                FileChooserButton fileChooserButtonImage = new FileChooserButton(string.Empty, FileChooserAction.Open)
                {
                    HeightRequest = 23
                };
                Image fileChooserImagePreviewButtonImage = new Image()
                {
                    WidthRequest = _sizefileChooserPreview.Width, HeightRequest = _sizefileChooserPreview.Height
                };
                Frame fileChooserFrameImagePreviewButtonImage = new Frame();
                fileChooserFrameImagePreviewButtonImage.ShadowType = ShadowType.None;
                fileChooserFrameImagePreviewButtonImage.Add(fileChooserImagePreviewButtonImage);
                fileChooserButtonImage.SetFilename(((FIN_Article)DataSourceRow).ButtonImage);
                fileChooserButtonImage.Filter            = Utils.GetFileFilterImages();
                fileChooserButtonImage.SelectionChanged += (sender, eventArgs) => fileChooserImagePreviewButtonImage.Pixbuf = Utils.ResizeAndCropFileToPixBuf((sender as FileChooserButton).Filename, new System.Drawing.Size(fileChooserImagePreviewButtonImage.WidthRequest, fileChooserImagePreviewButtonImage.HeightRequest));
                BOWidgetBox boxfileChooserButtonImage = new BOWidgetBox(Resx.global_button_image, fileChooserButtonImage);
                HBox        hboxfileChooserAndimagePreviewButtonImage = new HBox(false, _boxSpacing);
                hboxfileChooserAndimagePreviewButtonImage.PackStart(boxfileChooserButtonImage, true, true, 0);
                hboxfileChooserAndimagePreviewButtonImage.PackStart(fileChooserFrameImagePreviewButtonImage, false, false, 0);
                vboxTab1.PackStart(hboxfileChooserAndimagePreviewButtonImage, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxfileChooserButtonImage, _dataSourceRow, "ButtonImage", string.Empty, false));

                //Favorite
                CheckButton checkButtonFavorite = new CheckButton(Resx.global_favorite);
                vboxTab1.PackStart(checkButtonFavorite, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonFavorite, _dataSourceRow, "Favorite"));

                //UseWeighingBalance
                CheckButton checkButtonUseWeighingBalance = new CheckButton(Resx.global_use_weighing_balance);
                vboxTab1.PackStart(checkButtonUseWeighingBalance, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonUseWeighingBalance, _dataSourceRow, "UseWeighingBalance"));

                //Disabled
                CheckButton checkButtonDisabled = new CheckButton(Resx.global_record_disabled);
                if (_dialogMode == DialogMode.Insert)
                {
                    checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled;
                }
                vboxTab1.PackStart(checkButtonDisabled, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled"));

                //Append Tab
                _notebook.AppendPage(vboxTab1, new Label(Resx.global_record_main_detail));

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Tab2
                _vboxTab2 = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };

                int col1width = 100, col2width = 90, col3width = col2width, col4width = 160;

                //hboxPrices
                Label labelPriceEmpty = new Label(string.Empty)
                {
                    WidthRequest = col1width
                };
                Label labelPriceNormal = new Label(Resx.article_normal_price)
                {
                    WidthRequest = col2width
                };
                Label labelPricePromotion = new Label(Resx.article_promotion_price)
                {
                    WidthRequest = col3width
                };
                Label labelPriceUsePromotionPrice = new Label(Resx.article_use_promotion_price)
                {
                    WidthRequest = col4width
                };
                labelPriceNormal.SetAlignment(0.0F, 0.5F);
                labelPricePromotion.SetAlignment(0.0F, 0.5F);
                labelPriceUsePromotionPrice.SetAlignment(0.0F, 0.5F);

                VBox vboxPrices = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };
                HBox hboxPrices = new HBox(false, _boxSpacing);
                hboxPrices.PackStart(labelPriceEmpty, true, true, 0);
                hboxPrices.PackStart(labelPriceNormal, false, false, 0);
                hboxPrices.PackStart(labelPricePromotion, false, false, 0);
                hboxPrices.PackStart(labelPriceUsePromotionPrice, false, false, 0);
                //PackIt VBox
                vboxPrices.PackStart(hboxPrices, false, false, 0);

                //Get PriceType Collection : Require Criteria to exclude SettingsApp.XpoOidUndefinedRecord, else we get a Price0 here
                CriteriaOperator criteriaOperator          = CriteriaOperator.Parse(string.Format("(Disabled IS NULL OR Disabled  <> 1) OR (Oid <> '{0}')", SettingsApp.XpoOidUndefinedRecord));
                XPCollection     xpcConfigurationPriceType = new XPCollection(DataSourceRow.Session, typeof(FIN_ConfigurationPriceType), criteriaOperator);

                xpcConfigurationPriceType.Sorting = FrameworkUtils.GetXPCollectionDefaultSortingCollection();
                //Define Max 5 Rows : 5 Prices
                int priceTypeCount = (xpcConfigurationPriceType.Count > 5) ? 5 : xpcConfigurationPriceType.Count;

                //Loop and Render Columns
                for (int i = 0; i < priceTypeCount; i++)
                {
                    int priceTypeIndex = ((FIN_ConfigurationPriceType)xpcConfigurationPriceType[i]).EnumValue;

                    //FieldNames
                    string fieldNamePriceNormal            = string.Format("Price{0}", priceTypeIndex);
                    string fieldNamePricePromotion         = string.Format("Price{0}Promotion", priceTypeIndex);
                    string fieldNamePriceUsePromotionPrice = string.Format("Price{0}UsePromotionPrice", priceTypeIndex);
                    //PriceType
                    Label labelPriceType = new Label(((FIN_ConfigurationPriceType)xpcConfigurationPriceType[i]).Designation)
                    {
                        WidthRequest = col1width
                    };
                    labelPriceType.SetAlignment(0.0F, 0.5F);

                    //Entrys
                    Entry entryPriceNormal = new Entry()
                    {
                        WidthRequest = col2width
                    };
                    Entry entryPricePromotion = new Entry()
                    {
                        WidthRequest = col3width
                    };
                    _crudWidgetList.Add(new GenericCRUDWidgetXPO(entryPriceNormal, _dataSourceRow, fieldNamePriceNormal, SettingsApp.RegexDecimalGreaterEqualThanZero, true));
                    _crudWidgetList.Add(new GenericCRUDWidgetXPO(entryPricePromotion, _dataSourceRow, fieldNamePricePromotion, SettingsApp.RegexDecimalGreaterEqualThanZero, true));
                    //UsePromotion
                    CheckButton checkButtonUsePromotion = new CheckButton(string.Empty)
                    {
                        WidthRequest = col4width
                    };
                    _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonUsePromotion, _dataSourceRow, fieldNamePriceUsePromotionPrice));
                    //PackIt
                    hboxPrices = new HBox(false, _boxSpacing);
                    hboxPrices.PackStart(labelPriceType, true, true, 0);
                    hboxPrices.PackStart(entryPriceNormal, false, false, 0);
                    hboxPrices.PackStart(entryPricePromotion, false, false, 0);
                    hboxPrices.PackStart(checkButtonUsePromotion, false, false, 0);
                    //PackIt VBox
                    vboxPrices.PackStart(hboxPrices, false, false, 0);
                }
                _vboxTab2.PackStart(vboxPrices, false, false, 0);

                //PVPVariable
                CheckButton checkButtonPVPVariable = new CheckButton(Resx.global_variable_price);
                _vboxTab2.PackStart(checkButtonPVPVariable, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonPVPVariable, _dataSourceRow, "PVPVariable"));

                //PriceWithVat
                CheckButton checkButtonPriceWithVat = new CheckButton(Resx.global_price_with_vat);
                _vboxTab2.PackStart(checkButtonPriceWithVat, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonPriceWithVat, _dataSourceRow, "PriceWithVat"));

                //Discount
                Entry       entryDiscount = new Entry();
                BOWidgetBox boxDiscount   = new BOWidgetBox(Resx.global_discount, entryDiscount);
                _vboxTab2.PackStart(boxDiscount, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscount, _dataSourceRow, "Discount", SettingsApp.RegexPercentage, false));

                //Class
                XPOComboBox xpoComboBoxClass = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ArticleClass), (DataSourceRow as FIN_Article).Class, "Designation");
                BOWidgetBox boxClass         = new BOWidgetBox(Resx.global_article_class, xpoComboBoxClass);
                _vboxTab2.PackStart(boxClass, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxClass, DataSourceRow, "Class", SettingsApp.RegexGuid, true));

                //Normal App Mode
                if (SettingsApp.AppMode == AppOperationMode.Default)
                {
                    //VatOnTable
                    _xpoComboBoxVatOnTable = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatRate), (DataSourceRow as FIN_Article).VatOnTable, "Designation");
                    BOWidgetBox boxVatOnTable = new BOWidgetBox(Resx.global_vat_on_table, _xpoComboBoxVatOnTable);
                    _vboxTab2.PackStart(boxVatOnTable, false, false, 0);
                    _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatOnTable, DataSourceRow, "VatOnTable", SettingsApp.RegexGuid, true));
                }

                //VatDirectSelling
                _xpoComboBoxVatDirectSelling = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatRate), (DataSourceRow as FIN_Article).VatDirectSelling, "Designation");
                BOWidgetBox boxVatDirectSelling = new BOWidgetBox(Resx.global_vat_direct_selling, _xpoComboBoxVatDirectSelling);
                _vboxTab2.PackStart(boxVatDirectSelling, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatDirectSelling, DataSourceRow, "VatDirectSelling", SettingsApp.RegexGuid, true));

                //VatExemptionReason
                _xpoComboBoxVatExemptionReason = new XPOComboBox(DataSourceRow.Session, typeof(FIN_ConfigurationVatExemptionReason), (DataSourceRow as FIN_Article).VatExemptionReason, "Designation");
                BOWidgetBox boxVatExemptionReason = new BOWidgetBox(Resx.global_vat_exemption_reason, _xpoComboBoxVatExemptionReason);
                _vboxTab2.PackStart(boxVatExemptionReason, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxVatExemptionReason, DataSourceRow, "VatExemptionReason", SettingsApp.RegexGuid, true));

                //Append Tab
                _notebook.AppendPage(_vboxTab2, new Label(Resx.dialog_edit_article_tab2_label));

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Tab3
                VBox vboxTab3 = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };

                //BarCode
                Entry       entryBarCode = new Entry();
                BOWidgetBox boxBarCode   = new BOWidgetBox(Resx.global_barcode, entryBarCode);
                vboxTab3.PackStart(boxBarCode, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxBarCode, _dataSourceRow, "BarCode", SettingsApp.RegexEan12andEan4, false));

                //Accounting
                Entry       entryAccounting = new Entry();
                BOWidgetBox boxAccounting   = new BOWidgetBox(Resx.global_accounting, entryAccounting);
                vboxTab3.PackStart(boxAccounting, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxAccounting, _dataSourceRow, "Accounting", SettingsApp.RegexDecimal, false));

                //Tare
                Entry       entryTare = new Entry();
                BOWidgetBox boxTare   = new BOWidgetBox(Resx.global_tare, entryTare);
                vboxTab3.PackStart(boxTare, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxTare, _dataSourceRow, "Tare", SettingsApp.RegexDecimal, false));

                //Weight
                Entry       entryWeight = new Entry();
                BOWidgetBox boxWeight   = new BOWidgetBox(Resx.global_weight, entryWeight);
                vboxTab3.PackStart(boxWeight, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxWeight, _dataSourceRow, "Weight", SettingsApp.RegexDecimal, false));

                //DefaultQuantity
                Entry       entryDefaultQuantity = new Entry();
                BOWidgetBox boxDefaultQuantity   = new BOWidgetBox(Resx.global_article_default_quantity, entryDefaultQuantity);
                vboxTab3.PackStart(boxDefaultQuantity, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDefaultQuantity, _dataSourceRow, "DefaultQuantity", SettingsApp.RegexDecimal, false));

                //UnitMeasure
                XPOComboBox xpoComboBoxUnitMeasure = new XPOComboBox(DataSourceRow.Session, typeof(CFG_ConfigurationUnitMeasure), (DataSourceRow as FIN_Article).UnitMeasure, "Designation");
                BOWidgetBox boxUnitMeasure         = new BOWidgetBox(Resx.global_unit_measure, xpoComboBoxUnitMeasure);
                vboxTab3.PackStart(boxUnitMeasure, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxUnitMeasure, DataSourceRow, "UnitMeasure", SettingsApp.RegexGuid, true));

                //UnitSize
                XPOComboBox xpoComboBoxUnitSize = new XPOComboBox(DataSourceRow.Session, typeof(CFG_ConfigurationUnitSize), (DataSourceRow as FIN_Article).UnitSize, "Designation");
                BOWidgetBox boxUnitSize         = new BOWidgetBox(Resx.global_unit_size, xpoComboBoxUnitSize);
                vboxTab3.PackStart(boxUnitSize, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxUnitSize, DataSourceRow, "UnitSize", SettingsApp.RegexGuid, true));

                //Printer
                XPOComboBox xpoComboBoxPrinter = new XPOComboBox(DataSourceRow.Session, typeof(SYS_ConfigurationPrinters), (DataSourceRow as FIN_Article).Printer, "Designation");
                BOWidgetBox boxPrinter         = new BOWidgetBox(Resx.global_device_printer, xpoComboBoxPrinter);
                vboxTab3.PackStart(boxPrinter, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPrinter, DataSourceRow, "Printer", SettingsApp.RegexGuid, false));

                //Template
                XPOComboBox xpoComboBoxTemplate = new XPOComboBox(DataSourceRow.Session, typeof(SYS_ConfigurationPrintersTemplates), (DataSourceRow as FIN_Article).Template, "Designation");
                BOWidgetBox boxTemplate         = new BOWidgetBox(Resx.global_ConfigurationPrintersTemplates, xpoComboBoxTemplate);
                vboxTab3.PackStart(boxTemplate, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxTemplate, DataSourceRow, "Template", SettingsApp.RegexGuid, false));

                if (GlobalApp.ScreenSize.Width > 800 && GlobalApp.ScreenSize.Height > 600)
                {
                    //CommissionGroup
                    XPOComboBox xpoComboBoxCommissionGroup = new XPOComboBox(DataSourceRow.Session, typeof(POS_UserCommissionGroup), (DataSourceRow as FIN_Article).CommissionGroup, "Designation");
                    BOWidgetBox boxCommissionGroup         = new BOWidgetBox(Resx.global_commission_group, xpoComboBoxCommissionGroup);
                    vboxTab3.PackStart(boxCommissionGroup, false, false, 0);
                    _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCommissionGroup, DataSourceRow, "CommissionGroup", SettingsApp.RegexGuid, false));

                    //DiscountGroup
                    XPOComboBox xpoComboBoxDiscountGroup = new XPOComboBox(DataSourceRow.Session, typeof(ERP_CustomerDiscountGroup), (DataSourceRow as FIN_Article).DiscountGroup, "Designation");
                    BOWidgetBox boxDiscountGroup         = new BOWidgetBox(Resx.global_discount_group, xpoComboBoxDiscountGroup);
                    vboxTab3.PackStart(boxDiscountGroup, false, false, 0);
                    _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDiscountGroup, DataSourceRow, "DiscountGroup", SettingsApp.RegexGuid, false));
                }

                //Append Tab
                _notebook.AppendPage(vboxTab3, new Label(Resx.dialog_edit_article_tab3_label));

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Enable/Disable Components
                entryDesignation.Sensitive = (_totalNumberOfFinanceDocuments > 0) ? false : true;

                //Show or Hide vboxTab2
                if (_article.Type != null)
                {
                    _vboxTab2.Visible = _article.Type.HavePrice;
                }

                //Assign Initial Value for Family
                DefineInitialValueForXpoComboBoxFamily();
                //Call UI Update for VatExemptionReason
                UpdateUIVatExemptionReason();

                //Events
                _xpoComboBoxFamily.Changed           += xpoComboBoxFamily_Changed;
                xpoComboBoxType.Changed              += xpoComboBoxType_Changed;
                _xpoComboBoxVatDirectSelling.Changed += xpoComboBoxVatDirectSelling_Changed;
                if (_xpoComboBoxVatOnTable != null)
                {
                    _xpoComboBoxVatOnTable.Changed += xpoComboBoxVatDirectSelling_Changed;
                }
            }
            catch (System.Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
コード例 #39
0
ファイル: AddViewDialog.cs プロジェクト: slagusev/monodevelop
        void Build()
        {
            DefaultWidth  = 470;
            DefaultHeight = 380;
            BorderWidth   = 6;
            Resizable     = false;

            VBox.Spacing = 6;

            buttonCancel = new Button(Gtk.Stock.Cancel);
            AddActionWidget(buttonCancel, ResponseType.Cancel);
            buttonOk = new Button(Gtk.Stock.Ok);
            AddActionWidget(buttonOk, ResponseType.Ok);

            var table = new Table(3, 2, false)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            nameEntry = new Entry {
                WidthRequest = 350
            };
            viewEngineCombo = ComboBox.NewText();
            templateCombo   = ComboBox.NewText();

            var nameLabel = new Label(GettextCatalog.GetString("_Name"))
            {
                MnemonicWidget = nameEntry,
                Xalign         = 0
            };
            var templateLabel = new Label(GettextCatalog.GetString("_Template:"))
            {
                MnemonicWidget = nameEntry,
                Xalign         = 0
            };
            var engineLabel = new Label(GettextCatalog.GetString("_View Engine:"))
            {
                MnemonicWidget = nameEntry,
                Xalign         = 0
            };

            const AttachOptions expandFill = AttachOptions.Expand | AttachOptions.Fill;
            const AttachOptions fill       = AttachOptions.Fill;

            table.Attach(nameLabel, 0, 1, 0, 1, fill, 0, 0, 0);
            table.Attach(nameEntry, 1, 2, 0, 1, expandFill, 0, 0, 0);
            table.Attach(templateLabel, 0, 1, 1, 2, fill, 0, 0, 0);
            table.Attach(templateCombo, 1, 2, 1, 2, expandFill, 0, 0, 0);
            table.Attach(engineLabel, 0, 1, 2, 3, fill, 0, 0, 0);
            table.Attach(viewEngineCombo, 1, 2, 2, 3, expandFill, 0, 0, 0);

            VBox.PackStart(table, false, false, 0);

            var frame = new Frame(GettextCatalog.GetString("Options"))
            {
                BorderWidth = 2
            };
            var optionsVBox = new VBox {
                Spacing = 6
            };
            var optionsAlignment = new Alignment(0.5f, 0.5f, 1f, 1f)
            {
                Child         = optionsVBox,
                TopPadding    = 4,
                BottomPadding = 4,
                RightPadding  = 4,
                LeftPadding   = 4
            };

            frame.Add(optionsAlignment);

            partialCheck = new CheckButton(GettextCatalog.GetString("_Partial view"))
            {
                UseUnderline = true
            };
            stronglyTypedCheck = new CheckButton(GettextCatalog.GetString("_Strongly typed"))
            {
                UseUnderline = true
            };
            masterCheck = new CheckButton(GettextCatalog.GetString("Has _master page or layout"))
            {
                UseUnderline = true
            };

            dataClassCombo = ComboBoxEntry.NewText();
            masterEntry    = new Entry {
                WidthRequest = 250
            };
            placeholderCombo = ComboBoxEntry.NewText();
            masterButton     = new Button("...");

            optionsVBox.PackStart(partialCheck);
            optionsVBox.PackStart(stronglyTypedCheck);
            typePanel = WithLabelAndLeftPadding(dataClassCombo, GettextCatalog.GetString("_Data class:"), true, 24);
            optionsVBox.PackStart(typePanel);
            optionsVBox.PackStart(masterCheck);


            var masterLabel = new Label(GettextCatalog.GetString("_File:"))
            {
                MnemonicWidget = masterEntry,
                Xalign         = 0,
                UseUnderline   = true
            };

            placeholderLabel = new Label(GettextCatalog.GetString("P_rimary placeholder:"))
            {
                MnemonicWidget = placeholderCombo,
                Xalign         = 0,
                UseUnderline   = true
            };

            var masterTable = new Table(2, 3, false)
            {
                RowSpacing = 6, ColumnSpacing = 6
            };

            masterTable.Attach(masterLabel, 0, 1, 0, 1, fill, 0, 0, 0);
            masterTable.Attach(masterEntry, 1, 3, 0, 1, expandFill, 0, 0, 0);
            masterTable.Attach(placeholderLabel, 0, 1, 1, 2, expandFill, 0, 0, 0);
            masterTable.Attach(placeholderCombo, 1, 2, 1, 2, fill, 0, 0, 0);
            masterTable.Attach(masterButton, 2, 3, 1, 2, fill, 0, 0, 0);

            masterPanel = new Alignment(0.5f, 0.5f, 1f, 1f)
            {
                LeftPadding = 24, Child = masterTable
            };
            optionsVBox.PackStart(masterPanel);

            VBox.PackStart(frame, false, false, 0);

            Child.ShowAll();

            viewEngineCombo.Changed    += ViewEngineChanged;
            templateCombo.Changed      += Validate;
            nameEntry.Changed          += Validate;
            partialCheck.Toggled       += UpdateMasterPanelSensitivity;
            stronglyTypedCheck.Toggled += UpdateTypePanelSensitivity;
            dataClassCombo.Changed     += DataClassChanged;
            masterCheck.Toggled        += UpdateMasterPanelSensitivity;
            masterEntry.Changed        += MasterChanged;
            masterButton.Clicked       += ShowMasterSelectionDialog;
            placeholderCombo.Changed   += Validate;
        }
コード例 #40
0
        Widget CreateExceptionHeader()
        {
            var icon = new ImageView(WarningIconPixbuf);

            icon.Yalign = 0;

            ExceptionTypeLabel = new Label {
                Xalign = 0.0f, Selectable = true, CanFocus = false
            };
            ExceptionMessageLabel = new Label {
                Wrap = true, Xalign = 0.0f, Selectable = true, CanFocus = false
            };
            ExceptionHelpLinkLabel = new Label {
                Wrap = true, Xalign = 0.0f, Selectable = true, CanFocus = false, UseMarkup = true, LineWrapMode = Pango.WrapMode.Char
            };
            ExceptionHelpLinkLabel.Name = "exception_help_link_label";
            Gtk.Rc.ParseString(@"style ""exception-help-link-label""
{
	GtkWidget::link-color = ""#ffffff""
	GtkWidget::visited-link-color = ""#ffffff""
}
widget ""*.exception_help_link_label"" style ""exception-help-link-label""
");

            var textColor = Styles.ExceptionCaughtDialog.HeaderTextColor.ToGdkColor();

            ExceptionHelpLinkLabel.ModifyBase(StateType.Prelight, Styles.ExceptionCaughtDialog.HeaderBackgroundColor.ToGdkColor());
            ExceptionHelpLinkLabel.SetLinkHandler((str) => DesktopService.ShowUrl(str));
            ExceptionTypeLabel.ModifyFg(StateType.Normal, textColor);
            ExceptionMessageLabel.ModifyFg(StateType.Normal, textColor);
            ExceptionHelpLinkLabel.ModifyFg(StateType.Normal, textColor);

            if (Platform.IsWindows)
            {
                ExceptionTypeLabel.ModifyFont(Pango.FontDescription.FromString("bold 19"));
                ExceptionMessageLabel.ModifyFont(Pango.FontDescription.FromString("10"));
                ExceptionHelpLinkLabel.ModifyFont(Pango.FontDescription.FromString("10"));
            }
            else
            {
                ExceptionTypeLabel.ModifyFont(Pango.FontDescription.FromString("21"));
                ExceptionMessageLabel.ModifyFont(Pango.FontDescription.FromString("12"));
                ExceptionHelpLinkLabel.ModifyFont(Pango.FontDescription.FromString("12"));
            }

            //Force rendering of background with EventBox
            var eventBox = new EventBox();
            var hBox     = new HBox();
            var leftVBox = new VBox();

            rightVBox = new VBox();
            leftVBox.PackStart(icon, false, false, (uint)(Platform.IsWindows ? 5 : 0));              // as we change frame.BorderWidth below, we need to compensate

            rightVBox.PackStart(ExceptionTypeLabel, false, false, (uint)(Platform.IsWindows ? 0 : 2));
            rightVBox.PackStart(ExceptionMessageLabel, true, true, (uint)(Platform.IsWindows ? 6 : 5));
            rightVBox.PackStart(ExceptionHelpLinkLabel, false, false, 2);

            hBox.PackStart(leftVBox, false, false, (uint)(Platform.IsWindows ? 5 : 0));              // as we change frame.BorderWidth below, we need to compensate
            hBox.PackStart(rightVBox, true, true, (uint)(Platform.IsWindows ? 5 : 10));

            var frame = new Frame();

            frame.Add(hBox);
            frame.BorderWidth = (uint)(Platform.IsWindows ? 5 : 10);             // on Windows we need to have smaller border due to ExceptionTypeLabel vertical misalignment
            frame.Shadow      = ShadowType.None;
            frame.ShadowType  = ShadowType.None;

            eventBox.Add(frame);
            eventBox.ShowAll();
            eventBox.ModifyBg(StateType.Normal, Styles.ExceptionCaughtDialog.HeaderBackgroundColor.ToGdkColor());

            return(eventBox);
        }
コード例 #41
0
ファイル: DashBoard.cs プロジェクト: sciux/logicPOS
        public DashBoard(Window pSourceWindow, XPGuidObject pDefaultValue, CriteriaOperator pXpoCriteria, Type pDialogType, GenericTreeViewMode pGenericTreeViewMode = GenericTreeViewMode.Default, GenericTreeViewNavigatorMode pGenericTreeViewNavigatorMode = GenericTreeViewNavigatorMode.Default)
        {
            //Config
            int fontGenericTreeViewColumn = Convert.ToInt16(GlobalFramework.Settings["fontGenericTreeViewColumn"]);
            var predicate   = (Predicate <dynamic>)((dynamic x) => x.ID == "PosBaseWindow");
            var themeWindow = GlobalApp.Theme.Theme.Frontoffice.Window.Find(predicate);


            Color screenBackgroundColor = FrameworkUtils.StringToColor(themeWindow.Globals.ScreenBackgroundColor);
            Color white = System.Drawing.Color.White;
            Color black = System.Drawing.Color.Black;


            //_log.Debug("Theme Background: " + eventBackGround);
            //Shared error Message
            string errorMessage = "Node: <Window ID=\"PosBaseWindow\">";

            Fixed fix   = new Fixed();
            HBox  hbox  = new HBox();
            Frame frame = new Frame();

            VBox vbox  = new VBox(false, 2);
            VBox vbox2 = new VBox(true, 0);
            VBox vbox3 = new VBox(false, 5);

            DateTime datenow = new DateTime();

            //Icons dos botões do dashboard
            String _fileFiscalYearIcon   = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_configurations.png");
            String _fileInsertFiscalYear = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_fiscal_year.png");
            String _fileInsertIcon       = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_printer.png");
            String _fileTerminalsIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_terminals.png");

            String _fileArticlesIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_articles.png");
            String _fileCostumersIcon   = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_costumers.png");
            String _fileEmployeesIcon   = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_employees.png");
            String _fileOtherTablesIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_other_tables.png");

            String _fileDocumentsIcon      = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_documents.png");
            String _fileNewDocumentIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_documents_new.png");
            String _filePayedDocumentsIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_documents_new.png");
            String _fileInsertMerchIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_documents_merch.png");

            String _fileReportsMenuIcon    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_reports.png");
            String _fileReportsTotalIcon   = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_reports_sales_report.png");
            String _fileReportsClientsIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_reports_sales_client.png");
            String _fileReportsDayIcon     = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\BackOffice\icon_reports_sales_day.png");

            //Tamanho dos Icons e da Font do Texto dos botões
            Size   sizeIcon = new Size(35, 35);
            string _fontBaseDialogButton = "8";

            //uint borderWidth = 5;
            //Cria o evento por trás da dashboard, tudo será carregado para aqui
            _eventboxDashboard = new EventBox();
            //_eventboxDashboard.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(screenBackgroundColor));
            _eventboxDashboard.WidthRequest  = GlobalApp.boScreenSize.Width;
            _eventboxDashboard.HeightRequest = GlobalApp.boScreenSize.Height;
            Alignment _alignmentWindow = new Alignment(0.0f, 0.0f, 0.0f, 0.0f);

            _alignmentWindow.Add(_eventboxDashboard);
            Add(_alignmentWindow);
            try
            {
                //Imagem carregada aqui para o dashboard
                string fileImageBack        = FrameworkUtils.OSSlash(string.Format("{0}Default/Backgrounds/Windows/LogicPOS_WorkFlow_{1}.png", GlobalFramework.Path["themes"], GlobalFramework.Settings["customCultureResourceDefinition"]));
                System.Drawing.Image pImage = System.Drawing.Image.FromFile(fileImageBack);
                Gdk.Pixbuf           pixbuf = Utils.ImageToPixbuf(pImage);
                _eventboxDashboard.Style = Utils.GetImageBackgroundDashboard(pixbuf);
                //Buttons Configuração
                botao1 = new TouchButtonIconWithText("BACKOFFICE_MAN_CONFIGURATIONPLACETERMINAL_MENU", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_edit_ConfigurationPlaceTerminal_tab1_label"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileTerminalsIcon, sizeIcon, 105, 70);
                botao2 = new TouchButtonIconWithText("BACKOFFICE_MAN_CONFIGURATIONPREFERENCEPARAMETER_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_application_setup"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileFiscalYearIcon, sizeIcon, 105, 70);
                botao3 = new TouchButtonIconWithText("BACKOFFICE_MAN_DOCUMENTFINANCEYEARS_CREATE", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentfinance_years_short"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileInsertFiscalYear, sizeIcon, 105, 70);
                botao4 = new TouchButtonIconWithText("BACKOFFICE_MAN_CONFIGURATIONPRINTERS_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printers"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileInsertIcon, sizeIcon, 105, 70);

                //Buttons Tabelas
                botao5 = new TouchButtonIconWithText("BACKOFFICE_MAN_ARTICLE_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_articles"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileArticlesIcon, sizeIcon, 105, 70);
                botao6 = new TouchButtonIconWithText("BACKOFFICE_MAN_CUSTOMER_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_customers"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileCostumersIcon, sizeIcon, 105, 70);
                botao7 = new TouchButtonIconWithText("BACKOFFICE_MAN_USERDETAIL_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_users"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileEmployeesIcon, sizeIcon, 105, 70);
                botao8 = new TouchButtonIconWithText("BACKOFFICE_MAN_CONFIGURATIONPLACETABLE_VIEW", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_other_tables"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileOtherTablesIcon, sizeIcon, 105, 70);

                //Buttons Documentos
                botao9  = new TouchButtonIconWithText("BACKOFFICE_MAN_DOCUMENTSSHOW_MENU", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_worksession_resume_finance_documents"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileNewDocumentIcon, sizeIcon, 105, 70);
                botao10 = new TouchButtonIconWithText("BACKOFFICE_MAN_DOCUMENTSNEW_MENU", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_new_document"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileDocumentsIcon, sizeIcon, 105, 70);
                botao11 = new TouchButtonIconWithText("BACKOFFICE_MAN_DOCUMENTSPAYMENTS_MENU", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_button_label_select_payments"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _filePayedDocumentsIcon, sizeIcon, 105, 70);
                botao12 = new TouchButtonIconWithText("STOCK_MERCHANDISE_ENTRY_ACCESS", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_documentticket_type_title_cs_short"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileInsertMerchIcon, sizeIcon, 105, 70);

                //Buttons Relatórios
                botao13 = new TouchButtonIconWithText("REPORT_ACCESS", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_reports"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileReportsMenuIcon, sizeIcon, 105, 70);
                botao14 = new TouchButtonIconWithText("REPORT_COMPANY_BILLING", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "report_company_billing_short"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileReportsTotalIcon, sizeIcon, 105, 70);
                botao15 = new TouchButtonIconWithText("REPORT_CUSTOMER_BALANCE_DETAILS", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "report_customer_balance_details_short"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileReportsClientsIcon, sizeIcon, 105, 70);
                botao16 = new TouchButtonIconWithText("REPORT_SALES_DETAIL_PER_DATE", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "report_sales_per_date"), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, _fileReportsDayIcon, sizeIcon, 105, 70);

                PosReportsDialog reportsClicked = new PosReportsDialog();

                //Permissões dos botões
                botao1.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CONFIGURATIONPLACETERMINAL_MENU");
                botao2.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CONFIGURATIONPREFERENCEPARAMETER_VIEW");
                botao3.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCEYEARS_CREATE");
                botao4.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CONFIGURATIONPRINTERS_VIEW");

                botao5.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_ARTICLE_VIEW");
                botao6.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CUSTOMER_VIEW");
                botao7.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_USERDETAIL_VIEW");
                botao8.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_CONFIGURATIONPLACETABLE_VIEW");

                botao9.Sensitive  = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCETYPE_MENU");
                botao10.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCETYPE_CREATE");
                botao11.Sensitive = FrameworkUtils.HasPermissionTo("BACKOFFICE_MAN_DOCUMENTFINANCEYEARS_VIEW");
                botao12.Sensitive = FrameworkUtils.HasPermissionTo("STOCK_MERCHANDISE_ENTRY_ACCESS");

                //Este fica comentado, porque o próprio menu dos reports tem controlo de previlégios
                //botao13.Sensitive = FrameworkUtils.HasPermissionTo("REPORT_ACCESS");
                botao14.Sensitive = FrameworkUtils.HasPermissionTo("REPORT_COMPANY_BILLING");
                botao15.Sensitive = FrameworkUtils.HasPermissionTo("REPORT_CUSTOMER_BALANCE_DETAILS");
                botao16.Sensitive = FrameworkUtils.HasPermissionTo("REPORT_SALES_DETAIL_PER_DATE");


                //Actions Configurações
                botao1.Clicked += delegate { botao1.Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceTerminal>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao1, null); };
                botao2.Clicked += delegate { botao2.Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPreferenceParameter>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao2, null); };
                botao3.Clicked += delegate { botao3.Content = Utils.GetGenericTreeViewXPO <TreeViewDocumentFinanceYears>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao3, null); };
                botao4.Clicked += delegate { botao4.Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPrinters>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao4, null); };

                //Actions Tabelas
                botao5.Clicked += delegate { botao5.Content = Utils.GetGenericTreeViewXPO <TreeViewArticle>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao5, null); };
                botao6.Clicked += delegate { botao6.Content = Utils.GetGenericTreeViewXPO <TreeViewCustomer>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao6, null); };
                botao7.Clicked += delegate { botao7.Content = Utils.GetGenericTreeViewXPO <TreeViewUser>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao7, null); };
                botao8.Clicked += delegate { botao8.Content = Utils.GetGenericTreeViewXPO <TreeViewConfigurationPlaceTable>(pSourceWindow); GlobalApp.WindowBackOffice._dashboardButton_Clicked(botao8, null); };

                //Actions Documents
                botao9.Clicked  += delegate { Utils.startDocumentsMenuFromBackOffice(pSourceWindow, 0); };
                botao10.Clicked += delegate { Utils.startNewDocumentFromBackOffice(pSourceWindow); };
                botao11.Clicked += delegate { Utils.startDocumentsMenuFromBackOffice(pSourceWindow, 3); };
                botao12.Clicked += delegate { Utils.startDocumentsMenuFromBackOffice(pSourceWindow, 6); };

                //Actions Reports
                botao13.Clicked += delegate { Utils.startReportsMenuFromBackOffice(pSourceWindow); };
                botao14.Clicked += delegate { reportsClicked.PrintReportRouter
                                                  (botao14, null); };
                botao15.Clicked += delegate { reportsClicked.PrintReportRouter(botao15, null); };
                botao16.Clicked += delegate { reportsClicked.PrintReportRouter(botao16, null); };

                //Posição dos botões na dashboard
                fix.Put(botao1, 55, 62);
                fix.Put(botao2, 55, 155);
                fix.Put(botao3, 55, 250);
                fix.Put(botao4, 55, 345);

                fix.Put(botao5, 245, 62);
                fix.Put(botao6, 245, 155);
                fix.Put(botao7, 245, 250);
                fix.Put(botao8, 245, 345);

                fix.Put(botao9, 440, 62);
                fix.Put(botao10, 440, 155);
                fix.Put(botao11, 440, 250);
                fix.Put(botao12, 440, 345);

                fix.Put(botao13, 635, 62);
                fix.Put(botao14, 635, 155);
                fix.Put(botao15, 635, 250);
                fix.Put(botao16, 635, 345);

                string currency = "Money";
                try
                {
                    string sqlCurrency = "SELECT Value FROM cfg_configurationpreferenceparameter where Token = 'SYSTEM_CURRENCY'";
                    currency = GlobalFramework.SessionXpo.ExecuteScalar(sqlCurrency).ToString();
                }
                catch
                {
                    currency = SettingsApp.SaftCurrencyCode;
                }

                decimal   dailyTotal   = 0;
                decimal   MonthlyTotal = 0;
                decimal   annualTotal  = 0;
                ArrayList values       = new ArrayList();
                values.Add(DateTime.Now.Year.ToString());
                try
                {
                    SortingCollection sortCollection = new SortingCollection();
                    sortCollection.Add(new SortProperty("Date", SortingDirection.Ascending));
                    CriteriaOperator criteria = CriteriaOperator.Parse(string.Format("(Disabled = 0 OR Disabled IS NULL AND (DocumentType.Oid = '{0}' OR DocumentType.Oid = '{1}' OR DocumentType.Oid = '{2}' OR DocumentType.Oid = '{3}') AND DocumentStatusReason != 'A')", invoiceOid, invoiceAndPaymentOid, simpleInvoiceOid, creditNoteOid));
                    collectionDocuments = GlobalFramework.SessionXpo.GetObjects(GlobalFramework.SessionXpo.GetClassInfo(typeof(fin_documentfinancemaster)), criteria, sortCollection, int.MaxValue, false, true);

                    datenow = DateTime.Now;

                    foreach (fin_documentfinancemaster item in collectionDocuments)
                    {
                        //Faturação por Dia
                        if (item.Date.Day == datenow.Day && item.Date.Month == datenow.Month && item.Date.Year == datenow.Year)
                        {
                            if (item.DocumentType.Oid.ToString() == creditNoteOid && item.DocumentStatusStatus != "A")
                            {
                                dailyTotal -= Convert.ToDecimal(item.TotalFinal);
                            }
                            else if (item.DocumentStatusStatus != "A" && (item.DocumentType.Oid.ToString() == invoiceOid || item.DocumentType.Oid.ToString() == invoiceAndPaymentOid || item.DocumentType.Oid.ToString() == simpleInvoiceOid))
                            {
                                dailyTotal += Convert.ToDecimal(item.TotalFinal);
                            }
                        }
                        //Faturação por Mês
                        if (item.Date.Month == datenow.Month && item.Date.Year == datenow.Year)
                        {
                            if (item.DocumentType.Oid.ToString() == creditNoteOid && item.DocumentStatusStatus != "A")
                            {
                                MonthlyTotal -= Convert.ToDecimal(item.TotalFinal);
                            }
                            else if (item.DocumentStatusStatus != "A" && (item.DocumentType.Oid.ToString() == invoiceOid || item.DocumentType.Oid.ToString() == invoiceAndPaymentOid || item.DocumentType.Oid.ToString() == simpleInvoiceOid))
                            {
                                MonthlyTotal += Convert.ToDecimal(item.TotalFinal);
                            }
                        }
                        //Faturação por Ano
                        if (item.Date.Year == datenow.Year)
                        {
                            if (item.DocumentType.Oid.ToString() == creditNoteOid && item.DocumentStatusStatus != "A")
                            {
                                annualTotal -= Convert.ToDecimal(item.TotalFinal);
                            }
                            else if (item.DocumentStatusStatus != "A" && (item.DocumentType.Oid.ToString() == invoiceOid || item.DocumentType.Oid.ToString() == invoiceAndPaymentOid || item.DocumentType.Oid.ToString() == simpleInvoiceOid))
                            {
                                annualTotal += Convert.ToDecimal(item.TotalFinal);
                            }
                        }
                        //grava anos que existe faturação
                        if (!values.Contains(item.Date.Year.ToString()))
                        {
                            values.Add(item.Date.Year.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    _log.Error(ex.Message, ex);
                }

                label            = new Label();
                frame.ShadowType = (ShadowType)0;

                label.Text = string.Format("{0} {3}\n\n{1} {3}\n\n{2} {3}",
                                           Convert.ToInt64(Math.Round(dailyTotal, 0)).ToString(),
                                           Convert.ToInt64(Math.Round(MonthlyTotal, 0)).ToString(),
                                           Convert.ToInt64(Math.Round(annualTotal, 0)).ToString(),
                                           currency.ToString());

                label.ModifyFont(FontDescription.FromString("Trebuchet MS 16"));
                label.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(white));
                label.Justify = Justification.Right;
                frame.Add(label);
                hbox.PackStart(frame, false, false, 0);
                vbox.PackStart(hbox, false, false, 0);
                fix.Put(vbox, 628, 515);

                //COMBO BOX selecionar os anos do gráfico
                int      w        = 1;
                string[] getYears = new string[values.Count];
                getYears[0] = (string)values[0];
                for (int i = values.Count - 1; i > 0; i--)
                {
                    getYears[i] = (string)values[w];
                    w++;
                }
                //w = 1;
                selAno = new ComboBox(getYears);
                selAno.ModifyFg(StateType.Selected, Utils.ColorToGdkColor(black));

                TreeIter iter;
                selAno.Model.GetIterFirst(out iter);
                do
                {
                    GLib.Value thisRow = new GLib.Value();
                    selAno.Model.GetValue(iter, 0, ref thisRow);
                    if ((thisRow.Val as string).Equals(getYears[0]))
                    {
                        selAno.SetActiveIter(iter);
                        break;
                    }
                } while (selAno.Model.IterNext(ref iter));
                selAno.Changed += delegate
                {
                    annualTotal = 0;
                    foreach (fin_documentfinancemaster item in collectionDocuments)
                    {
                        if (item.Date.Year.ToString() == selAno.ActiveText.ToString())
                        {
                            if (item.DocumentType.Oid.ToString() == creditNoteOid && item.DocumentStatusStatus != "A")
                            {
                                annualTotal -= Convert.ToDecimal(item.TotalFinal);
                            }
                            else if (item.DocumentStatusStatus != "A" && (item.DocumentType.Oid.ToString() == invoiceOid || item.DocumentType.Oid.ToString() == invoiceAndPaymentOid || item.DocumentType.Oid.ToString() == simpleInvoiceOid))
                            {
                                annualTotal += Convert.ToDecimal(item.TotalFinal);
                            }
                        }
                    }
                    label.Text = string.Format("{0} {3}\n\n{1} {3}\n\n{2} {3}",
                                               Convert.ToInt64(Math.Round(dailyTotal, 0)).ToString(),
                                               Convert.ToInt64(Math.Round(MonthlyTotal, 0)).ToString(),
                                               Convert.ToInt64(Math.Round(annualTotal, 0)).ToString(),
                                               currency.ToString());

                    label.ModifyFont(FontDescription.FromString("Trebuchet MS 16"));
                    label.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(white));
                    label.Justify = Justification.Right;
                    frame.Add(label);

                    hbox.PackStart(frame, false, false, 0);
                    vbox.PackStart(hbox, false, false, 0);
                    string selectedDate = string.Format("01/01/{0}", (selAno.ActiveText.ToString()));
                    fix.Put(vbox, 640, 515);
                    fix.Put(drawSalesGraphic(DateTime.Parse(selectedDate), true), 55, 485);
                };
                if (Utils.IsLinux)
                {
                    fix.Put(selAno, 220, 650);
                }
                else
                {
                    fix.Put(selAno, 220, 665);
                }

                //GRÁFICO
                fix.Put(drawSalesGraphic(datenow, false), 55, 485);

                //Adiciona tudo ao evento principal
                _eventboxDashboard.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
                _eventboxDashboard.Add(fix);
                fix.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
                Utils.ShowMessageTouchErrorRenderTheme(pSourceWindow, string.Format("{1}{0}{0}{2}", Environment.NewLine, errorMessage, ex.Message));
            }
        }
コード例 #42
0
        public override void Initialize(NodeBuilder[] builders, TreePadOption[] options, string menuPath)
        {
            base.Initialize(builders, options, menuPath);

            testChangedHandler            = (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnDetailsTestChanged));
            testService.TestSuiteChanged += (EventHandler)DispatchService.GuiDispatch(new EventHandler(OnTestSuiteChanged));
            paned = new VPaned();

            VBox            vbox       = new VBox();
            DockItemToolbar topToolbar = Window.GetToolbar(PositionType.Top);

            var hbox = new HBox {
                Spacing = 6
            };

            hbox.PackStart(new ImageView(ImageService.GetIcon("nunit-run", IconSize.Menu)), false, false, 0);
            hbox.PackStart(new Label(GettextCatalog.GetString("Run All")), false, false, 0);
            buttonRunAll             = new Button(hbox);
            buttonRunAll.Clicked    += new EventHandler(OnRunAllClicked);
            buttonRunAll.Sensitive   = true;
            buttonRunAll.TooltipText = GettextCatalog.GetString("Run all tests");
            topToolbar.Add(buttonRunAll);

            buttonStop             = new Button(new Gtk.Image(Ide.Gui.Stock.Stop, IconSize.Menu));
            buttonStop.Clicked    += new EventHandler(OnStopClicked);
            buttonStop.Sensitive   = false;
            buttonStop.TooltipText = GettextCatalog.GetString("Cancel running test");
            topToolbar.Add(buttonStop);
            topToolbar.ShowAll();

            vbox.PackEnd(base.Control, true, true, 0);
            vbox.FocusChain = new Gtk.Widget [] { base.Control };

            paned.Pack1(vbox, true, true);

            detailsPad = new VBox();

            EventBox eb     = new EventBox();
            HBox     header = new HBox();

            eb.Add(header);

            detailLabel         = new HeaderLabel();
            detailLabel.Padding = 6;

            Button hb = new Button(new Gtk.Image("gtk-close", IconSize.SmallToolbar));

            hb.Relief   = ReliefStyle.None;
            hb.Clicked += new EventHandler(OnCloseDetails);
            header.PackEnd(hb, false, false, 0);

            hb          = new Button(new Gtk.Image("gtk-go-back", IconSize.SmallToolbar));
            hb.Relief   = ReliefStyle.None;
            hb.Clicked += new EventHandler(OnGoBackTest);
            header.PackEnd(hb, false, false, 0);

            header.Add(detailLabel);
            Gdk.Color hcol = eb.Style.Background(StateType.Normal);
            hcol.Red   = (ushort)(((double)hcol.Red) * 0.9);
            hcol.Green = (ushort)(((double)hcol.Green) * 0.9);
            hcol.Blue  = (ushort)(((double)hcol.Blue) * 0.9);
            //	eb.ModifyBg (StateType.Normal, hcol);

            detailsPad.PackStart(eb, false, false, 0);

            VPaned panedDetails = new VPaned();

            panedDetails.BorderWidth = 3;
            VBox boxPaned1 = new VBox();

            chart = new TestChart();
            chart.ButtonPressEvent += OnChartButtonPress;
            chart.SelectionChanged += new EventHandler(OnChartDateChanged);
            chart.HeightRequest     = 50;

            Toolbar toolbar = new Toolbar();

            toolbar.IconSize     = IconSize.SmallToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.ShowArrow    = false;
            ToolButton but = new ToolButton("gtk-zoom-in");

            but.Clicked += new EventHandler(OnZoomIn);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-zoom-out");
            but.Clicked += new EventHandler(OnZoomOut);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-go-back");
            but.Clicked += new EventHandler(OnChartBack);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-go-forward");
            but.Clicked += new EventHandler(OnChartForward);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-goto-last");
            but.Clicked += new EventHandler(OnChartLast);
            toolbar.Insert(but, -1);

            boxPaned1.PackStart(toolbar, false, false, 0);
            boxPaned1.PackStart(chart, true, true, 0);

            panedDetails.Pack1(boxPaned1, false, false);

            // Detailed test information --------

            infoBook = new ButtonNotebook();
            infoBook.PageLoadRequired += new EventHandler(OnPageLoadRequired);

            // Info - Group summary

            Frame          tf = new Frame();
            ScrolledWindow sw = new ScrolledWindow();

            detailsTree = new TreeView();

            detailsTree.HeadersVisible = true;
            detailsTree.RulesHint      = true;
            detailsStore = new ListStore(typeof(object), typeof(string), typeof(string), typeof(string), typeof(string));

            CellRendererText trtest = new CellRendererText();
            CellRendererText tr;

            TreeViewColumn col3 = new TreeViewColumn();

            col3.Expand = false;
//			col3.Alignment = 0.5f;
            col3.Widget = new ImageView(TestStatusIcon.Success);
            col3.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col3.PackStart(tr, false);
            col3.AddAttribute(tr, "markup", 2);
            detailsTree.AppendColumn(col3);

            TreeViewColumn col4 = new TreeViewColumn();

            col4.Expand = false;
//			col4.Alignment = 0.5f;
            col4.Widget = new ImageView(TestStatusIcon.Failure);
            col4.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col4.PackStart(tr, false);
            col4.AddAttribute(tr, "markup", 3);
            detailsTree.AppendColumn(col4);

            TreeViewColumn col5 = new TreeViewColumn();

            col5.Expand = false;
//			col5.Alignment = 0.5f;
            col5.Widget = new ImageView(TestStatusIcon.NotRun);
            col5.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col5.PackStart(tr, false);
            col5.AddAttribute(tr, "markup", 4);
            detailsTree.AppendColumn(col5);

            TreeViewColumn col1 = new TreeViewColumn();

//			col1.Resizable = true;
//			col1.Expand = true;
            col1.Title = "Test";
            col1.PackStart(trtest, true);
            col1.AddAttribute(trtest, "markup", 1);
            detailsTree.AppendColumn(col1);

            detailsTree.Model = detailsStore;

            sw.Add(detailsTree);
            tf.Add(sw);
            tf.ShowAll();

            TestSummaryPage = infoBook.AddPage(GettextCatalog.GetString("Summary"), tf);

            // Info - Regressions list

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            regressionTree = new TreeView();
            regressionTree.HeadersVisible = false;
            regressionTree.RulesHint      = true;
            regressionStore = new ListStore(typeof(object), typeof(string), typeof(Xwt.Drawing.Image));

            CellRendererText trtest2 = new CellRendererText();
            var pr = new CellRendererImage();

            TreeViewColumn col = new TreeViewColumn();

            col.PackStart(pr, false);
            col.AddAttribute(pr, "image", 2);
            col.PackStart(trtest2, false);
            col.AddAttribute(trtest2, "markup", 1);
            regressionTree.AppendColumn(col);
            regressionTree.Model = regressionStore;
            sw.Add(regressionTree);
            tf.ShowAll();

            TestRegressionsPage = infoBook.AddPage(GettextCatalog.GetString("Regressions"), tf);

            // Info - Failed tests list

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            failedTree = new TreeView();
            failedTree.HeadersVisible = false;
            failedTree.RulesHint      = true;
            failedStore = new ListStore(typeof(object), typeof(string), typeof(Xwt.Drawing.Image));

            trtest2 = new CellRendererText();
            pr      = new CellRendererImage();

            col = new TreeViewColumn();
            col.PackStart(pr, false);
            col.AddAttribute(pr, "image", 2);
            col.PackStart(trtest2, false);
            col.AddAttribute(trtest2, "markup", 1);
            failedTree.AppendColumn(col);
            failedTree.Model = failedStore;
            sw.Add(failedTree);
            tf.ShowAll();

            TestFailuresPage = infoBook.AddPage(GettextCatalog.GetString("Failed tests"), tf);

            // Info - results

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            resultView          = new TextView();
            resultView.Editable = false;
            sw.Add(resultView);
            tf.ShowAll();
            TestResultPage = infoBook.AddPage(GettextCatalog.GetString("Result"), tf);

            // Info - Output

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            outputView          = new TextView();
            outputView.Editable = false;
            sw.Add(outputView);
            tf.ShowAll();
            TestOutputPage = infoBook.AddPage(GettextCatalog.GetString("Output"), tf);

            panedDetails.Pack2(infoBook, true, true);
            detailsPad.PackStart(panedDetails, true, true, 0);
            paned.Pack2(detailsPad, true, true);

            paned.ShowAll();

            infoBook.HidePage(TestResultPage);
            infoBook.HidePage(TestOutputPage);
            infoBook.HidePage(TestSummaryPage);
            infoBook.HidePage(TestRegressionsPage);
            infoBook.HidePage(TestFailuresPage);

            detailsPad.Sensitive = false;
            detailsPad.Hide();

            detailsTree.RowActivated    += new Gtk.RowActivatedHandler(OnTestActivated);
            regressionTree.RowActivated += new Gtk.RowActivatedHandler(OnRegressionTestActivated);
            failedTree.RowActivated     += new Gtk.RowActivatedHandler(OnFailedTestActivated);

            foreach (UnitTest t in testService.RootTests)
            {
                TreeView.AddChild(t);
            }
        }
コード例 #43
0
        public Authentication()
            : base()
        {
            //this.SetIconFromFile ("../../icons/main_icon.ico");
            this.Title       = "Login";
            this.BorderWidth = 10;
            //this.SetDefaultSize (200, 200);
            this.Resizable = false;

            isOk = false;

            mainBox   = new VBox();
            formFrame = new Frame(); //only container in this window to have a frame -> aesthetic purpose
            //Start with labels
            userInfo = new Label("Benvenuto! Autenticati per ottenere l'accesso: ");
            //labelFrame.Add (userInfo);
            mainBox.Add(userInfo);

            //entries
            username = new Entry();
            this.CheckList.Add(false);
            password = new Entry();
            this.CheckList.Add(false);

            password.Visibility = false;

            usernameLabel = new Label("Username");
            passwordLabel = new Label("Password");

            entryBox      = new VBox();
            labelEntryBox = new VBox();

            //continue with login entries
            entryBox.Add(username);
            entryBox.Add(password);
            labelEntryBox.Add(usernameLabel);
            labelEntryBox.Add(passwordLabel);

            loginBox = new HBox();
            loginBox.Add(labelEntryBox);
            loginBox.Add(entryBox);

            formFrame.Add(loginBox);
            mainBox.Add(formFrame);

            //finish adding buttons
            commitBox = new HButtonBox();

            commit  = new Button("Ok");
            cancel  = new Button("Annulla");
            isMedic = new CheckButton("Medico");

            commit.Show();
            cancel.Show();
            isMedic.Show();
            commitBox.Add(isMedic);
            commitBox.Add(commit);
            commitBox.Add(cancel);


            mainBox.Add(commitBox);
            //buttonBoxFrame.Add (commitBox);

            this.Add(mainBox);

            //button funzionality implementation
            cancel.Clicked += new EventHandler(CancelWindowCloser);
            commit.Clicked += Commit_Clicked;

            isMedic.Toggled += (object sender, EventArgs e) => showMedic = true;

            //Events
            this.DeleteEvent += new DeleteEventHandler(WindowCloser);
            // CheckList
            /*this.username.FocusInEvent += new FocusInEventHandler(UsernameTestAndScan);*/


            //last window settings
            this.SetPosition(WindowPosition.CenterAlways);
            this.ShowAll();
            isInstantiated = true;
            //commit.HideAll();
        }
コード例 #44
0
ファイル: DocumentView.cs プロジェクト: blueOkiris/clonger
        private VBox documentToVBox(Document document)
        {
            var container = new VBox(false, 0);

            TextView currTextView = null;

            foreach (var snippet in document.Snippets)
            {
                if (snippet is TextSnippet)
                {
                    if (currTextView == null)
                    {
                        currTextView          = new TextView();
                        currTextView.Editable = false;
                        container.PackStart(
                            currTextView, false, false, AppSettings.Margin
                            );
                    }

                    var textTag = new TextTag(null);
                    textTag.Weight =
                        ((TextSnippet)snippet).IsBold ?
                        Weight.Bold :
                        Weight.Normal;
                    textTag.Underline =
                        ((TextSnippet)snippet).IsUnderlined ?
                        Underline.Single :
                        Underline.None;
                    textTag.Style =
                        ((TextSnippet)snippet).IsItalicized ?
                        Pango.Style.Italic :
                        Pango.Style.Normal;
                    switch (((TextSnippet)snippet).Style)
                    {
                    case HeaderType.Title:
                        textTag.SizePoints = AppSettings.TitleDocFontSize;
                        break;

                    case HeaderType.Subtitle:
                        textTag.SizePoints = AppSettings.SubtitleDocFontSize;
                        break;

                    case HeaderType.Body:
                        textTag.SizePoints = AppSettings.DefaultDocFontSize;
                        break;
                    }

                    var iter = currTextView.Buffer.EndIter;

                    currTextView.Buffer.TagTable.Add(textTag);
                    currTextView.Buffer.InsertWithTags(
                        ref iter, ((TextSnippet)snippet).RawText, textTag
                        );
                }
                else if (snippet is ImageSnippet)
                {
                    currTextView = null;
                    var img = new Image(((ImageSnippet)snippet).ResourcePath);
                    container.PackStart(img, false, false, AppSettings.Margin);
                }
                else if (snippet is TableSnippet)
                {
                    currTextView = null;

                    var tableSnip = (TableSnippet)snippet;
                    var numRows   = tableSnip.Data.GetLength(0);
                    var numCols   = tableSnip.Data.GetLength(1);

                    var table = new Grid();
                    table.ColumnHomogeneous = false;
                    table.RowHomogeneous    = false;

                    for (int row = 0; row < numRows; row++)
                    {
                        for (int col = 0; col < numCols; col++)
                        {
                            var datumFrame = new Frame();
                            var datum      = new TextView();
                            datum.Editable = false;
                            var bold = new TextTag(null);
                            bold.SizePoints = AppSettings.DefaultDocFontSize;
                            if (row == 0)
                            {
                                // Header
                                bold.Weight = Weight.Bold;
                            }
                            datum.Buffer.TagTable.Add(bold);
                            var iter = datum.Buffer.EndIter;
                            datum.Buffer.InsertWithTags(
                                ref iter, tableSnip.Data[row, col].Trim(), bold
                                );
                            datumFrame.Add(datum);

                            table.Attach(datumFrame, col, row, 1, 1);
                        }
                    }

                    container.PackStart(
                        table, false, false, AppSettings.Margin
                        );
                }
            }

            return(container);
        }
コード例 #45
0
        private void AddBackgroundsSelectionWidget()
        {
            Gtk.Frame fframe, gframe, hfframe;
            EventBox  febox, gebox, hfebox;
            HBox      fieldBox, halfFieldBox, goalBox;
            HBox      periodsBox;
            Button    periodsButton;

            fframe = new Gtk.Frame("<b>" + Catalog.GetString("Field background") + "</b>");
            (fframe.LabelWidget as Label).UseMarkup = true;
            fframe.ShadowType = ShadowType.None;
            hfframe           = new Gtk.Frame("<b>" + Catalog.GetString("Half field background") + "</b>");
            (hfframe.LabelWidget as Label).UseMarkup = true;
            hfframe.ShadowType = ShadowType.None;
            gframe             = new Gtk.Frame("<b>" + Catalog.GetString("Goal background") + "</b>");
            (gframe.LabelWidget as Label).UseMarkup = true;
            gframe.ShadowType = ShadowType.None;
            periodsFrame      = new Frame("<b>" + Catalog.GetString("Game periods") + "</b>");
            (periodsFrame.LabelWidget as Label).UseMarkup = true;
            periodsFrame.ShadowType = ShadowType.None;

            febox           = new EventBox();
            fieldBox        = new HBox();
            fReset          = new Button(Catalog.GetString("Reset"));
            fReset.Clicked += (sender, e) => {
                Template.FieldBackground = null;
                SetFieldImage(null);
            };
            febox.ButtonPressEvent += OnFieldImageClicked;
            fieldImage              = new Gtk.Image();
            SetFieldImage(null);

            hfebox           = new EventBox();
            halfFieldBox     = new HBox();
            hfReset          = new Button(Catalog.GetString("Reset"));
            hfReset.Clicked += (sender, e) => {
                Template.HalfFieldBackground = null;
                SetHalfFieldImage(null);
            };
            hfebox.ButtonPressEvent += OnHalfFieldImageClicked;
            halffieldImage           = new Gtk.Image();
            SetHalfFieldImage(null);

            gebox           = new EventBox();
            goalBox         = new HBox();
            gReset          = new Button(Catalog.GetString("Reset"));
            gReset.Clicked += (sender, e) => {
                Template.GoalBackground = null;
                SetGoalImage(null);
            };
            gebox.ButtonPressEvent += OnGoalImageClicked;
            goalImage = new Gtk.Image();
            SetGoalImage(null);

            periodsBox    = new HBox();
            periodsButton = new Button("gtk-edit");
            periodsLabel  = new Label();
            periodsBox.PackStart(periodsLabel);
            periodsBox.PackStart(periodsButton);
            periodsButton.Clicked += HandlePeriodsClicked;

            febox.Add(fieldImage);
            hfebox.Add(halffieldImage);
            gebox.Add(goalImage);

            fieldBox.PackStart(febox, true, true, 0);
            fieldBox.PackStart(fReset, false, false, 0);
            halfFieldBox.PackStart(hfebox, true, true, 0);
            halfFieldBox.PackStart(hfReset, false, false, 0);
            goalBox.PackStart(gebox, true, true, 0);
            goalBox.PackStart(gReset, false, false, 0);

            fframe.Add(fieldBox);
            hfframe.Add(halfFieldBox);
            gframe.Add(goalBox);
            periodsFrame.Add(periodsBox);

            box = new VBox();
            box.PackStart(fframe, false, false, 0);
            box.PackStart(hfframe, false, false, 0);
            box.PackStart(gframe, false, false, 0);
            box.PackStart(periodsFrame, false, false, 0);
            box.ShowAll();
            box.Sensitive = false;
            AddUpperWidget(box);
        }
コード例 #46
0
        /// <summary>
        ///     Build the odt file
        /// </summary>
        /// <param name="filePath"></param>
        public IEnumerator ExportToOdt(string filePath)
        {
            m_isExporting = true;
            // FIRST, GENERATE SCREENSHOTS
            var folder       = Path.GetDirectoryName(filePath);
            var name         = Path.GetFileNameWithoutExtension(filePath);
            var imagesFolder = Path.Combine(folder, name + "_images");

            Directory.CreateDirectory(imagesFolder);
            var di = new DirectoryInfo(imagesFolder);

            foreach (var file in di.GetFiles())
            {
                file.Delete();
            }

            var x = Project.GetCurrentFloor().Rooms.Average(r => r.GetCenter().x);
            var y = Project.GetCurrentFloor().Rooms.Average(r => r.GetCenter().y);
            var z = Project.GetCurrentFloor().Rooms.Average(r => r.GetCenter().z);

            yield return(new WaitForSeconds(0.3f));

            var whole2D = Path.Combine(imagesFolder, "whole2D.png");

            yield return(Screenshot.Instance.TakeBig2DScreenshot(imagesFolder, new Vector3(x, y + 50, z), "whole2D"));

            yield return(new WaitForSeconds(0.3f));

            var whole3D = Screenshot.Instance.TakeBig3DScreenshot(imagesFolder, new Vector3(x, y + 50, z), "whole3D");

            yield return(new WaitForSeconds(0.3f));

            var whole2DImage = new Image(whole2D);

            var whole2DFrame = new Frame();

            whole2DFrame.Width  = new odf.Size(1920 / 4f, odf.Unit.Pixel);
            whole2DFrame.Height = new odf.Size(1080 / 4f, odf.Unit.Pixel);
            whole2DFrame.Add(whole2DImage);

            var whole3DImage = new Image(whole3D);

            var whole3DFrame = new Frame();

            whole3DFrame.Width  = new odf.Size(1920 / 4f, odf.Unit.Pixel);
            whole3DFrame.Height = new odf.Size(1080 / 4f, odf.Unit.Pixel);
            whole3DFrame.Add(whole3DImage);

            // ROOM SCREENSHOTS
            var roomImages   = new List <Image>();
            var room2DFrames = new List <Frame>();
            var room3DFrames = new List <Frame>();

            var cpt = 0;

            foreach (var f in Project.Floors)
            {
                yield return(new WaitForSeconds(0.3f));

                SetCurrentFloor(Project.Floors.IndexOf(f));
                yield return(new WaitForSeconds(0.3f));

                var cpt2 = 0;
                foreach (var ro in f.Rooms)
                {
                    var room2D     = Path.Combine(imagesFolder, ro.Name + "_" + cpt + "_" + cpt2 + "2D.png");
                    var roomCenter = VectorFunctions.Switch2D3D(ro.GetCenter());
                    yield return(Screenshot.Instance.TakeBig2DScreenshot(imagesFolder, roomCenter,
                                                                         ro.Name + "_" + cpt + "_" + cpt2 + "2D"));

                    yield return(new WaitForSeconds(0.3f));

                    var room3D = Screenshot.Instance.TakeBig3DScreenshot(imagesFolder, roomCenter,
                                                                         ro.Name + "_" + cpt + "_" + cpt2 + "3D");
                    yield return(new WaitForSeconds(0.3f));

                    var room2DImage = new Image(room2D);
                    var room2DFrame = new Frame();
                    room2DFrame.Width  = new odf.Size(1920 / 4f, odf.Unit.Pixel);
                    room2DFrame.Height = new odf.Size(1080 / 4f, odf.Unit.Pixel);
                    room2DFrame.Add(room2DImage);
                    room2DFrames.Add(room2DFrame);

                    var room3DImage = new Image(room3D);
                    var room3DFrame = new Frame();
                    room3DFrame.Width  = new odf.Size(1920 / 4f, odf.Unit.Pixel);
                    room3DFrame.Height = new odf.Size(1080 / 4f, odf.Unit.Pixel);
                    room3DFrame.Add(room3DImage);
                    room3DFrames.Add(room3DFrame);

                    roomImages.Add(room2DImage);
                    roomImages.Add(room3DImage);

                    cpt2++;

                    yield return(new WaitForSeconds(0.5f));
                }

                cpt++;
            }

            // THEN, GENERATE DOC
            var doc = new odf.TextDocument();

            // FONTS
            var arial = new Font
            {
                Name              = "Arial",
                Family            = "Arial",
                GenericFontFamily = GenericFontFamily.Swiss,
                Pitch             = FontPitch.Variable
            };

            doc.Fonts.Add(arial);
            // STYLES
            var arial12Style = new ParagraphStyle("Arial12Style");

            arial12Style.TextProperties.Font     = "Arial";
            arial12Style.TextProperties.FontSize = new odf.Size(12, odf.Unit.Point);

            var titleStyle = new ParagraphStyle("TitleStyle");

            titleStyle.ParagraphProperties.TextAlignment = TextAlignment.Center;
            titleStyle.TextProperties.Font             = "Arial";
            titleStyle.TextProperties.FontSize         = new odf.Size(16, odf.Unit.Point);
            titleStyle.TextProperties.FontWeight       = FontWeight.Bold;
            titleStyle.ParagraphProperties.BreakBefore = Break.Page;


            var subtitleStyle = new ParagraphStyle("SubTitleStyle");

            subtitleStyle.ParagraphProperties.TextAlignment = TextAlignment.Left;
            subtitleStyle.TextProperties.Font          = "Arial";
            subtitleStyle.TextProperties.FontSize      = new odf.Size(12, odf.Unit.Point);
            subtitleStyle.TextProperties.FontWeight    = FontWeight.Bold;
            subtitleStyle.TextProperties.UnderlineType = UnderlineType.Single;

            var breakPage = new ParagraphStyle("BreakPage");

            breakPage.ParagraphProperties.BreakBefore = Break.Page;

            var cs1 = new CellStyle("CS1");

            cs1.TextProperties.Color = "#555555";

            doc.AutomaticStyles.Styles.Add(titleStyle);
            doc.AutomaticStyles.Styles.Add(arial12Style);
            doc.AutomaticStyles.Styles.Add(subtitleStyle);
            doc.AutomaticStyles.Styles.Add(breakPage);
            doc.AutomaticStyles.Styles.Add(cs1);


            // CONTENT
            // FIRST PAGE
            var p1 = new odf.Paragraph
            {
                Style = "Arial12Style"
            };

            p1.Add(Project.ProjectName);
            p1.AddLineBreak();
            p1.Add(Project.Person.FirstName + " " + Project.Person.LastName);

            // SECOND PAGE
            var p2 = new odf.Paragraph
            {
                Style = "TitleStyle"
            };

            p2.Add("PRECONISATIONS D'AMENAGEMENT DU LOGEMENT");
            p2.AddLineBreak();
            p2.AddLineBreak();
            var p3 = new odf.Paragraph
            {
                Style = "SubTitleStyle"
            };

            p3.Add("Le bénéficiaire");

            var p4 = new odf.Paragraph
            {
                Style = "Arial12Style"
            };

            p4.Add("Projet : " + Project.ProjectName);
            p4.AddLineBreak();
            p4.Add("Date : " + Project.Date.ToShortDateString());
            p4.AddLineBreak();
            p4.Add("Bénéficiaire : " + Project.Person.FirstName + " " + Project.Person.LastName);
            p4.AddLineBreak();
            p4.Add("Version : v." + Project.Version);
            p4.AddLineBreak();
            p4.Add("Commentaire : " + Project.Comment);
            p4.AddLineBreak();
            p4.AddLineBreak();
            p4.AddLineBreak();

            var p5 = new odf.Paragraph
            {
                Style = "SubTitleStyle"
            };

            p5.Add("La modélisation");

            var p6 = new odf.Paragraph
            {
                Style = "Arial12Style"
            };

            p6.Add("Type de logement : " + Project.HomeType);
            p6.AddLineBreak();
            p6.Add("Nombre d'étages : " + Project.Floors.Count);
            p6.AddLineBreak();
            p6.Add("Nombre de pièces total : " + Project.Floors.Sum(f => f.Rooms.Count()));
            p6.AddLineBreak();
            p6.Add("Superficie totale : ");
            p6.AddLineBreak();

            // ss
            p6.Add(whole2DFrame);
            p6.AddLineBreak();
            p6.AddLineBreak();
            p6.AddLineBreak();

            // ss
            p6.Add(whole3DFrame);
            p6.AddLineBreak();

            // ROOMS
            var pBreakPage = new odf.Paragraph();

            pBreakPage.Style = "BreakPage";
            pBreakPage.Add("");

            var p7 = new odf.Paragraph();

            p7.Style = "SubTitleStyle";
            p7.Add("Les pièces");

            var roomsParagraphs = new List <odf.Paragraph>();

            cpt = 1;
            foreach (var f in Project.Floors)
            {
                foreach (var r in f.Rooms)
                {
                    var curParaTitle = new odf.Paragraph();
                    curParaTitle.Style = "SubTitleStyle";
                    curParaTitle.AddTab();
                    curParaTitle.Add("Pièce n°" + cpt + " : " + r.Name);
                    curParaTitle.AddLineBreak();
                    curParaTitle.AddTab();
                    curParaTitle.AddTab();
                    curParaTitle.Add("Présentation");

                    var curPara = new odf.Paragraph();

                    curPara.Add("Etage : " + f.FloorName);
                    curPara.AddLineBreak();
                    curPara.Add("Nombre de murs : " + r.Walls.Count);
                    curPara.AddLineBreak();
                    curPara.Add("Epaisseur des murs : ");
                    var ths = "";
                    foreach (var w in r.Walls)
                    {
                        ths += w.Thickness + "m, ";
                    }
                    curPara.Add(ths);
                    curPara.AddLineBreak();

                    curPara.Add(room2DFrames[cpt - 1]);
                    curPara.Add(room3DFrames[cpt - 1]);
                    curPara.AddLineBreak();

                    roomsParagraphs.Add(curParaTitle);
                    roomsParagraphs.Add(curPara);

                    cpt++;
                }


                // MEUBLES
                var furniTitle = new odf.Paragraph();
                furniTitle.Style = "SubTitleStyle";
                furniTitle.AddTab();
                furniTitle.AddTab();
                furniTitle.Add("Meubles");

                roomsParagraphs.Add(furniTitle);
                foreach (var fu in f.Furnitures)
                {
                    if (fu.Type != "AideTechnique")
                    {
                        var p = new odf.Paragraph();
                        p.Style = "Arial12Style";
                        p.Add(fu.GetDescription());
                        roomsParagraphs.Add(p);
                    }
                }

                // AIDES TECHNIQUES
                var furni2Title = new odf.Paragraph();
                furni2Title.Style = "SubTitleStyle";
                furni2Title.AddTab();
                furni2Title.AddTab();
                furni2Title.Add("Aides techniques");

                roomsParagraphs.Add(furni2Title);
                foreach (var fu in f.Furnitures)
                {
                    if (fu.Type == "AideTechnique")
                    {
                        var p = new odf.Paragraph();
                        p.Style = "Arial12Style";
                        p.Add(fu.GetDescription());
                        roomsParagraphs.Add(p);
                    }
                }

                // COMMENTS
                var comTitle = new odf.Paragraph();
                comTitle.Style = "SubTitleStyle";
                comTitle.AddTab();
                comTitle.AddTab();
                comTitle.Add("Commentaires");

                roomsParagraphs.Add(comTitle);
                foreach (var tz in f.TextZoneElements)
                {
                    var p = new odf.Paragraph();
                    p.Style = "Arial12Style";
                    p.Add(tz.GetDescription());
                    roomsParagraphs.Add(p);
                }

                // MOBILITE
                var chTitle = new odf.Paragraph();
                chTitle.Style = "SubTitleStyle";
                chTitle.AddTab();
                chTitle.AddTab();
                chTitle.Add("Mobilité");

                roomsParagraphs.Add(chTitle);
                foreach (var ch in f.Characters)
                {
                    var p = new odf.Paragraph();
                    p.Style = "Arial12Style";
                    p.Add(ch.GetDescription());
                    roomsParagraphs.Add(p);
                }
            }

            //====================================
            // POUR RESUMER

            var ps1 = new odf.Paragraph();

            ps1.Style = "SubTitleStyle";
            ps1.Add("Pour résumer");
            var ps2 = new odf.Paragraph();

            ps2.Style = "Arial12Style";
            ps2.Add("Nombre de pièces : " + Project.Floors.Sum(f => f.Rooms.Count()));
            ps2.AddLineBreak();
            var pieces = "";

            foreach (var f in Project.Floors)
            {
                foreach (var r in f.Rooms)
                {
                    pieces += r.Name + ", ";
                }
            }
            ps2.Add("Pièces : " + pieces);
            ps2.AddLineBreak();

            var cell1 = new odf.Cell("Aide technique");
            var cell2 = new odf.Cell("Pièce associée");
            var cell3 = new odf.Cell("Commentaire");

            cell1.Style = "CS1";
            cell2.Style = "CS1";
            cell3.Style = "CS1";

            var row1 = new odf.Row();

            row1.Cells.Add(cell1);
            row1.Cells.Add(cell2);
            row1.Cells.Add(cell3);

            var table1 = new odf.Table();

            table1.Rows.Add(row1);

            foreach (var f in Project.Floors)
            {
                foreach (var fu in f.Furnitures)
                {
                    if (fu.Type == "AideTechnique")
                    {
                        var ro = new odf.Row();
                        ro.Cells.Add(new odf.Cell(fu.Name));
                        ro.Cells.Add(new odf.Cell(""));
                        ro.Cells.Add(new odf.Cell(""));
                        table1.Rows.Add(ro);
                    }
                }
            }

            // If table is empty, add an empty line
            if (table1.Rows.Count == 1)
            {
                var ro = new odf.Row();
                ro.Cells.Add(new odf.Cell(""));
                ro.Cells.Add(new odf.Cell(""));
                ro.Cells.Add(new odf.Cell(""));
                table1.Rows.Add(ro);
            }

            var ps3 = new odf.Paragraph();

            ps3.Style = "Arial12Style";
            ps3.Add("[nom_preconisateur] ");
            ps3.AddTab();
            ps3.Add(DateTime.Now.ToShortDateString());
            ps3.AddTab();
            ps3.Add("Version ErgoShop " + GlobalManager.VERSION);
            ps3.AddLineBreak();


            // DOC CONSTRUCTION
            doc.Body.Add(p1);
            doc.Body.Add(p2);
            doc.Body.Add(p3);
            doc.Body.Add(p4);
            doc.Body.Add(p5);
            doc.Body.Add(p6);
            doc.Body.Add(pBreakPage);
            doc.Body.Add(p7);

            foreach (var p in roomsParagraphs)
            {
                doc.Body.Add(p);
            }

            doc.Body.Add(pBreakPage);
            doc.Body.Add(ps1);
            doc.Body.Add(ps2);
            doc.Body.Add(table1);
            doc.Body.Add(ps3);

            doc.Save(filePath, true);

            UIManager.Instance.ShowCustomMessage("FICHIER ODT EXPORTE");
            yield return(new WaitForSeconds(0.2f));

            GlobalManager.Instance.SwitchViewMode();
            yield return(new WaitForSeconds(0.2f));

            GlobalManager.Instance.Set2DTopMode();
            m_isExporting = false;
        }
コード例 #47
0
ファイル: PropertyView.cs プロジェクト: peter-devoil/ApsimX
        /// <summary>
        /// Display properties and their values to the user.
        /// </summary>
        /// <param name="properties">Properties to be displayed/edited.</param>
        public virtual void DisplayProperties(PropertyGroup properties)
        {
#if NETFRAMEWORK
            uint row = 0;
            uint col = 0;
#else
            int row = 0;
            int col = 0;
#endif
            bool widgetIsFocused     = false;
            int  entryPos            = -1;
            int  entrySelectionStart = 0;
            int  entrySelectionEnd   = 0;
#if NETFRAMEWORK
            // fixme - calls to propertyTable.ChildGetProperty result in a segfault on gtk3 builds.
            if (propertyTable.FocusChild != null)
            {
                object topAttach  = propertyTable.ChildGetProperty(propertyTable.FocusChild, "top-attach").Val;
                object leftAttach = propertyTable.ChildGetProperty(propertyTable.FocusChild, "left-attach").Val;
                if (topAttach.GetType() == typeof(uint) && leftAttach.GetType() == typeof(uint))
                {
#if NETFRAMEWORK
                    row = (uint)topAttach;
                    col = (uint)leftAttach;
#else
                    row = (int)topAttach;
                    col = (int)leftAttach;
#endif
                    widgetIsFocused = true;
                    if (propertyTable.FocusChild is Entry entry)
                    {
                        entryPos = entry.Position;
                        entry.GetSelectionBounds(out entrySelectionStart, out entrySelectionEnd);
                    }
                }
            }
#endif
            box.Remove(propertyTable);

            propertyTable.Cleanup();

#if NETFRAMEWORK
            // Columns should not be homogenous - otherwise we'll have the
            // property name column taking up half the screen.
            propertyTable = new Table((uint)properties.Count(), 3, false);
            // column and row spacing
            propertyTable.RowSpacing = 3;
#else
            propertyTable = new Grid();
            //propertyTable.RowHomogeneous = true;
            propertyTable.RowSpacing = 5;
#endif
            propertyTable.Destroyed += OnWidgetDestroyed;
            box.Add(propertyTable);

#if NETFRAMEWORK
            uint nrow = 0;
#else
            int nrow = 0;
#endif
            AddPropertiesToTable(ref propertyTable, properties, ref nrow, 0);

            if (nrow > 0)
            {
                mainWidget.ShowAll();
            }
            else
            {
                mainWidget.Hide();
            }

            // If a widget was previously focused, then try to give it focus again.
            if (widgetIsFocused)
            {
                Widget widget = propertyTable.GetChild(row, col);
                if (widget is Entry entry)
                {
                    entry.GrabFocus();
                    if (entrySelectionStart >= 0 && entrySelectionStart < entrySelectionEnd && entrySelectionEnd <= entry.Text.Length)
                    {
                        entry.SelectRegion(entrySelectionStart, entrySelectionEnd);
                    }
                    else if (entryPos > -1 && entry.Text.Length >= entryPos)
                    {
                        entry.Position = entryPos;
                    }
                }
            }
        }
コード例 #48
0
        static void init_mainbody(HBox mainbody)
        {
            var treeView = new TreeView();

            var treeViewColumn = new TreeViewColumn();

            treeViewColumn.Title = "Room/Computer";
            var cellRenderText = new CellRendererText();

            treeViewColumn.PackStart(cellRenderText, true);
            treeViewColumn.AddAttribute(cellRenderText, "text", treeView.Columns.Length);
            treeView.InsertColumn(treeViewColumn, treeView.Columns.Length);

            treeViewColumn       = new TreeViewColumn();
            treeViewColumn.Title = "User";
            cellRenderText       = new CellRendererText();
            treeViewColumn.PackStart(cellRenderText, true);
            treeViewColumn.AddAttribute(cellRenderText, "text", treeView.Columns.Length);
            treeView.AppendColumn(treeViewColumn);

            var treeStore = new TreeStore(typeof(string), typeof(string));

            treeView.Model = treeStore;
            var treeIter = treeStore.AppendValues("room1");

            treeStore.AppendValues(treeIter, "PC01", "PC01");
            treeStore.AppendValues(treeIter, "PC02", "PC01");

            ScrolledWindow scrolledWindow = new ScrolledWindow();

            scrolledWindow.ShadowType = ShadowType.In;
            scrolledWindow.Add(treeView);
            scrolledWindow.SetSizeRequest(300, 0);
            mainbody.PackStart(scrolledWindow, false, true, 0);

            scrolledWindow            = new ScrolledWindow();
            scrolledWindow.ShadowType = ShadowType.In;
            var frame = new Frame();

            scrolledWindow.Add(frame);
            mainbody.PackStart(scrolledWindow, true, true, 0);

            image = new Image();
            image.SetPadding(0, 0);
            frame.Add(image);

            {
                string tempName  = "test.png";
                var    stopWatch = new Stopwatch();
                stopWatch.Start();
                var context = Gdk.CairoHelper.Create(Gdk.Screen.Default.RootWindow);
                var surface = context.GetTarget();
                surface.WriteToPng(tempName);
                context.Dispose();
                surface.Dispose();
                stopWatch.Stop();
                Console.WriteLine("spend {0}ms", stopWatch.Elapsed.TotalMilliseconds);

                image.Pixbuf = (new Pixbuf(tempName)).ScaleSimple(600, 300, InterpType.Bilinear);
            }
        }
コード例 #49
0
ファイル: EditorView.cs プロジェクト: oseledets/ApsimX
        /// <summary>
        /// Default constructor that configures the Completion form.
        /// </summary>
        public EditorView(ViewBase owner) : base(owner)
        {
            scroller   = new ScrolledWindow();
            textEditor = new MonoTextEditor();
            scroller.Add(textEditor);
            _mainWidget = scroller;
            Mono.TextEditor.TextEditorOptions options = new Mono.TextEditor.TextEditorOptions();
            options.EnableSyntaxHighlighting = true;
            options.ColorScheme                = "Visual Studio";
            options.HighlightCaretLine         = true;
            textEditor.Options                 = options;
            textEditor.TextArea.DoPopupMenu    = DoPopup;
            textEditor.Document.LineChanged   += OnTextHasChanged;
            textEditor.TextArea.FocusInEvent  += OnTextBoxEnter;
            textEditor.TextArea.FocusOutEvent += OnTextBoxLeave;
            _mainWidget.Destroyed             += _mainWidget_Destroyed;

            AddContextActionWithAccel("Cut", OnCut, "Ctrl+X");
            AddContextActionWithAccel("Copy", OnCopy, "Ctrl+C");
            AddContextActionWithAccel("Paste", OnPaste, "Ctrl+V");
            AddContextActionWithAccel("Delete", OnDelete, "Delete");
            AddContextSeparator();
            AddContextActionWithAccel("Undo", OnUndo, "Ctrl+Z");
            AddContextActionWithAccel("Redo", OnRedo, "Ctrl+Y");
            AddContextActionWithAccel("Find", OnFind, "Ctrl+F");
            AddContextActionWithAccel("Replace", OnReplace, "Ctrl+H");

            CompletionForm                 = new Window(WindowType.Toplevel);
            CompletionForm.Decorated       = false;
            CompletionForm.SkipPagerHint   = true;
            CompletionForm.SkipTaskbarHint = true;
            Frame completionFrame = new Frame();

            CompletionForm.Add(completionFrame);
            ScrolledWindow completionScroller = new ScrolledWindow();

            completionFrame.Add(completionScroller);
            completionModel = new ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string));
            CompletionView  = new TreeView(completionModel);
            completionScroller.Add(CompletionView);
            TreeViewColumn     column     = new TreeViewColumn();
            CellRendererPixbuf iconRender = new Gtk.CellRendererPixbuf();

            column.PackStart(iconRender, false);
            CellRendererText textRender = new Gtk.CellRendererText();

            textRender.Editable = false;
            column.PackStart(textRender, true);
            column.SetAttributes(iconRender, "pixbuf", 0);
            column.SetAttributes(textRender, "text", 1);
            column.Title     = "Item";
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            textRender       = new CellRendererText();
            column           = new TreeViewColumn("Units", textRender, "text", 2);
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            textRender       = new CellRendererText();
            column           = new TreeViewColumn("Type", textRender, "text", 3);
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            textRender       = new CellRendererText();
            column           = new TreeViewColumn("Descr", textRender, "text", 4);
            column.Resizable = true;
            CompletionView.AppendColumn(column);
            functionPixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.Function.png", 16, 16);
            propertyPixbuf = new Gdk.Pixbuf(null, "ApsimNG.Resources.Property.png", 16, 16);
            textEditor.TextArea.KeyPressEvent += OnKeyPress;
            CompletionView.HasTooltip          = true;
            CompletionView.TooltipColumn       = 5;
            CompletionForm.FocusOutEvent      += OnLeaveCompletion;
            CompletionView.ButtonPressEvent   += OnContextListMouseDoubleClick;
            CompletionView.KeyPressEvent      += OnContextListKeyDown;
            CompletionView.KeyReleaseEvent    += CompletionView_KeyReleaseEvent;
            IntelliSenseChars = ".";
        }