示例#1
0
        private void InitializeComponent()
        {
            Width = 550;
            Height = 600;
            //Location = WindowLocation.CenterScreen;

            vbox2 = new VBox();
            vbox2.Visible = true;
            vbox2.Spacing = 3;

            notebook1 = new Notebook();
            notebook1.Visible = true;
            notebook1.CanGetFocus = true;

            image1 = new ImageView();
            string file = FileHelper.FindSupportFile("bygfoot_splash.png", false);
            image1.Image = Image.FromFile(file);

            treeview_splash_contributors = new TreeView();

            scrolledwindow2 = new ScrollView();
            scrolledwindow2.Content = treeview_splash_contributors;

            notebook1.Add(image1, "");
            notebook1.Add(scrolledwindow2, "");
            vbox2.PackStart(notebook1);

            Content = vbox2;
        }
示例#2
0
    public ChangesetView(Driver driver, int stopAfter)
    {
        this.driver = driver;
            this.stopAfter = stopAfter;

            InitializeChangesetList();

            ScrolledWindow scrolledWindow1 = new ScrolledWindow();
            scrolledWindow1.Add(changesetList);

            Add1(scrolledWindow1);

            viewChildren = new Notebook ();
            viewChildren.TabPos = PositionType.Bottom;
            Add2(viewChildren);

            changesetDetailView = new ChangesetDetailView(driver);
            viewChildren.AppendPage (changesetDetailView, new Label ("Details"));

            changesetDiffView = new ChangesetDiffView(driver);
            viewChildren.AppendPage (changesetDiffView, new Label ("Unified Diff"));

            int x, y, width, height, depth;
            RootWindow.GetGeometry (out x, out y, out width, out height, out depth);
            Position = Convert.ToInt32((height - 40) * 0.4);

            viewChildren.SwitchPage += OnSwitchPage;
    }
示例#3
0
    public PreferencesDialog(ItemShelf itemShelf)
        : base()
    {
        this.itemShelf = itemShelf;

        this.Title = Mono.Posix.Catalog.GetString ("Preferences");
        this.HasSeparator = false;
        this.SetDefaultSize (300, 200);

        Notebook notebook = new Notebook ();

        Glade.XML gxml = new Glade.XML (null, "themeselection.glade", "hbox1", null);
        HBox hBox = (HBox)gxml["hbox1"];
        ScrolledWindow scrolledwindow = (ScrolledWindow)gxml["scrolledwindow1"];
        TreeView themeTreeview = CreateThemeTreeView ();
        themeTreeview.Selection.Changed += OnThemeTreeViewSelectionChanged;

        scrolledwindow.Add (themeTreeview);

        notebook.AppendPage (hBox, new Label (Mono.Posix.Catalog.GetString ("Theme")));

        this.VBox.Add (notebook);

        Button closeButton = (Button)this.AddButton (Gtk.Stock.Close, 1);
        closeButton.Clicked += OnCloseButtonClicked;

        this.ShowAll();
    }
示例#4
0
 public NotebookSample()
 {
     Notebook nb = new Notebook ();
     nb.Add (new Label ("First tab content"), "First Tab");
     nb.Add (new MyWidget (), "Second Tab");
     PackStart (nb, BoxMode.FillAndExpand);
 }
示例#5
0
        public void Criar_notebook_Apple()
        {
            _fabricante = new Apple();
            _notebook = _fabricante.Notebook;

            Assert.IsInstanceOf(typeof(MacBookAirMd71), _notebook);
        }
示例#6
0
        public void Criar_notebook_Sony()
        {
            _fabricante = new Sony();
            _notebook = _fabricante.Notebook;

            Assert.IsInstanceOf(typeof(SonyVaioFit15Svf), _notebook);
        }
示例#7
0
        public void Criar_notebook_Dell()
        {
            _fabricante = new Dell();
            _notebook = _fabricante.Notebook;

            Assert.IsInstanceOf(typeof(Inspiron15R5437), _notebook);
        }
示例#8
0
 public NotebookSample()
 {
     Notebook nb = new Notebook ();
     nb.Add (new Label ("First tab content"), "First Tab");
     nb.Add (new MyWidget (), "Second Tab");
     nb.TabOrientation = NotebookTabOrientation.Bottom;
     PackStart (nb, true);
 }
示例#9
0
        public NotebookSample()
        {
            Notebook nb = new Notebook();
            nb.Add(new ListView2(), "Browser Settings");
            nb.Add(new Tables(), "Locators");
            nb.Add(new TreeViews(), "Page Objects");
            nb.Add(new RadioButtonSample(), "Locators");
            nb.Add(new MyTestWidget(), "Source Code");
            nb.Add(new Frames(), "HTML Source");
            nb.Add(new ScrollWindowSample(), "ScrollWindow");
                        nb.Add(new TextEntries (), "Playground");

            nb.TabOrientation = NotebookTabOrientation.Top;
            PackStart(nb, true);
        }
示例#10
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        box = new VBox (false, 2);
        Add (box);

        UnitEditor.MainMenu mb = new UnitEditor.MainMenu ();
        this.AddAccelGroup (mb.uim.AccelGroup);
        box.PackStart(mb.instance, false, false, 0);

        nb = new Notebook ();
        box.PackStart (nb, false, false, 0);

        ShowAll ();
    }
示例#11
0
    public ExploreView(Driver driver, int stopAfter)
        : base("Explore")
    {
        int x, y, width, height, depth;
        RootWindow.GetGeometry (out x, out y, out width, out height, out depth);
        SetDefaultSize (width - 50, height - 40);

        VBox vBox = new VBox(false, 1);
        Add(vBox);

        HPaned hPaned = new HPaned();
        vBox.Add(hPaned);

        ScrolledWindow scrolledWindow = new ScrolledWindow();
        //scrolledWindow.SetDefaultSize (Convert.ToInt32((width - 50) * 0.4), height -40);
        hPaned.Add1(scrolledWindow);

        repositoryView = new RepositoryView(driver);
        scrolledWindow.Add(repositoryView);

        viewChildren = new Notebook ();

        changesetView = new ChangesetView(driver, stopAfter);
        viewChildren.AppendPage (changesetView, new Label ("Changeset View"));

        directoryView = new DirectoryView(driver);
        viewChildren.AppendPage (directoryView, new Label ("Directory View"));

        fileView = new FileView(driver);
        viewChildren.AppendPage (fileView, new Label ("File View"));

        hPaned.Add2(viewChildren);
        hPaned.Position = (width - 50) / 3;

        // add status bar
        Statusbar sb = new Statusbar ();
        sb.HasResizeGrip = false;
        vBox.PackEnd(sb, false, false, 1);

         		ShowAll();

        repositoryView.Selection.Changed += OnPathSelectionChanged;
        viewChildren.SwitchPage += OnSwitchPage;
    }
    public static Sizer NotebookFunc( Window parent, bool call_fit, bool set_sizer )
    {
        BoxSizer item0 = new BoxSizer( Orientation.wxVERTICAL );

        Notebook item2 = new Notebook( parent, ID_NOTEBOOK, Window.wxDefaultPosition, new Size(200,160), 0 );
        NotebookSizer item1 = new NotebookSizer( item2 );

        Panel item3 = new Panel( item2, -1 );
        PageOneFunc( item3, false );
        item2.AddPage( item3, "Page 1" );

        Panel item4 = new Panel( item2, -1 );
        PageTwoFunc( item4, false );
        item2.AddPage( item4, "Page 2" );

        Panel item5 = new Panel( item2, -1 );
        item2.AddPage( item5, "Page 3" );

        item0.Add( item1, 0, Alignment.wxALIGN_CENTER|Direction.wxALL, 5 );

        StaticLine item6 = new StaticLine( parent, ID_LINE, Window.wxDefaultPosition, new Size(20,-1), StaticLine.wxLI_HORIZONTAL );
        item0.Add( item6, 0, Stretch.wxGROW|Alignment.wxALIGN_CENTER_VERTICAL|Direction.wxALL, 5 );

        BoxSizer item7 = new BoxSizer( Orientation.wxHORIZONTAL );

        Button item8 = new Button( parent, Window.wxID_OK, "OK", Window.wxDefaultPosition, Window.wxDefaultSize, 0 );
        item8.SetDefault();
        item7.Add( item8, 0, Alignment.wxALIGN_CENTER|Direction.wxALL, 5 );

        Button item9 = new Button( parent, Window.wxID_CANCEL, "Cancel", Window.wxDefaultPosition, Window.wxDefaultSize, 0 );
        item7.Add( item9, 0, Alignment.wxALIGN_CENTER|Direction.wxALL, 5 );

        item0.Add( item7, 0, Alignment.wxALIGN_CENTER|Direction.wxLEFT|Direction.wxRIGHT|Direction.wxBOTTOM, 5 );

        if (set_sizer)
        {
            parent.SetSizer( item0 );
            if (call_fit)
                item0.SetSizeHints( parent );
        }

        return item0;
    }
示例#13
0
		public void HiddenTree ()
		{
			var f = new DataField<string> ();
			TreeStore ts = new TreeStore (f);
			var node = ts.AddNode ().SetValue (f, "1").AddChild ().SetValue (f, "2").AddChild ().SetValue (f, "3");
			var tree = new TreeView (ts);

			Window w = new Window ();
			Notebook nb = new Notebook ();
			nb.Add (new Label ("Hi"), "One");
			nb.Add (tree, "Two");
			w.Content = nb;
			ShowWindow (w);

			tree.ScrollToRow (node.CurrentPosition);

			tree.Columns.Add ("Hi", f);

			tree.ScrollToRow (node.CurrentPosition);
		}
示例#14
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        Notebook notebook = new Notebook();

        LampManager.ApachePanel apachepanel = new LampManager.ApachePanel();
        notebook.AppendPage(apachepanel, new Label("Apache"));

        LampManager.PHPPanel phppanel = new LampManager.PHPPanel();
        notebook.AppendPage(phppanel, new Label("PHP"));

        LampManager.SettingsPanel settingsPanel = new LampManager.SettingsPanel();
        notebook.AppendPage(settingsPanel, new Label("Settings"));

        hbox1.Add(notebook);
        notebook.Show();
        apachepanel.Show();
        phppanel.Show();
        settingsPanel.Show();
    }
