示例#1
0
	public static int Main9 (string[] args)
	{
		Gtk.Application.Init ();
		Window win = new Window ("Custom Widget Test");
		win.DeleteEvent += new DeleteEventHandler (OnQuit);
		
		VPaned paned = new VPaned ();
		CustomWidget cw = new CustomWidget ();
		cw.Label = "This one contains a button";
		Button button = new Button ("Ordinary button");
		cw.Add (button);
		paned.Pack1 (cw, true, false);

		cw = new CustomWidget ();
		cw.Label = "And this one a TextView";
		cw.StockId = Stock.JustifyLeft;
		ScrolledWindow sw = new ScrolledWindow (null, null);
		sw.ShadowType = ShadowType.In;
		sw.HscrollbarPolicy = PolicyType.Automatic;
		sw.VscrollbarPolicy = PolicyType.Automatic;
		TextView textView = new TextView ();
		sw.Add (textView);
		cw.Add (sw);
		paned.Pack2 (cw, true, false);
		
		win.Add (paned);
		win.ShowAll ();
		Gtk.Application.Run ();
		return 0;
	}
示例#2
0
    public static int Main(string[] args)
    {
        Gtk.Application.Init();
        Window win = new Window("Custom Widget Test");

        win.DeleteEvent += new DeleteEventHandler(OnQuit);

        VPaned       paned = new VPaned();
        CustomWidget cw    = new CustomWidget();

        cw.Label = "This one contains a button";
        Button button = new Button("Ordinary button");

        cw.Add(button);
        paned.Pack1(cw, true, false);

        cw         = new CustomWidget();
        cw.Label   = "And this one a TextView";
        cw.StockId = Stock.JustifyLeft;
        ScrolledWindow sw = new ScrolledWindow(null, null);

        sw.ShadowType       = ShadowType.In;
        sw.HscrollbarPolicy = PolicyType.Automatic;
        sw.VscrollbarPolicy = PolicyType.Automatic;
        TextView textView = new TextView();

        sw.Add(textView);
        cw.Add(sw);
        paned.Pack2(cw, true, false);

        win.Add(paned);
        win.ShowAll();
        Gtk.Application.Run();
        return(0);
    }
        public void Widgets_in_database_are_produced_by_factory()
        {
            var conventions = new DocumentConvention
            {
                FindTypeTagName = type =>
                                  {
                                      if (typeof(Widget).IsAssignableFrom(type))
                                      {
                                          return Widget.IdPrefix.TrimSuffix("/");
                                      }
                                      return DocumentConvention.DefaultTypeTagName(type);
                                  }
            };

            var testableStore = new TestableStore(conventions);

            var fooWidget = new CustomWidget { Markup = "foo" };
            var barWidget = new CustomWidget { Markup = "bar" };

            using (var session = testableStore.OpenSession())
            {
                session.Store(fooWidget);
                session.Store(barWidget);
                session.SaveChanges();

                var widgetFactory = new WidgetFactory(session);
                var widgets = widgetFactory.GetWidgets();

                Assert.Contains(fooWidget, widgets);
                Assert.Contains(barWidget, widgets);
            }
        }
示例#4
0
		public override void Wrap (object obj, bool initialized)
		{
			CustomWidget custom = obj as CustomWidget;
			if (custom != null) {
				RootWrapperName = custom.Name;
			}
			//during Wrap RootWrapperName will be set in the children widgets
			base.Wrap (obj, initialized);
		}
示例#5
0
    public static CustomWidget CreateComponent(CustomWidget where, string queryKey, string dataString)
    {
        CustomWidget widget = Instantiate(where);

        widget.key  = queryKey;
        widget.data = dataString;

        Debug.Log("Added custom widget (" + widget.key + "): " + widget.data);
        return(widget);
    }
示例#6
0
 public override void LoadOptions(Widget widget)
 {
     activeWidget            = widget as CustomWidget;
     tbCustomClassName.Text  = activeWidget.CustomClassName;
     intUserVarDefaultValues = new int[] {
         activeWidget.IntegerUserVariable0DefaultValue,
         activeWidget.IntegerUserVariable1DefaultValue,
         activeWidget.IntegerUserVariable2DefaultValue,
         activeWidget.IntegerUserVariable3DefaultValue,
         activeWidget.IntegerUserVariable4DefaultValue,
         activeWidget.IntegerUserVariable5DefaultValue
     };
     stringUserVarDefaultValues = new string[] {
         activeWidget.StringUserVariable0DefaultValue,
         activeWidget.StringUserVariable1DefaultValue
     };
     cbIntUserVar.SelectedIndex       = 0;
     cbStringUserVar.SelectedIndex    = 0;
     tbIntUserVarDefaultValue.Text    = activeWidget.IntegerUserVariable0DefaultValue.ToString();
     tbStringUserVarDefaultValue.Text = activeWidget.StringUserVariable0DefaultValue;
 }
        private void Button_CreateNewWidget_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog()
            {
                Filter = "Текстовые файлы (*.txt)|*.txt",
            };

            if (fileDialog.ShowDialog() == true)
            {
                FileInfo fileInfo = new FileInfo(fileDialog.FileName);

                FileItem fileItem = new FileItem()
                {
                    Name = fileInfo.Name,
                    Path = fileInfo.DirectoryName
                };

                List <FileItem> fileItemsList = JsonWorker.DeserializationFileItemsJson(JsonWorker.JsonFileItems);
                fileItemsList.Add(fileItem);

                JsonWorker.JsonFileItems = JsonWorker.SerializationFileItemsJson(fileItemsList);

                using (FileStream stream = new FileStream(JsonWorker.JsonFilePath, FileMode.OpenOrCreate))
                {
                    byte[] array = Encoding.Default.GetBytes(JsonWorker.JsonFileItems);
                    stream.Write(array, 0, array.Length);
                }

                CustomWidget newWidget = new CustomWidget()
                {
                    FileName     = fileItem.Name,
                    FilePathInfo = fileItem.Path,
                    Width        = 400
                };

                ListBoxFiles.Items.Add(newWidget);

                newWidget.IsEnabledTextBoxFileName     = false;
                newWidget.IsEnabledTextBoxFilePathInfo = false;
                newWidget.VisibilityButtonCloseFile    = true;
                newWidget.OpenFileStatus = true;

                Process process = new Process
                {
                    StartInfo           = new ProcessStartInfo("notepad", Path.Combine(fileItem.Path, fileItem.Name)),
                    EnableRaisingEvents = true
                };

                process.Exited += (x, y) =>
                {
                    Dispatcher.Invoke(() =>
                    {
                        newWidget.IsEnabledTextBoxFileName     = true;
                        newWidget.IsEnabledTextBoxFilePathInfo = true;
                        newWidget.VisibilityButtonCloseFile    = false;
                        newWidget.OpenFileStatus = false;
                    });
                };

                newWidget.OpenedFile = process;
                process.Start();
            }
        }
示例#8
0
 		public void Setup()
 		{
 		    ViewModelBootstrapperForTests.Initialize();
 			widget = new CustomWidget();
 		}