示例#15
0
        private void Build()
        {
            if(Toolkit.CurrentEngine.Type == ToolkitType.Wpf)
                this.BackgroundColor = (new Button()).BackgroundColor;

            vbox1 = new VBox();

            label1 = new Label("Select Font:");
            label1.MarginTop = 4;
            label1.MarginRight = 4;
            label1.MarginLeft = 4;
            vbox1.PackStart(label1);

            table1 = new Table();
            table1.MarginRight = 4;
            table1.MarginLeft = 4;

            radioButton1 = new RadioButton("From System: ");
            table1.Add(radioButton1, 0, 0);

            combo_font = new ComboBox();

            List<string> fonts = new List<string>();
            foreach (System.Drawing.FontFamily font in System.Drawing.FontFamily.Families)
                fonts.Add(font.Name);
            fonts.Sort();
            foreach (string font in fonts)
                combo_font.Items.Add(font);

            if(combo_font.Items.Contains("Arial"))
                combo_font.SelectedText = "Arial";
            else if(combo_font.Items.Count > 0)
                combo_font.SelectedIndex = 0;
            combo_font.Font = Xwt.Drawing.Font.FromName(combo_font.SelectedText).WithSize(combo_font.Font.Size);

            table1.Add(combo_font, 1, 0, 1, 1, true);

            radioButton2 = new RadioButton();
            radioButton2.Label = "From File: ";
            radioButton2.Sensitive = true;
            radioButton2.Group = radioButton1.Group;
            table1.Add(radioButton2, 0, 1);

            hbox1 = new HBox();

            entry_font = new TextEntry();
            entry_font.Sensitive = false;
            hbox1.PackStart(entry_font, true);

            button_font = new Button("Browse");
            button_font.Sensitive = false;
            hbox1.PackStart(button_font);

            table1.Add(hbox1, 1, 1);

            vbox1.PackStart(table1);

            notebook1 = new Notebook();
            notebook1.ExpandHorizontal = true;
            notebook1.ExpandVertical = true;

            table2 = new Table();
            table2.Margin = 4;

            label4 = new Label("Style:");
            table2.Add(label4, 0, 0);

            hbox2 = new HBox();

            check_bold = new CheckBox("Bold ");
            check_bold.BackgroundColor = Color.FromBytes(0, 0, 0, 0);
            hbox2.PackStart(check_bold);

            check_italic = new CheckBox("Italic ");
            check_italic.BackgroundColor = Color.FromBytes(0, 0, 0, 0);
            hbox2.PackStart(check_italic);

            check_kerning = new CheckBox("Kerning ");
            check_kerning.BackgroundColor = Color.FromBytes(0, 0, 0, 0);
            hbox2.PackStart(check_kerning);

            table2.Add(hbox2, 0, 1, 1, 1);

            label2 = new Label("Size:");
            table2.Add(label2, 0, 2);

            entry_size = new NumericEntry("0", "WARNING: Size needs to be a number");
            table2.Add(entry_size, 0, 3, 1, 1, true);

            label3 = new Label("Spacing:");
            table2.Add(label3, 0, 4);

            entry_spacing = new NumericEntry("0", "WARNING: Spacing needs to be a number");
            table2.Add(entry_spacing, 0, 5, 1, 1, true);

            check_defchar = new CheckBox("Default Character:");
            check_defchar.BackgroundColor = Color.FromBytes(0, 0, 0, 0);
            table2.Add(check_defchar, 0, 6);

            entry_defchar = new TextEntry();
            entry_defchar.Sensitive = false;
            entry_defchar.TextAlignment = Alignment.Center;
            table2.Add(entry_defchar, 0, 7, 1, 1, true);

            notebook1.Add(table2, "Global");

            hbox3 = new HBox();

            listView1 = new ListView();
            hbox3.PackStart(listView1, true);

            vbox2 = new VBox();
            vbox2.MarginRight = 5;
            vbox2.MarginTop = 5;

            label8 = new Label(" Main:");
            vbox2.PackStart(label8);

            button_plus = new Button("Add");
            vbox2.PackStart(button_plus);

            button_minus = new Button("Remove");
            button_minus.Sensitive = false;
            vbox2.PackStart(button_minus);

            button_edit = new Button("Edit");
            button_edit.Sensitive = false;
            vbox2.PackStart(button_edit);

            vbox2.PackStart(new HSeparator());

            label9 = new Label(" Move:");
            vbox2.PackStart(label9);

            button_up  = new Button("Up");
            button_up.Sensitive = false;
            vbox2.PackStart(button_up);

            button_down  = new Button("Down");
            button_down.Sensitive = false;
            vbox2.PackStart(button_down);

            hbox3.PackStart(vbox2);

            notebook1.Add(hbox3, "Characters");

            var pa = new VBox();

            textEditor1 = new TextEditor();
            textEditor1.Document.MimeType = "application/xml";

            pa.PackStart(textEditor1, true);
            notebook1.Add(pa, "Xml");

            vbox3 = new VBox();

            hbox4 = new HBox();
            hbox4.Margin = 5;

            label5 = new Label("Font Color: ");
            hbox4.PackStart(label5);

            color_font = new ColorPicker();
            color_font.Color = Color.FromBytes(0, 0, 0);
            color_font.SupportsAlpha = false;
            hbox4.PackStart(color_font);

            label6 = new Label("Background Color: ");
            hbox4.PackStart(label6);

            color_back = new ColorPicker();
            color_back.Color = Color.FromBytes(224, 224, 209);
            color_back.SupportsAlpha = false;
            hbox4.PackStart(color_back);

            vbox3.PackStart(hbox4);

            hbox5 = new HBox();
            hbox5.MarginLeft = 5;
            hbox5.MarginRight = 5;

            label7 = new Label("Text: ");
            hbox5.PackStart(label7);

            entry_text = new TextEntry();
            entry_text.Text = "The quick brown fox jumps over the lazy dog";
            hbox5.PackStart(entry_text, true);

            button_preview = new Button("Preview");
            hbox5.PackStart(button_preview);

            vbox3.PackStart(hbox5);

            web1 = new WebView();

            scrollView2 = new ScrollView();
            scrollView2.HorizontalScrollPolicy = ScrollPolicy.Automatic;
            scrollView2.VerticalScrollPolicy = ScrollPolicy.Automatic;

            if (Toolkit.CurrentEngine.Type != ToolkitType.Gtk)
                scrollView2.Content = web1;

            vbox3.PackStart(scrollView2, true);

            notebook1.Add(vbox3, "Preview");

            vbox1.PackStart(notebook1, true);

            this.Content = vbox1;
        }
示例#16
0
        void CreatePageWidget(SectionPage page)
        {
            List <PanelInstance> boxPanels = new List <PanelInstance> ();
            List <PanelInstance> tabPanels = new List <PanelInstance> ();

            foreach (PanelInstance pi in page.Panels)
            {
                if (pi.Widget == null)
                {
                    pi.Widget = pi.Panel.CreatePanelWidget();
                    //HACK: work around bug 469427 - broken themes match on widget names
                    if (pi.Widget.Name.IndexOf("Panel") > 0)
                    {
                        pi.Widget.Name = pi.Widget.Name.Replace("Panel", "_");
                    }
                }
                else if (pi.Widget.Parent != null)
                {
                    ((Gtk.Container)pi.Widget.Parent).Remove(pi.Widget);
                }

                if (pi.Node.Grouping == PanelGrouping.Tab)
                {
                    tabPanels.Add(pi);
                }
                else
                {
                    boxPanels.Add(pi);
                }
            }

            // Try to fit panels with grouping=box or auto in the main page.
            // If they don't fit. Move auto panels to its own tab page.

            int  mainPageSize;
            bool fits;

            do
            {
                PanelInstance lastAuto = null;
                mainPageSize = 0;
                foreach (PanelInstance pi in boxPanels)
                {
                    if (pi.Node.Grouping == PanelGrouping.Auto)
                    {
                        lastAuto = pi;
                    }
                    // HACK: This we are parenting/unparenting the widget here as a workaround
                    // for a layout issue. To properly calculate the size of the widget, the widget
                    // needs to have the style that it will have when added to the window.
                    pi.Widget.Parent = this;
                    mainPageSize    += pi.Widget.SizeRequest().Height + 6;
                    pi.Widget.Unparent();
                }
                fits = mainPageSize <= pageFrame.Allocation.Height;
                if (!fits)
                {
                    if (lastAuto != null && boxPanels.Count > 1)
                    {
                        boxPanels.Remove(lastAuto);
                        tabPanels.Insert(0, lastAuto);
                    }
                    else
                    {
                        fits = true;
                    }
                }
            } while (!fits);

            Gtk.VBox box = new VBox(false, 12);
            box.Show();
            for (int n = 0; n < boxPanels.Count; n++)
            {
                if (n != 0)
                {
                    HSeparator sep = new HSeparator();
                    sep.Show();
                    box.PackStart(sep, false, false, 0);
                }
                PanelInstance pi = boxPanels [n];
                box.PackStart(pi.Widget, pi.Node.Fill, pi.Node.Fill, 0);
                pi.Widget.Show();
            }

            box.BorderWidth = 12;

            if (tabPanels.Count > 0)
            {
                /*				SquaredNotebook nb = new SquaredNotebook ();
                 * nb.Show ();
                 * nb.AddTab (box, GettextCatalog.GetString ("General"));
                 * foreach (PanelInstance pi in tabPanels) {
                 *      Gtk.Alignment a = new Alignment (0, 0, 1, 1);
                 *      a.BorderWidth = 9;
                 *      a.Show ();
                 *      a.Add (pi.Widget);
                 *      nb.AddTab (a, GettextCatalog.GetString (pi.Node.Label));
                 *      pi.Widget.Show ();
                 * }*/
                Gtk.Notebook nb = new Notebook();
                nb.Show();
                Gtk.Label blab = new Gtk.Label(GettextCatalog.GetString("General"));
                blab.Show();
                box.BorderWidth = 9;
                nb.InsertPage(box, blab, -1);
                foreach (PanelInstance pi in tabPanels)
                {
                    Gtk.Label lab = new Gtk.Label(GettextCatalog.GetString(pi.Node.Label));
                    lab.Show();
                    Gtk.Alignment a = new Alignment(0, 0, 1, 1);
                    a.BorderWidth = 9;
                    a.Show();
                    a.Add(pi.Widget);
                    nb.InsertPage(a, lab, -1);
                    pi.Widget.Show();
                }
                page.Widget    = nb;
                nb.BorderWidth = 12;
            }
            else
            {
                page.Widget = box;
            }
        }
 // Constructor for a Business notebook
 internal ENNotebook(Notebook notebook, SharedNotebook sharedNotebook, LinkedNotebook linkedNotebook)
 {
     Notebook       = notebook;
     SharedNotebook = sharedNotebook;
     LinkedNotebook = linkedNotebook;
 }
示例#18
0
        public ListBookNavigator(Notebook owner)
        {
            this.owner = owner;

            this.DrawMode = DrawMode.OwnerDrawVariable;
        }
示例#19
0
 public Notebook Add(Notebook notebook)
 {
     return(_notebookRepos.Add(notebook));
 }
示例#20
0
	  /******************************************
			THIS IS AUTO GENERATED CODE BY GLADEBUILDER
			DO NOT EDIT
			USE THE IMPLEMENTATION CLASS INSTEAD
	  *******************************************/
	  namespace GladeBuilder
示例#21
0
    // must be run from the SQLite thread
    public static void Run(Notebook notebook, ScriptEnv env, ScriptRunner runner, Ast.ExportTxtStmt stmt)
    {
        var exporter = new ExportTxtStmtRunner(notebook, env, runner, stmt);

        exporter.Export();
    }
示例#22
0
 public DataResult Create(Notebook notebook)
 {
     throw new NotImplementedException();
 }
示例#23
0
 public void SendSelectedNotebook(Notebook notebook)
 {
     throw new NotImplementedException();
 }
示例#24
0
 public void bookCreated(Notebook book)
 {
     this.onBookCreated(this, book);
 }
示例#25
0
 public void bookDeleted(Notebook book)
 {
     this.onBookDeleted(this, book);
 }
示例#26
0
 public void setNoteBook(Notebook book)
 {
 }
示例#27
0
 public void updateNotebook(Notebook book)
 {
 }
示例#28
0
 public void selectNotebook(Notebook book)
 {
     this.onBookSelected(this, book);
 }
示例#29
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        m_scrapeViewModel = new ScrapeViewModel();

        VBox vbox = new VBox();
        {
            HBox hbox = new HBox();
            {
                m_urlEntry = new Entry("http://www.google.com");
                {
                    m_urlEntry.Changed += OnUrlEntryChanged;

                    hbox.PackStart(m_urlEntry, true, true, 4);
                }

                m_startButton = new Button(c_startButtonText);
                {
                    m_startButton.SetSizeRequest(60, 16);
                    m_startButton.TooltipText = "Start crawling the site.";

                    m_startButton.Clicked += OnStartButtonClicked;

                    hbox.PackEnd(m_startButton, false, true, 4);
                }

                vbox.PackStart(hbox, false, true, 8);
            }

            Notebook notebook = new Notebook();
            {
                ScrolledWindow scrolledWindow = new ScrolledWindow();
                {
                    TreeView treeview = new TreeView();
                    {
                        treeview.SetSizeRequest(200, 200);
                        treeview.HeadersVisible = false;

                        TreeViewColumn colOne = new TreeViewColumn();
                        {
                            CellRendererText cellRendererText = new CellRendererText();
                            {
                                colOne.PackStart(cellRendererText, true);
                                colOne.AddAttribute(cellRendererText, "text", 0);
                            }

                            treeview.AppendColumn(colOne);
                        }

                        treeview.Model = m_scrapeViewModel.ExploredLinks;

                        scrolledWindow.Add(treeview);
                    }

                    notebook.AppendPage(scrolledWindow, new Label("Explored Link"));
                }

                vbox.Add(notebook);
            }

            this.Add(vbox);
        }

        this.DeleteEvent += OnDeleteEvent;

        this.ShowAll();
    }
示例#30
0
 internal GtkNotebookResult(Widget notebookWidget) : base(notebookWidget)
 {
     noteBook = notebookWidget as Notebook;
 }
示例#31
0
    private void AllowStaticAccess()
    {
        _tvShareBrowser = this.tvShareBrowser;
        _tvPlaylist		= this.tvPlaylist;
        _cbShareType	= this.cbShareType;
        _hsVolume		= this.hsVolume;
        _hsProgress 	= this.hsProgress;
        _tbMute			= this.tbMute;
        _bPrevious		= this.bPrevious;
        _tbPlay			= this.tbPlay;
        _tbStop			= this.tbStop;
        _bNext			= this.bNext;
        _imgNowPlaying	= this.imgNowPlaying;
        _imgLoading		= this.imgLoading;
        _fixedNowPlaying= this.fixedNowPlaying;

        _lArtist 		= this.lArtist;
        _lSong			= this.lSong;
        _lAlbum			= this.lAlbum;
        _lGenre			= this.lGenre;
        _lProgress		= this.lProgress;
        _lDuration		= this.lDuration;
        _lYear			= this.lYear;

        _nbDataContainer= this.nbDataContainer;
    }
示例#32
0
 protected override void Dispose(bool disposing)
 {
     noteBook = null;
     base.Dispose(disposing);
 }
示例#33
0
 public override System.Web.Mvc.ActionResult Create(Notebook.Models.Note.CreateNoteVM note, string hiddenTags)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Create);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "note", note);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "hiddenTags", hiddenTags);
     CreateOverride(callInfo, note, hiddenTags);
     return callInfo;
 }
示例#34
0
	public void InitializeGui()
	{
		m_MainPanel = new Fixed();
		m_OutConnectionStatus = new Label("Jaco is not connected.");
		
		m_GeneralPanel = new Fixed();
		m_TxtSerial = new Label("Jaco serial # :");
	    m_TxtModel = new Label("Jaco model :");
	    m_TxtSoftwareVersion = new Label("Software version :");
		m_TxtClientID = new Label("Client ID :");
	    m_TxtClientName = new Label("Client name :");
	    m_TxtClientOrganization = new Label("Client organization :");
		m_OutSerial = new Label("????");
	    m_OutModel = new Label("????");
	    m_OutSoftwareVersion = new Label("????");
		m_InClientID = new Entry("");
	    m_InClientName = new Entry("");
	    m_InClientOrganization = new Entry("");
		m_BTNUpdateGeneral = new Button("Update Jaco");
		m_BTNUpdateGeneral.Clicked += new EventHandler(BTN_UpdateClick);
		m_BTNReadGeneral = new Button("Read from Jaco");
		m_BTNReadGeneral.Clicked += new EventHandler (BTN_ReadClick);
		
		m_ConfigurationPanel = new Fixed();
		m_TxtSensitivity = new Label("Control's sensitivity :");
		m_TxtMaxSpeed = new Label("Permitted max speed :");
		m_TxtDrinkingHeight = new Label("Drinking height :");
		m_TxtDrinkingDistance = new Label("Drinking distance :");
		m_TxtLaterality = new Label("Laterality :");
		m_TxtFingersInverted = new Label("Fingers inverted :");
		m_TxtRetractAngle = new Label("Retracted position angle :");
		m_InSensitivity = new Entry("");
		m_InMaxSpeed = new Entry("");
		m_InDrinkingHeight = new Entry("");
		m_InDrinkingDistance = new Entry("");
		m_RadioRightHanded = new RadioButton("Righthanded");
		m_RadioLeftHanded = new RadioButton("Lefthanded");
		m_RadioLeftHanded.Group = m_RadioRightHanded.Group;
		m_CheckFingersInverted = new CheckButton("Invert fingers");
		m_InRetractAngle = new Entry("");
		m_BTNUpdateConfig = new Button("Update Jaco");
		m_BTNUpdateConfig.Clicked += new EventHandler(BTN_UpdateClick);
		m_BTNReadConfig = new Button("Read from Jaco");
		m_BTNReadConfig.Clicked += new EventHandler(BTN_ReadClick);
		
		m_DiagnosisPanel = new Fixed();
		m_TxtAxis1Version = new Label("Axis 1 version :");
		m_TxtAxis2Version = new Label("Axis 2 version :");
		m_TxtAxis3Version = new Label("Axis 3 version :");
		m_TxtAxis4Version = new Label("Axis 4 version :");
		m_TxtAxis5Version = new Label("Axis 5 version :");
		m_TxtAxis6Version = new Label("Axis 6 version :");
		m_TxtFinger1Version = new Label("Finger 1 version :");
		m_TxtFinger2Version = new Label("Finger 2 version :");
		m_TxtFinger3Version = new Label("Finger 3 version :");
		m_TxtMainCANVersion = new Label("Main CAN version :");
		m_TxtExtCANVersion = new Label("Ext CAN Version :");
		m_OutAxis1Version = new Label("????");
		m_OutAxis2Version = new Label("????");
		m_OutAxis3Version = new Label("????");
		m_OutAxis4Version = new Label("????");
		m_OutAxis5Version = new Label("????");
		m_OutAxis6Version = new Label("????");
		m_OutFinger1Version = new Label("????");
		m_OutFinger2Version = new Label("????");
		m_OutFinger3Version = new Label("????");
		m_OutMainCANVersion = new Label("????");
		m_OutExtCANVersion = new Label("????");
		m_TxtInfo = new Label("");
		m_InFileReprogram = new FileChooserButton("Select a file", FileChooserAction.Open);
		m_InFileReprogram.WidthRequest = 440;
		m_BTNReprogram = new Button("Reprogram Jaco");
		m_BTNReprogram.Clicked += new EventHandler(BTN_ReprogramClick);
		m_BTNReadDiagnosis = new Button("Read from Jaco");
		m_BTNReadDiagnosis.Clicked += new EventHandler(BTN_ReadClick);
		
		m_MainTitle = new Label("Kinova software example");
		Pango.FontDescription fontMaintTile = Pango.FontDescription.FromString("Garamond 30");
		m_MainTitle.ModifyFont(fontMaintTile);
		
		m_TabGeneral = new Label("General");
		m_TabConfiguration = new Label("Configuration");
		m_TabDiagnosis = new Label("Diagnosis");
		
		m_MainTab = new Notebook();
		m_MainTab.WidthRequest = 500;
		m_MainTab.HeightRequest = 500;
		m_MainTab.AppendPage(m_GeneralPanel, m_TabGeneral);
		m_MainTab.AppendPage(m_ConfigurationPanel, m_TabConfiguration);
		m_MainTab.AppendPage(m_DiagnosisPanel, m_TabDiagnosis);
	}
示例#35
0
        public void Execute(object parameter)
        {
            Notebook notebook = parameter as Notebook;

            VM.RenameNotebook(notebook);
        }
示例#36
0
        public async Task <IActionResult> CreateNoteBook(string token, string noteRepositoryId, string notebookTitle, string parentNotebookId, string dataSignJson)
        {
            var  re           = new ApiRe();
            var  user         = tokenSerivce.GetUserByToken(token);
            long?parentId     = null;
            bool verify       = false;
            long?repositoryId = null;

            //验证签名
            if (this.config.SecurityConfig.ForceDigitalSignature)
            {
                var dataSign = DataSignDTO.FromJSON(dataSignJson);
                verify = await this.ePassService.VerifyDataSign(dataSign);

                if (!verify)
                {
                    return(LeanoteJson(re));
                }
                verify = dataSign.SignData.Operate.Equals("/api/Notebook/CreateNoteBook");
                if (!verify)
                {
                    re.Msg = "Operate is not Equals ";
                    return(LeanoteJson(re));
                }
                //签名存证
                this.dataSignService.AddDataSign(dataSign, "CreateNoteBook");
            }



            if (string.IsNullOrEmpty(noteRepositoryId))
            {
                return(LeanoteJson(re));
            }

            if (string.IsNullOrEmpty(parentNotebookId))
            {
                verify       = noteRepositoryService.Verify(noteRepositoryId.ToLongByHex(), user.UserId, RepositoryAuthorityEnum.Write);
                repositoryId = noteRepositoryId.ToLongByHex();
            }
            else
            {
                var parentNotebook = notebookService.GetNotebookById(parentNotebookId.ToLongByHex());
                if (user == null || parentNotebook == null)
                {
                    return(LeanoteJson(re));
                }
                repositoryId = parentNotebook.NotesRepositoryId;
                if (repositoryId != noteRepositoryId.ToLongByHex())
                {
                    return(LeanoteJson(re));
                }
                verify   = noteRepositoryService.Verify(repositoryId, user.UserId, RepositoryAuthorityEnum.Write);
                parentId = parentNotebook.NotebookId;
            }


            if (!verify)
            {
                return(LeanoteJson(re));
            }
            var notebook = new Notebook()
            {
                NotebookId        = idGenerator.NextId(),
                NotesRepositoryId = repositoryId,
                Seq    = 0,
                UserId = user.UserId,

                CreatedTime      = DateTime.Now,
                Title            = notebookTitle,
                ParentNotebookId = parentId,
            };

            notebookService.AddNotebook(notebook);
            re.Ok   = true;
            re.Data = notebook;

            return(LeanoteJson(re));
        }
            public ICSGameObserverWidget(ICSClient
						      client)
                : base()
            {
                split = new HPaned ();
                this.client = client;
                currentGames = new Hashtable ();
                gamesBook = new Notebook ();
                gamesBook.ShowTabs = false;

                gamesList = new TreeView ();
                gamesStore =
                    new ListStore (typeof (string),
                               typeof (string));
                gamesList.Model = gamesStore;
                gamesList.AppendColumn ("Games",
                            new
                            CellRendererText (),
                            "markup", 0);
                ScrolledWindow scroll = new ScrolledWindow ();
                scroll.HscrollbarPolicy =
                    scroll.VscrollbarPolicy =
                    PolicyType.Automatic;
                scroll.Add (gamesList);

                gamesList.CursorChanged +=
                    OnGamesListCursorChanged;
                split.Add1 (scroll);
                split.Add2 (gamesBook);

                split.ShowAll ();
                PackStart (split, true, true, 2);
                client.GameMessageEvent += OnGameMessage;
            }
        public SelectReferenceDialog()
        {
            Build();

            combinedBox = new CombinedBox();
            combinedBox.Show();
            mainBook = new Notebook();
            combinedBox.Add(mainBook);
            alignment1.Add(combinedBox);
            mainBook.ShowAll();

            filterEntry = combinedBox.FilterEntry;

            boxRefs.WidthRequest = 200;

            refTreeStore             = new ListStore(typeof(string), typeof(string), typeof(string), typeof(ProjectReference), typeof(Xwt.Drawing.Image));
            ReferencesTreeView.Model = refTreeStore;

            TreeViewColumn col = new TreeViewColumn();

            col.Title = GettextCatalog.GetString("Reference");
            CellRendererImage crp = new CellRendererImage();

            crp.Yalign = 0f;
            col.PackStart(crp, false);
            col.AddAttribute(crp, "image", IconColumn);
            CellRendererText text_render = new CellRendererText();

            col.PackStart(text_render, true);
            col.AddAttribute(text_render, "markup", NameColumn);
            text_render.Ellipsize = Pango.EllipsizeMode.End;

            ReferencesTreeView.AppendColumn(col);
//			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Type"), new CellRendererText (), "text", TypeNameColumn);
//			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Location"), new CellRendererText (), "text", LocationColumn);

            projectRefPanel  = new ProjectReferencePanel(this);
            packageRefPanel  = new PackageReferencePanel(this, false);
            allRefPanel      = new PackageReferencePanel(this, true);
            assemblyRefPanel = new AssemblyReferencePanel(this);
            panels.Add(allRefPanel);
            panels.Add(packageRefPanel);
            panels.Add(projectRefPanel);
            panels.Add(assemblyRefPanel);

            //mainBook.RemovePage (mainBook.CurrentPage);

            HBox tab = new HBox(false, 3);

//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Reference, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString("_All")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(allRefPanel, tab);

            tab = new HBox(false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Package, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString("_Packages")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(packageRefPanel, tab);

            tab = new HBox(false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Project, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString("Pro_jects")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(projectRefPanel, tab);

            tab = new HBox(false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.OpenFolder, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString(".Net A_ssembly")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(assemblyRefPanel, tab);

            mainBook.Page = 0;

            var w = selectedHeader.Child;

            selectedHeader.Remove(w);
            HeaderBox header = new HeaderBox(1, 0, 1, 1);

            header.SetPadding(6, 6, 6, 6);
            header.GradientBackround = true;
            header.Add(w);
            selectedHeader.Add(header);

            RemoveReferenceButton.CanFocus        = false;
            ReferencesTreeView.Selection.Changed += new EventHandler(OnChanged);
            Child.ShowAll();
            OnChanged(null, null);
            InsertFilterEntry();
        }
        /// <summary>
        /// Called when the user chooses "Export Notebook"
        /// (Even when "All Notes or "Unfiled Notes" are
        /// selected.)
        /// </summary>
        void ExportNotebookButtonClicked(object sender, EventArgs args)
        {
            string output_folder        = null;
            ExportMultipleDialog dialog = null;

            Logger.Info("Activated export notebook to " + export_file_suffix);

            Notebook notebook = NoteRecentChanges.GetInstance(Tomboy.DefaultNoteManager).GetSelectedNotebook();

            try {
                //Handling the two special notebooks
                string notebook_name = notebook.NormalizedName;
                if (notebook_name == "___NotebookManager___AllNotes__Notebook___")
                {
                    Logger.Info("This notebook includes all notes, activating Export All");
                    ExportAllNotesViaGUI();
                    return;
                }
                else if (notebook_name == "___NotebookManager___UnfiledNotes__Notebook___")
                {
                    dialog = new ExportMultipleDialog(Catalog.GetString("Unfiled Notes"), export_type_pretty_name);
                    int response = dialog.Run();
                    output_folder = SanitizePath(dialog.Filename);
                    if (response != (int)Gtk.ResponseType.Ok)
                    {
                        Logger.Debug("User clicked cancel.");
                        dialog.Destroy();
                        return;
                    }

                    exporting_single_notebook = true;
                    Logger.Debug("Creating an export folder in: " + output_folder);
                    System.IO.Directory.CreateDirectory(output_folder);
                    ExportNotesInList(ListUnfiledNotes(), output_folder);
                }
                else
                {
                    //Ordinary notebooks
                    dialog = new ExportMultipleDialog(notebook_name, export_type_pretty_name);
                    int response = dialog.Run();
                    output_folder = SanitizePath(dialog.Filename);
                    if (response != (int)Gtk.ResponseType.Ok)
                    {
                        Logger.Debug("User clicked cancel.");
                        dialog.Destroy();
                        return;
                    }

                    exporting_single_notebook = true;
                    Logger.Debug("Creating an export folder in: " + output_folder);
                    System.IO.Directory.CreateDirectory(output_folder);
                    ExportNotesInList(notebook.Tag.Notes, output_folder);
                }

                //Successful export: clean up and inform.
                dialog.SavePreferences();
                ShowSuccessDialog(output_folder);
            } catch (UnauthorizedAccessException) {
                Logger.Error(Catalog.GetString("Could not export, access denied."));
                ShowErrorDialog(output_folder, dialog,
                                Catalog.GetString("Access denied."));
                return;
            } catch (DirectoryNotFoundException) {
                Logger.Error(Catalog.GetString("Could not export, folder does not exist."));
                ShowErrorDialog(output_folder, dialog,
                                Catalog.GetString("Folder does not exist."));
                return;
            } catch (Exception ex) {
                Logger.Error(Catalog.GetString("Could not export: {0}"), ex);
                ShowErrorDialog(output_folder, dialog,
                                Catalog.GetString("Unknown error."));
                return;
            } finally {
                if (dialog != null)
                {
                    dialog.Destroy();
                    dialog = null;
                }
            }
        }
示例#40
0
        public int CheckFinder(string searchParameter, string searchInfo)
        {
            var x = Notebook.FindNote(searchParameter, searchInfo).Count;

            return(x);
        }
示例#41
0
        /// <summary>
        /// Initialize other components.
        /// </summary>
        public override void _initializeComponents()
        {
            ExpandVertical = false;
            ExpandHorizontal = false;

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

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

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

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

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

            // Add edit button
            Button EditBtn = new Button(Image.FromResource(DirectorImages.EDIT_ICON),
                Director.Properties.Resources.MenuEditRequest)
            {
                WidthRequest = 150,
                ExpandHorizontal = false,
                ExpandVertical = false
            };
            EditBtn.Clicked += delegate { CurrentMainWindow.OpenEditRequest(ActiveRequest); };
            PackStart(EditBtn, expand: false, hpos: WidgetPlacement.End);
        }
示例#42
0
        public int CheckGetNoteToEdit(int id)
        {
            var x = Notebook.GetNoteToEdit(id).Id;

            return(x);
        }
示例#43
0
        public IControl this[string id]
        {
            get
            {
                if (CreatedControlsByName.ContainsKey(id)) return CreatedControlsByName[id];

                Control ret = null;
                VirindiViewService.Controls.HudControl iret = myView[id];
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudButton))
                    ret = new Button();
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudCheckBox))
                    ret = new CheckBox();
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudTextBox))
                    ret = new TextBox();
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudCombo))
                    ret = new Combo();
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudHSlider))
                    ret = new Slider();
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudList))
                    ret = new List();
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudStaticText))
                    ret = new StaticText();
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudTabView))
                    ret = new Notebook();
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudProgressBar))
                    ret = new ProgressBar();
                if (iret.GetType() == typeof(VirindiViewService.Controls.HudImageButton))
                    ret = new ImageButton();

                if (ret == null) return null;

                ret.myControl = iret;
                ret.myName = id;
                ret.Initialize();
                allocatedcontrols.Add(ret);
                CreatedControlsByName[id] = ret;
                return ret;
            }
        }
示例#44
0
        public HomeMDPMaster()
        {
            InitializeComponent();

            ListView = lst_notebooks;

            object version = "";

            App.Current.Resources.TryGetValue("version", out version);
            lbl_version.Text = version.ToString();

            mst_lock_unlock.Clicked += new EventHandler((o, e) =>
            {
                LocknoteMgr.GetInstance().SecureErase();
                ((App)Application.Current).ResumeApp();
            });
            mst_settings.Clicked += new EventHandler((o, e) =>
            {
                ((NavigationPage)((HomeMDP)Application.Current.MainPage).Detail).PushAsync(new SettingsPage());
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });
            mst_new_notebook.Clicked += new EventHandler((o, e) =>
            {
                TextEntryPrompt p = new TextEntryPrompt()
                {
                    IsNavPage = true, PositiveButtonText = "Create", NegativeButtonText = "Cancel", PromptTitle = "New Notebook", Hint = "A Notebook"
                };
                p.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                {
                    LocknoteMgr.GetInstance().NoteManager.NewNotebook(p.Text);
                    LocknoteMgr.GetInstance().SaveNotebooks(true);
                    ((HomeMDP)Application.Current.MainPage).IsPresented = true;
                });
                p.Show(((HomeMDP)Application.Current.MainPage).Detail);
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });

            lst_notebooks.ItemTapped += new EventHandler((o, e) =>
            {
                Notebook nb             = (Notebook)o;
                SectionsPage sp         = new SectionsPage(nb);
                sp.Title                = nb.Title + " | Sections";
                sp.ListView.ItemsSource = nb.Sections;
                ((HomeMDP)Application.Current.MainPage).Detail      = new NavigationPage(sp);
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });

            lst_notebooks.ItemLongTapped += new LNListView.ItemLongTappedHandler((o, e) =>
            {
                Notebook nb          = (Notebook)o;
                EditNotebookPrompt p = new EditNotebookPrompt()
                {
                    Title = nb.Title, IsNavPage = true
                };
                Xamarin.Forms.Page pg = ((NavigationPage)((HomeMDP)Application.Current.MainPage).Detail).CurrentPage;
                p.OnPromptSaved      += new Prompt.PromptClosedEventListener(() =>
                {
                    nb.Title = p.Title;
                    if (pg.GetType() == typeof(SectionsPage))
                    {
                        pg.Title = p.Title + " | Sections";
                    }
                    LocknoteMgr.GetInstance().SaveNotebooks(true);
                    lst_notebooks.ItemsSource = LocknoteMgr.GetInstance().NoteManager.Notebooks;
                });
                p.DeleteClicked += new EventHandler((o2, e2) =>
                {
                    Prompt p2 = new Prompt()
                    {
                        PromptTitle = "Are you sure?", PositiveButtonText = "Yes", NegativeButtonText = "No", IsNavPage = true
                    };
                    p2.OnPromptSaved += new Prompt.PromptClosedEventListener(() =>
                    {
                        LocknoteMgr.GetInstance().NoteManager.DeleteNotebook(nb);
                        p.Dismiss();
                    });
                    p2.Show(((HomeMDP)Application.Current.MainPage).Detail);
                });
                p.Show(((HomeMDP)Application.Current.MainPage).Detail);
                ((HomeMDP)Application.Current.MainPage).IsPresented = false;
            });
        }
示例#45
0
    protected void AddPlatformTab(string friendlyName, string msfPayloadFilter, Notebook parent, string negativeFilter = null, Widget payloadDetails = null)
    {
        HBox split = new HBox ();

        TreeView payloads = new TreeView ();
        payloads.RowActivated += (object o, RowActivatedArgs args) => {
            TreeModel model = _treeViews [_parentNotebook.CurrentPage].Model;

            TreeIter iter;
            model.GetIterFromString (out iter, args.Path.ToString ());
            string str = model.GetValue (iter, 1) as string;
            VBox deeets = RedrawOptions (_newPayloads [str], true);

            HBox updateButton = new HBox ();
            Button update = new Button ("Update payload");
            update.Clicked += (object sender, EventArgs e) => {

                Dictionary<string, object> newopts = new Dictionary<string, object> ();
                foreach (Widget child in _dynamicOptions[_parentNotebook.CurrentPage].Children) {
                    if (child is CheckButton) {
                        newopts.Add ((child as CheckButton).Label, (child as CheckButton).Active.ToString ());
                    }
                    else if (child is HBox) {
                        foreach (Widget c in (child as HBox).Children) {
                            if (c is Entry) {
                                newopts.Add ((c as Entry).TooltipText, (c as Entry).Text);
                            }
                        }
                    }
                }

                _newPayloads [str] = newopts;
            };

            updateButton.PackStart (update, false, false, 0);
            deeets.PackStart (updateButton, false, false, 0);
            deeets.ShowAll ();

        };

        TreeViewColumn no = new TreeViewColumn ();
        no.Title = "#";
        CellRendererText noText = new CellRendererText ();
        no.PackStart (noText, true);
        no.AddAttribute (noText, "text", 0);

        TreeViewColumn treedeets = new TreeViewColumn ();
        payloads.AppendColumn (no);

        CellRendererText treeDeetsText = new CellRendererText ();

        treedeets.Title = "Details";
        treedeets.PackStart (treeDeetsText, true);
        treedeets.AddAttribute (treeDeetsText, "text", 1);
        payloads.AppendColumn (treedeets);

        ListStore payloadListStore = new ListStore (typeof(string), typeof(string));

        payloads.Model = payloadListStore;

        payloads.WidthRequest = 250;
        payloads.HeightRequest = 500;

        _treeViews.Add (payloads);

        split.PackStart (payloads, false, false, 10);
        VBox deetsAndButtons = new VBox ();
        VBox deets = new VBox ();

        HBox payloadComboContainer = new HBox ();
        ComboBox payloadCombo = ComboBox.NewText ();
        payloadCombo.Changed += OnPayloadChanged;
        payloadCombo.WidthRequest = 250;

        var ps = ((List<object>)_payloads ["modules"]).Where (s => ((string)s).StartsWith (msfPayloadFilter));

        if (negativeFilter != null)
            ps = ps.Where (s => !((string)s).Contains (negativeFilter));

        foreach (var payload in ps.OrderBy(s => s))
            payloadCombo.AppendText (payload.ToString ());

        payloadComboContainer.PackStart (payloadCombo, false, false, 0);

        deetsAndButtons.PackStart (payloadComboContainer, false, false, 0);
        deetsAndButtons.PackStart (deets, false, false, 0);

        if (payloadDetails != null)
            deets.PackStart (payloadDetails, false, false, 0);

        _dynamicOptions.Add (deets);
        split.PackEnd (deetsAndButtons, true, true, 0);
        parent.AppendPage (split, new Label (friendlyName));
    }
示例#46
0
 public override System.Web.Mvc.ActionResult Search(Notebook.Models.Note.SearchNoteVM filter)
 {
     var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Search);
     ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "filter", filter);
     SearchOverride(callInfo, filter);
     return callInfo;
 }
            public ICSDetailsWidget()
                : base()
            {
                menubar = new ICSMenuBar ();
                menubar.disconnectMenuItem.Activated +=
                    on_disconnect_activate;
                menubar.connectMenuItem.Activated +=
                    on_connect_activate;
                menubar.ShowAll ();

                Image img = new Image ();
                img.Stock = Stock.Network;
                toolbutton =
                    new ToolButton (img,
                            Catalog.
                            GetString
                            ("Chess Server"));
                toolbutton.ShowAll ();

                client = new ICSClient ();
                title = String.Format (Catalog.GetString
                               ("ICS: {0}@{1}:{2}"),
                               client.User,
                               client.server,
                               client.port);
                book = new Notebook ();
                book.Show ();

                Add (book);

                obManager =
                    new GameObservationManager (client,
                                    this);

                observableGames =
                    new ObservableGamesWidget (obManager);

                graph = new GameAdvertisementGraph (client);
                book.AppendPage (graph,
                         new Label (Catalog.
                                GetString
                                ("Seek Graph")));
                ads = new GameAdvertisements (client);
                book.AppendPage (ads,
                         new Label (Catalog.
                                GetString
                                ("Game Seeks")));

                book.AppendPage (observableGames,
                         new Label (Catalog.
                                GetString
                                ("Watch Games")));

                shell = new ICSShell (client);
                book.AppendPage (shell,
                         new Label (Catalog.
                                GetString
                                ("Shell")));

                client.ChallengeEvent += OnChallengeEvent;

                client.AuthEvent += OnAuth;
                client.ConnectionErrorEvent +=
                    OnConnectionError;

                ShowConfigWidget ();

                menubar.disconnectMenuItem.Sensitive = false;
                GLib.Idle.Add (delegate ()
                           {
                           Authenticate (); return false;}
                );

                accel = new AccelGroup ();
                menubar.quitMenuItem.
                    AddAccelerator ("activate", accel,
                            new AccelKey (Gdk.Key.
                                      q,
                                      Gdk.
                                      ModifierType.
                                      ControlMask,
                                      AccelFlags.
                                      Visible));
                ShowAll ();
                CsBoardApp.Instance.QuitEvent += OnQuitEvent;
            }
示例#48
0
 public void Update(Notebook notebook)
 {
     _notebookRepos.Update(notebook);
 }
示例#49
0
        public IControl this[string id]
        {
            get
            {
                if (CreatedControlsByName.ContainsKey(id)) return CreatedControlsByName[id];

                Control ret = null;
                Decal.Adapter.Wrappers.IControlWrapper iret = myView.Controls[id];
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.PushButtonWrapper))
                    ret = new Button();
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.CheckBoxWrapper))
                    ret = new CheckBox();
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.TextBoxWrapper))
                    ret = new TextBox();
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.ChoiceWrapper))
                    ret = new Combo();
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.SliderWrapper))
                    ret = new Slider();
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.ListWrapper))
                    ret = new List();
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.StaticWrapper))
                    ret = new StaticText();
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.NotebookWrapper))
                    ret = new Notebook();
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.ProgressWrapper))
                    ret = new ProgressBar();
                if (iret.GetType() == typeof(Decal.Adapter.Wrappers.ButtonWrapper))
                    ret = new ImageButton();

                if (ret == null) return null;

                ret.myControl = iret;
                ret.myName = id;
                ret.Initialize();
                allocatedcontrols.Add(ret);
                CreatedControlsByName[id] = ret;
                return ret;
            }
        }
示例#50
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainView(ViewBase owner = null) : base(owner)
        {
            MasterView      = this;
            numberOfButtons = 0;
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.MainView.glade");

            window1         = (Window)builder.GetObject("window1");
            progressBar     = (ProgressBar)builder.GetObject("progressBar");
            lblStatus       = (Label)builder.GetObject("lblStatus");
            statusWindow    = (TextView)builder.GetObject("StatusWindow");
            stopButton      = (Button)builder.GetObject("stopButton");
            notebook1       = (Notebook)builder.GetObject("notebook1");
            notebook2       = (Notebook)builder.GetObject("notebook2");
            vbox1           = (VBox)builder.GetObject("vbox1");
            vbox2           = (VBox)builder.GetObject("vbox2");
            hpaned1         = (HPaned)builder.GetObject("hpaned1");
            hbox1           = (Widget)builder.GetObject("vbox3");
            mainWidget      = window1;
            window1.Icon    = new Gdk.Pixbuf(null, "ApsimNG.Resources.apsim logo32.png");
            listButtonView1 = new ListButtonView(this);
            listButtonView1.ButtonsAreToolbar = true;

            vbox1.PackEnd(listButtonView1.MainWidget, true, true, 0);
            listButtonView2 = new ListButtonView(this);
            listButtonView2.ButtonsAreToolbar = true;
            vbox2.PackEnd(listButtonView2.MainWidget, true, true, 0);
            hpaned1.PositionSet = true;
            hpaned1.Child2.Hide();
            hpaned1.Child2.NoShowAll = true;

            notebook1.SetMenuLabel(vbox1, LabelWithIcon(indexTabText, "go-home"));
            notebook2.SetMenuLabel(vbox2, LabelWithIcon(indexTabText, "go-home"));

            notebook1.SwitchPage += OnChangeTab;
            notebook2.SwitchPage += OnChangeTab;

            notebook1.GetTabLabel(notebook1.Children[0]).Name = "selected-tab";

            hbox1.HeightRequest = 20;

            // Normally, one would specify the style class in the UI (.glade) file.
            // However, doing so breaks gtk2-compatibility, so for now, we will just
            // set the style class in code.
            progressBar.StyleContext.AddClass("fat-progress-bar");


            TextTag tag = new TextTag("error");

            // Make errors orange-ish in dark mode.
            if (Utility.Configuration.Settings.DarkTheme)
            {
                tag.ForegroundGdk = Utility.Colour.ToGdk(ColourUtilities.ChooseColour(1));
            }
            else
            {
                tag.Foreground = "red";
            }
            statusWindow.Buffer.TagTable.Add(tag);
            tag = new TextTag("warning");
            // Make warnings yellow in dark mode.
            if (Utility.Configuration.Settings.DarkTheme)
            {
                tag.ForegroundGdk = Utility.Colour.ToGdk(ColourUtilities.ChooseColour(7));
            }
            else
            {
                tag.Foreground = "brown";
            }
            statusWindow.Buffer.TagTable.Add(tag);
            tag                      = new TextTag("normal");
            tag.Foreground           = "blue";
            statusWindow.Visible     = false;
            stopButton.Image         = new Gtk.Image(new Gdk.Pixbuf(null, "ApsimNG.Resources.MenuImages.Delete.png", 12, 12));
            stopButton.ImagePosition = PositionType.Right;
            stopButton.Image.Visible = true;
            stopButton.Clicked      += OnStopClicked;
            window1.DeleteEvent     += OnClosing;

            // If font is null, or font family is null, or font size is 0, fallback
            // to the default font (on windows only).
            Pango.FontDescription f = null;
            if (!string.IsNullOrEmpty(Utility.Configuration.Settings.FontName))
            {
                f = Pango.FontDescription.FromString(Utility.Configuration.Settings.FontName);
            }
            if (ProcessUtilities.CurrentOS.IsWindows && (string.IsNullOrEmpty(Utility.Configuration.Settings.FontName) ||
                                                         f.Family == null ||
                                                         f.Size == 0))
            {
                // Default font on Windows is Segoe UI. Will fallback to sans if unavailable.
                Utility.Configuration.Settings.FontName = Pango.FontDescription.FromString("Segoe UI 11").ToString();
            }

            // Can't set font until widgets are initialised.
            if (!string.IsNullOrEmpty(Utility.Configuration.Settings.FontName))
            {
                try
                {
                    Pango.FontDescription font = Pango.FontDescription.FromString(Utility.Configuration.Settings.FontName);
                    ChangeFont(font);
                }
                catch (Exception err)
                {
                    ShowError(err);
                }
            }

            //window1.ShowAll();
            if (ProcessUtilities.CurrentOS.IsMac)
            {
                InitMac();
                //Utility.Configuration.Settings.DarkTheme = Utility.MacUtilities.DarkThemeEnabled();
            }

            if (!ProcessUtilities.CurrentOS.IsLinux)
            {
                RefreshTheme();
            }


            LoadStylesheets();
        }
示例#51
0
 partial void CreateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Notebook.Models.Note.CreateNoteVM note, string hiddenTags);
示例#52
0
        public List <Database.Entities.Note> GetNotes(Notebook notebook, string searchString, ref int count, bool orderByLastChanged, string noteFilter)
        {
            string[] search = searchString.Split(new char[] { ' ' });

            List <Database.Entities.Note> notes = null;

            using (var conn = this.factory.GetConnection())
            {
                // First, get all the notes
                notes = conn.Table <Database.Entities.Note>().ToList();

                switch (noteFilter)
                {
                case NoteFilters.Today:
                    notes = notes.Where(n => DateUtils.CountDays(new DateTime(n.ModificationDate), DateTime.Now) == 0).ToList();
                    break;

                case NoteFilters.Yesterday:
                    notes = notes.Where(n => DateUtils.CountDays(new DateTime(n.ModificationDate), DateTime.Now.AddDays(-1)) == 0).ToList();
                    break;

                case NoteFilters.ThisWeek:
                    notes = notes.Where(n => DateUtils.CountDays(new DateTime(n.ModificationDate), DateTime.Now) <= (int)DateTime.Now.DayOfWeek).ToList();
                    break;

                case NoteFilters.Flagged:
                    notes = notes.Where(n => n.Flagged == 1).ToList();
                    break;

                case NoteFilters.All:
                    break;
                    // do not filter
                }

                // Then, add a WHERE clause
                if (notebook.Id.Equals("0"))
                {
                    // Get all the notes
                    notes = notes.Where(n => search.All(s => n.Title.ToLower().Contains(s.ToLower()) | n.Text.ToLower().Contains(s.ToLower()))).ToList();
                }
                else if (notebook.Id.Equals("1"))
                {
                    // Get only the notes without notebook id
                    notes = notes.Where(n => n.NotebookId.Equals("") & (search.All(s => n.Title.ToLower().Contains(s.ToLower()) | n.Text.ToLower().Contains(s.ToLower())))).ToList();
                }
                else
                {
                    // Get only the notes for the selected notebook id
                    notes = notes.Where(n => n.NotebookId.Equals(notebook.Id) & (search.All(s => n.Title.ToLower().Contains(s.ToLower()) | n.Text.ToLower().Contains(s.ToLower())))).ToList();
                }

                // Finally, ORDER BY
                if (!orderByLastChanged)
                {
                    // Order alpabetically
                    notes = notes.OrderBy(n => n.Title).ToList();
                }
                else
                {
                    // Order by last changed
                    notes = notes.OrderByDescending(n => n.ModificationDate).ToList();
                }

                count = notes.Count();
            }

            return(notes);
        }
示例#53
0
 partial void SearchOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Notebook.Models.Note.SearchNoteVM filter);
示例#54
0
        public override Widget CreatePanelWidget()
        {
            HBox  hbox  = new HBox(false, 6);
            Label label = new Label();

            label.MarkupWithMnemonic = GettextCatalog.GetString("_Policy:");
            hbox.PackStart(label, false, false, 0);

            store       = new ListStore(typeof(string), typeof(PolicySet));
            policyCombo = new ComboBox(store);
            CellRenderer renderer = new CellRendererText();

            policyCombo.PackStart(renderer, true);
            policyCombo.AddAttribute(renderer, "text", 0);

            label.MnemonicWidget         = policyCombo;
            policyCombo.RowSeparatorFunc = (TreeModel model, TreeIter iter) =>
                                           ((string)model.GetValue(iter, 0)) == "--";
            hbox.PackStart(policyCombo, false, false, 0);

            VBox vbox = new VBox(false, 6);

            vbox.PackStart(hbox, false, false, 0);
            vbox.ShowAll();

            // Warning message to be shown when the user modifies the default policy

            warningMessage         = new HBox();
            warningMessage.Spacing = 6;
            Image img = new Image(Stock.Warning, IconSize.Menu);

            warningMessage.PackStart(img, false, false, 0);
            Label wl = new Label(GettextCatalog.GetString("Changes done in this section will only be applied to new projects. " +
                                                          "Settings for existing projects can be modified in the project (or solution) options dialog."));

            wl.Xalign       = 0;
            wl.Wrap         = true;
            wl.WidthRequest = 450;
            warningMessage.PackStart(wl, true, true, 0);
            warningMessage.ShowAll();
            warningMessage.Visible = false;
            vbox.PackEnd(warningMessage, false, false, 0);

            notebook = new Notebook();

            // Get the panels for all mime types

            List <string> types = new List <string> ();

            types.AddRange(DesktopService.GetMimeTypeInheritanceChain(mimeType));

            panelData.SectionLoaded = true;
            panels = panelData.Panels;
            foreach (IMimeTypePolicyOptionsPanel panel in panelData.Panels)
            {
                panel.SetParentSection(this);
                Widget child = panel.CreateMimePanelWidget();

                Label tlabel = new Label(panel.Label);
                label.Show();
                child.Show();
                Alignment align = new Alignment(0.5f, 0.5f, 1f, 1f);
                align.BorderWidth = 6;
                align.Add(child);
                align.Show();

                notebook.AppendPage(align, tlabel);
                panel.LoadCurrentPolicy();
            }
            notebook.SwitchPage += delegate(object o, SwitchPageArgs args) {
                if (notebook.Page >= 0 && notebook.Page < this.panels.Count)
                {
                    this.panels[notebook.Page].PanelSelected();
                }
            };
            notebook.Show();
            vbox.PackEnd(notebook, true, true, 0);

            FillPolicies();
            policyCombo.Active = 0;

            loading = false;

            if (!isRoot && panelData.UseParentPolicy)
            {
                //in this case "parent" is always first in the list
                policyCombo.Active = 0;
                notebook.Sensitive = false;
            }
            else
            {
                UpdateSelectedNamedPolicy();
            }

            policyCombo.Changed += HandlePolicyComboChanged;

            return(vbox);
        }
示例#55
0
	public static void Main23 ()
	{
		uint r;
		double theta;

		Application.Init ();

		Gtk.Window win = new Gtk.Window ("Polar Coordinate Container");
		win.DeleteEvent += new DeleteEventHandler (Window_Delete);

		Notebook notebook = new Notebook ();
		win.Add (notebook);

		// Clock
		PolarFixed pf = new PolarFixed ();
		notebook.AppendPage (pf, new Label ("Clock"));

		for (int hour = 1; hour <= 12; hour ++) {
			theta = (Math.PI / 2) - hour * (Math.PI / 6);
			if (theta < 0)
				theta += 2 * Math.PI;

			Label l = new Label ("<big><b>" + hour.ToString () + "</b></big>");
			l.UseMarkup = true;
			pf.Put (l, theta, 200);
		}

		// Spiral
		pf = new PolarFixed ();
		notebook.AppendPage (pf, new Label ("Spiral"));

		r = 0;
		theta = 0.0;

		foreach (string id in Gtk.Stock.ListIds ()) {
			StockItem item = Gtk.Stock.Lookup (id);
			if (item.Label == null)
				continue;

			pf.Put (new Gtk.Button (id), theta, r);

			// Logarithmic spiral: r = a*e^(b*theta)
			r += 5;
			theta = 10 * Math.Log (10 * r);
		}

		win.ShowAll ();

		Application.Run ();
	}
示例#56
0
        public void Execute(object parameter)
        {
            Notebook selectedNotebook = parameter as Notebook;

            VM.CreateNote(selectedNotebook.Id);
        }
示例#57
0
        public StockView(ViewBase owner) : base(owner)
        {
            Builder builder = BuilderFromResource("ApsimNG.Resources.Glade.StockView.glade");

            notebook1             = (Notebook)builder.GetObject("notebook1");
            notebook1.SwitchPage += TabControl1_SelectedIndexChanged;

            gbxGenotype           = (Frame)builder.GetObject("gbxGenotype");
            edtGenotypeName       = (Entry)builder.GetObject("edtGenotypeName");
            btnNewGeno            = (Button)builder.GetObject("btnNewGeno");
            btnDelGeno            = (Button)builder.GetObject("btnDelGeno");
            rbtnSheep             = (Gtk.RadioButton)builder.GetObject("rbtnSheep");
            rbtnCattle            = (Gtk.RadioButton)builder.GetObject("rbtnCattle");
            lblConception3        = (Label)builder.GetObject("lblConception3");
            unitConception        = (Label)builder.GetObject("unitConception");
            lblBreedPFW_PeakMilk  = (Label)builder.GetObject("lblBreedPFW_PeakMilk");
            unitBreedPFW_PeakMilk = (Label)builder.GetObject("unitBreedPFW_PeakMilk");
            untWoolYield          = (Label)builder.GetObject("untWoolYield");
            lblWoolYield          = (Label)builder.GetObject("lblWoolYield");
            lblDamBreed           = (Label)builder.GetObject("lblDamBreed");
            lblSireBreed          = (Label)builder.GetObject("lblSireBreed");
            lblBreedMaxMu         = (Label)builder.GetObject("lblBreedMaxMu");
            unitBreedMaxMu        = (Label)builder.GetObject("unitBreedMaxMu");

            cbxDamBreed      = new Views.DropDownView(this, (ComboBox)builder.GetObject("cbxDamBreed"));
            cbxSireBreed     = new Views.DropDownView(this, (ComboBox)builder.GetObject("cbxSireBreed"));
            cbxGeneration    = new Views.DropDownView(this, (ComboBox)builder.GetObject("cbxGeneration"));
            cbxGroupGenotype = new Views.DropDownView(this, (ComboBox)builder.GetObject("cbxGroupGenotype"));   // animals tab

            deWnrDeath           = new DoubleEditView(this, (Entry)builder.GetObject("edtWnrDeathRate"), 100, 0, 1);
            deDeath              = new DoubleEditView(this, (Entry)builder.GetObject("edtDeathRate"), 100, 0, 1);
            dePFW_Milk           = new DoubleEditView(this, (Entry)builder.GetObject("edtBreedPFW_PeakMilk"), 100, 0, 2);
            deBreedSRW           = new DoubleEditView(this, (Entry)builder.GetObject("edtBreedSRW"));
            deBreedSRW.DecPlaces = 1;
            deBreedMaxMu         = new DoubleEditView(this, (Entry)builder.GetObject("edtBreedMaxMu"), 50, 5, 1);
            deWoolYield          = new DoubleEditView(this, (Entry)builder.GetObject("edtWoolYield"), 100, 50, 1);
            deConception1        = new DoubleEditView(this, (Entry)builder.GetObject("edtConception1"), 100, 0, 0);
            deConception2        = new DoubleEditView(this, (Entry)builder.GetObject("edtConception2"), 100, 0, 0);
            deConception3        = new DoubleEditView(this, (Entry)builder.GetObject("edtConception3"), 100, 0, 0);

            cbxGeneration.Values = new string[] { "Purebred", "First cross", "Second cross", "Third cross", "Fourth cross", "Fifth cross", "Sixth cross" };

            // configure the treeview of genotype names
            lbxGenotypeList       = (Gtk.TreeView)builder.GetObject("tvGenotypes");
            lbxGenotypeList.Model = genoList;
            CellRendererText textRender = new Gtk.CellRendererText();
            TreeViewColumn   column     = new TreeViewColumn("Genotype Names", textRender, "text", 0);

            lbxGenotypeList.AppendColumn(column);
            lbxGenotypeList.HeadersVisible = false;
            lbxGenotypeList.CursorChanged += lbxGenotypeList_SelectedIndexChanged;

            btnNewGeno.Clicked      += btnNewGeno_Clicked;
            btnDelGeno.Clicked      += btnDelGeno_Clicked;
            edtGenotypeName.Changed += ChangeGenotypeName;
            rbtnSheep.Clicked       += ClickAnimal;
            rbtnCattle.Clicked      += ClickAnimal;
            cbxDamBreed.Changed     += ChangeBreed;
            cbxGeneration.Changed   += ChangeGeneration;

            _mainWidget            = notebook1;
            _mainWidget.Destroyed += _mainWidget_Destroyed;
        }
示例#58
0
        public bool CanExecute(object parameter)
        {
            Notebook selectedNotebook = parameter as Notebook;

            return(selectedNotebook != null ? true : false);
        }
    private ImportDatabaseStmtRunner(Notebook notebook, ScriptEnv env, ScriptRunner runner, Ast.ImportDatabaseStmt stmt,
                                     CancellationToken cancel
                                     )
    {
        _notebook = notebook;
        _env      = env;
        _runner   = runner;
        _stmt     = stmt;
        _cancel   = cancel;

        // vendor
        var vendorObj = _runner.EvaluateExpr(_stmt.VendorExpr, _env);

        if (vendorObj is not string)
        {
            throw new Exception("IMPORT DATABASE: The 'vendor' parameter must be a string.");
        }
        _vendor = ((string)vendorObj).ToLowerInvariant();
        switch (_vendor)
        {
        case "mssql":
        case "pgsql":
        case "mysql":
            break;

        default:
            throw new Exception($"IMPORT DATABASE: The vendor \"{_vendor}\" is not recognized.");
        }

        // src-schema-name
        if (stmt.SrcSchemaNameExprOrNull != null)
        {
            _srcSchemaName = _runner.EvaluateIdentifierOrExpr(stmt.SrcSchemaNameExprOrNull, _env);
        }

        // src-table-name, sql
        if (stmt.SrcTableNameExprOrNull != null)
        {
            _srcTableName = _runner.EvaluateIdentifierOrExpr(stmt.SrcTableNameExprOrNull, _env);
            _sql          = null;
        }
        else if (stmt.SqlExprOrNull != null)
        {
            var sqlObj = _runner.EvaluateExpr(stmt.SqlExprOrNull, _env);
            if (sqlObj is not string)
            {
                throw new Exception("IMPORT DATABASE: The 'sql' parameter must be a string.");
            }
            _sql          = (string)sqlObj;
            _srcTableName = null;
        }
        else
        {
            throw new Exception("IMPORT DATABASE: Internal error. No source table and no query specified.");
        }

        // dst-table-name
        if (_stmt.DstTableNameExprOrNull != null)
        {
            _dstTableName = _runner.EvaluateIdentifierOrExpr(_stmt.DstTableNameExprOrNull, _env);
        }
        else if (_stmt.SrcTableNameExprOrNull != null)
        {
            _dstTableName = _runner.EvaluateIdentifierOrExpr(_stmt.SrcTableNameExprOrNull, _env);
        }
        else if (_stmt.SqlExprOrNull != null)
        {
            throw new Exception("IMPORT DATABASE: A target table name (with INTO) is required when the source is a query.");
        }
        else
        {
            throw new Exception("IMPORT DATABASE: Internal error. No destination table name.");
        }

        // connection-string
        var connectionStringObj = _runner.EvaluateExpr(_stmt.ConnectionStringExpr, _env);

        if (connectionStringObj is not string)
        {
            throw new Exception("IMPORT DATABASE: The 'connection-string' parameter must be a string.");
        }
        _connectionString = (string)connectionStringObj;

        // OPTIONS
        foreach (var option in _stmt.OptionsList.GetOptionKeys())
        {
            switch (option)
            {
            case "LINK":
                _link = _stmt.OptionsList.GetOptionBool(option, _runner, _env, false);
                break;

            case "TRUNCATE_EXISTING_TABLE":
                _truncateExistingTable = _stmt.OptionsList.GetOptionBool(option, _runner, _env, false);
                break;

            case "TEMPORARY_TABLE":
                _temporaryTable = _stmt.OptionsList.GetOptionBool(option, _runner, _env, false);
                break;

            default:
                throw new Exception($"\"{option}\" is not a recognized option name.");
            }
        }

        // validate option LINK
        if (_link)
        {
            if (_sql != null)
            {
                throw new Exception("IMPORT DATABASE: When creating a live link, a source table name must be provided, not an SQL query.");
            }
            if (TableExists(_dstTableName))
            {
                throw new Exception($"IMPORT DATABASE: The table \"{_dstTableName}\" already exists.");
            }
            if (_truncateExistingTable)
            {
                throw new Exception($"IMPORT DATABASE: When creating a live link, the TRUNCATE_EXISTING_TABLE option is not valid.");
            }
            if (_temporaryTable)
            {
                throw new Exception($"IMPORT DATABASE: When creating a live link, the TEMPORARY_TABLE option is not valid.");
            }
        }
    }
示例#60
0
        public async static Task <int> Initialize(Context context, UserManager <User> userManager, RoleManager <IdentityRole> roleManager)
        {
            try
            {
                IdentityResult result;
                context.Database.EnsureCreated();

                if (context.Products.Any())
                {
                    return(0);   // DB has been seeded
                }

                var Categories = new Category[]
                {
                    new Category {
                        CategoryName = "Видеокарты"
                    },
                    new Category {
                        CategoryName = "Процессоры"
                    },
                    new Category {
                        CategoryName = "Ноутбуки"
                    },
                };

                foreach (var s in Categories)
                {
                    context.Categories.Add(s);
                }
                context.SaveChanges();

                var GPUS = new GraphicsCard[]
                {
                    new GraphicsCard
                    {
                        memory         = 1000,
                        clock          = 1600,
                        Name           = "MSI nVidia GeForce GT 710 , GT 710 1GD3H LP",
                        quantity       = 10,
                        Price          = 3190,
                        PostDate       = DateTime.Now,
                        Category       = Categories.First(),
                        ImageThumbnail = Convert.ToBase64String(File.ReadAllBytes(@"wwwroot\TestImages\1.jpg")),
                        Images         = context.Images.ToList()
                    },
                    new GraphicsCard
                    {
                        memory         = 4000,
                        clock          = 7000,
                        Name           = "PALIT nVidia GeForce GTX 1050TI , PA-GTX1050Ti StormX 4G",
                        quantity       = 10,
                        Price          = 21590,
                        PostDate       = DateTime.Now,
                        Category       = Categories.First(),
                        ImageThumbnail = Convert.ToBase64String(File.ReadAllBytes(@"wwwroot\TestImages\3.jpg")),
                        Images         = context.Images.ToList()
                    },
                    new GraphicsCard
                    {
                        memory         = 1000,
                        clock          = 5012,
                        Name           = "ASUS NVIDIA GeForce GT 710 , GT710-SL-1GD5",
                        quantity       = 10,
                        Price          = 3490,
                        PostDate       = DateTime.Now,
                        Category       = Categories.First(),
                        ImageThumbnail = Convert.ToBase64String(File.ReadAllBytes(@"wwwroot\TestImages\4.jpg")),
                        Images         = context.Images.ToList(),
                        Discount       = 10
                    },
                    new GraphicsCard
                    {
                        memory         = 2000,
                        clock          = 2100,
                        Name           = "MSI nVidia GeForce GT 1030 , GT 1030 AERO ITX 2GD4 OC",
                        quantity       = 10,
                        Price          = 7390,
                        PostDate       = DateTime.Now,
                        Category       = Categories.First(),
                        ImageThumbnail = Convert.ToBase64String(File.ReadAllBytes(@"wwwroot\TestImages\5.jpg")),
                        Images         = context.Images.ToList()
                    }
                };

                foreach (GraphicsCard i in GPUS)
                {
                    context.GraphicsCards.Add(i);
                }
                context.SaveChanges();

                var prots = new CPU[]
                {
                    new CPU {
                        Name           = "AMD Ryzen 5 2600, SocketAM4, OEM",
                        quantity       = 10,
                        Price          = 11590,
                        PostDate       = DateTime.Now,
                        Category       = Categories[1],
                        cores          = 6,
                        clock          = 3400,
                        ImageThumbnail = Convert.ToBase64String(File.ReadAllBytes(@"wwwroot\TestImages\2.jpg")),
                    }
                };
                Notebook a = new Notebook
                {
                    Images         = context.Images.ToList(),
                    Category       = Categories[2],
                    Name           = "DIGMA EVE 14 C411, 14.1 IPS",
                    ImageThumbnail = Convert.ToBase64String(File.ReadAllBytes(@"wwwroot\TestImages\222.jpg"))
                };
                context.Notebooks.Add(a);

                foreach (var i in prots)
                {
                    context.CPUs.Add(i);
                }

                context.SaveChanges();

                var ImageContens = new ImageContent[]
                {
                    new ImageContent {
                        content = File.ReadAllBytes(@"wwwroot\TestImages\carousel\1s.jpg")
                    },
                    new ImageContent {
                        content = File.ReadAllBytes(@"wwwroot\TestImages\carousel\2b.jpg")
                    }
                };
                foreach (var ic in ImageContens)
                {
                    context.ImageContents.Add(ic);
                }
                context.SaveChanges();

                var Images = new Image[]
                {
                    new Image {
                        ImageContentID = context.ImageContents.ToList()[0].ImageContentID, ProductID = context.GraphicsCards.FirstOrDefault().ID
                    },
                    new Image {
                        ImageContentID = context.ImageContents.ToList()[1].ImageContentID, ProductID = context.GraphicsCards.FirstOrDefault().ID
                    },
                };

                foreach (var I in Images)
                {
                    context.Images.Add(I);
                }

                context.SaveChanges();

                var Roles = new IdentityRole[]
                {
                    new IdentityRole("admin"),
                    new IdentityRole("user"),
                };

                foreach (var r in Roles)
                {
                    result = await roleManager.CreateAsync(r);
                }
                context.SaveChanges();

                var Users = new User[]
                {
                    new User {
                        UserName = "******", Email = "*****@*****.**"
                    },
                    new User {
                        UserName = "******", Email = "*****@*****.**"
                    }
                };
                result = await userManager.CreateAsync(Users[0], "PasswodFromUser!1");

                result = await userManager.AddToRoleAsync(userManager.FindByEmailAsync("*****@*****.**").Result, "user");

                result = await userManager.CreateAsync(Users[1], "PasswodFromAdmin!1");

                result = await userManager.AddToRoleAsync(userManager.FindByEmailAsync("*****@*****.**").Result, "admin");

                context.SaveChanges();

                //            var people = new User[]
                //{
                //            new User {
                //                UsLogin = "******",
                //                UsPassword = "******",
                //                FirstName = "Ivan",
                //                RegDate = DateTime.Now,
                //                Role = Role.user
                //            },
                //            new User {
                //                UsLogin = "******",
                //                UsPassword = "******",
                //                FirstName = "DIO",
                //                RegDate = DateTime.Now,
                //                Role = Role.admin
                //            }
                //};

                //            foreach (var u in people)
                //            {
                //                context.Users.Add(u);
                //            }

                var sells = new Order[]
                {
                    new Order
                    {
                        shippingAdress = "tuda",
                        phone          = "88005553535",
                        email          = "*****@*****.**",
                        status         = OrderStatus.pending
                    }
                };

                foreach (var s in sells)
                {
                    context.Orders.Add(s);
                }

                context.SaveChanges();

                var ordered = new OrderedProduct[]
                {
                    new OrderedProduct
                    {
                        OrderID   = context.Orders.FirstOrDefault().ID,
                        ProductID = context.Products.FirstOrDefault().ID,
                        Quantity  = 4
                    }
                };

                foreach (var op in ordered)
                {
                    context.OrderedProducts.Add(op);
                }

                context.SaveChanges();
                return(1);
            }
            catch (Exception e)
            {
                Console.WriteLine("a");
                return(0);
            }
        }