コード例 #1
0
        public WebView()
        {
            webBrowser.HorizontalAlignment = HorizontalAlignment.Stretch;
            webBrowser.VerticalAlignment   = VerticalAlignment.Stretch;

            #region
            members = new Dictionary <string, Variable>
            {
                { "Width", new FVariable {
                      ongetvalue = () => new Gnumber(webBrowser.Width),
                      onsetvalue = (value) => { webBrowser.Width = Convert.ToDouble(value); return(0); }
                  } },
                { "Height", new FVariable
                  {
                      ongetvalue = () => new Gnumber(webBrowser.Height),
                      onsetvalue = (value) => { webBrowser.Height = Convert.ToDouble(value); return(0); }
                  } },
                { "Horizontal", new FVariable

                  {
                      ongetvalue = () => new Gstring(webBrowser.HorizontalAlignment.ToString()),
                      onsetvalue = (value) => {
                          if (value.ToString() == "center")
                          {
                              webBrowser.HorizontalAlignment = HorizontalAlignment.Center;
                          }
                          else if (value.ToString() == "left")
                          {
                              webBrowser.HorizontalAlignment = HorizontalAlignment.Left;
                          }
                          else if (value.ToString() == "right")
                          {
                              webBrowser.HorizontalAlignment = HorizontalAlignment.Right;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              webBrowser.HorizontalAlignment = HorizontalAlignment.Stretch;
                          }
                          return(0);
                      }
                  } },
                { "Vertical", new FVariable {
                      ongetvalue = () => new Gstring(webBrowser.VerticalAlignment.ToString()),
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "center")
                          {
                              webBrowser.VerticalAlignment = VerticalAlignment.Center;
                          }
                          else if (value.ToString() == "bottom")
                          {
                              webBrowser.VerticalAlignment = VerticalAlignment.Bottom;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              webBrowser.VerticalAlignment = VerticalAlignment.Stretch;
                          }
                          else if (value.ToString() == "top")
                          {
                              webBrowser.VerticalAlignment = VerticalAlignment.Top;
                          }
                          return(0);
                      }
                  } },
                { "Margin", new FVariable {
                      ongetvalue = () => new Glist {
                          new Variable(webBrowser.Margin.Left), new Variable(webBrowser.Margin.Top), new Variable(webBrowser.Margin.Right), new Variable(webBrowser.Margin.Bottom)
                      },
                      onsetvalue = (value) =>
                      {
                          var list = value.IGetCSValue() as Glist;
                          webBrowser.Margin = new Thickness(
                              Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value)
                              );
                          return(0);
                      }
                  } },
                { "Visibility", new FVariable {
                      ongetvalue = () =>
                      {
                          string s = "null";
                          switch (webBrowser.Visibility)
                          {
                          case Visibility.Collapsed: s = "gone"; break;

                          case Visibility.Hidden: s = "hidden"; break;

                          case Visibility.Visible: s = "visible"; break;
                          }
                          return(new Gstring(s));
                      },
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "gone")
                          {
                              webBrowser.Visibility = Visibility.Collapsed;
                          }
                          else if (value.ToString() == "hidden")
                          {
                              webBrowser.Visibility = Visibility.Hidden;
                          }
                          else if (value.ToString() == "visible")
                          {
                              webBrowser.Visibility = Visibility.Visible;
                          }
                          return(0);
                      }
                  } },
                { "Url", new FVariable {
                      ongetvalue = () => new Gstring(webBrowser.Source.ToString()),
                      onsetvalue = (value) =>
                      {
                          webBrowser.Source = new Uri(value.ToString());
                          return(0);
                      }
                  } },
                {
                    "InvokeJS", new Variable(new MFunction(invokejs, this))
                }
            };
            parent = new GTWPF.Control(webBrowser);
            #endregion
        }
コード例 #2
0
ファイル: Image.cs プロジェクト: freeman888/GI
        public Image()
        {
            HorizontalAlignment = HorizontalAlignment.Center;
            VerticalAlignment   = VerticalAlignment.Center;
            #region
            members = new Dictionary <string, Variable>
            {
                { "Width", new FVariable {
                      ongetvalue = () => new Gnumber(Width),
                      onsetvalue = (value) => { Width = Convert.ToDouble(value); return(0); }
                  } },
                { "Height", new FVariable
                  {
                      ongetvalue = () => new Gnumber(Height),
                      onsetvalue = (value) => { Height = Convert.ToDouble(value); return(0); }
                  } },
                { "Horizontal", new FVariable
                  {
                      ongetvalue = () => new Gstring(HorizontalAlignment.ToString()),
                      onsetvalue = (value) => {
                          if (value.ToString() == "center")
                          {
                              HorizontalAlignment = HorizontalAlignment.Center;
                          }
                          else if (value.ToString() == "left")
                          {
                              HorizontalAlignment = HorizontalAlignment.Left;
                          }
                          else if (value.ToString() == "right")
                          {
                              HorizontalAlignment = HorizontalAlignment.Right;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              HorizontalAlignment = HorizontalAlignment.Stretch;
                          }
                          return(0);
                      }
                  } },
                { "Vertical", new FVariable {
                      ongetvalue = () => new Gstring(VerticalAlignment.ToString()),
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "center")
                          {
                              VerticalAlignment = VerticalAlignment.Center;
                          }
                          else if (value.ToString() == "bottom")
                          {
                              VerticalAlignment = VerticalAlignment.Bottom;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              VerticalAlignment = VerticalAlignment.Stretch;
                          }
                          else if (value.ToString() == "top")
                          {
                              VerticalAlignment = VerticalAlignment.Top;
                          }
                          return(0);
                      }
                  } },
                { "Margin", new FVariable {
                      ongetvalue = () => new Glist {
                          new Variable(Margin.Left), new Variable(Margin.Top), new Variable(Margin.Right), new Variable(Margin.Bottom)
                      },
                      onsetvalue = (value) =>
                      {
                          var list = value.IGetCSValue() as Glist;
                          Margin = new Thickness(
                              Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value)
                              );
                          return(0);
                      }
                  } },
                { "Visibility", new FVariable {
                      ongetvalue = () =>
                      {
                          string s = "null";
                          switch (Visibility)
                          {
                          case Visibility.Collapsed: s = "gone"; break;

                          case Visibility.Hidden: s = "hidden"; break;

                          case Visibility.Visible: s = "visible"; break;
                          }
                          return(new Gstring(s));
                      },
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "gone")
                          {
                              Visibility = Visibility.Collapsed;
                          }
                          else if (value.ToString() == "hidden")
                          {
                              Visibility = Visibility.Hidden;
                          }
                          else if (value.ToString() == "visible")
                          {
                              Visibility = Visibility.Visible;
                          }
                          return(0);
                      }
                  } },
                { "Source", new FVariable {
                      ongetvalue = () => new GStream((System.IO.Stream) new ImageSourceConverter().ConvertTo(Source, typeof(System.IO.Stream))),
                      onsetvalue = (value) =>
                      {
                          try
                          {
                              Source = (ImageSource) new ImageSourceConverter().ConvertFrom(value.IGetCSValue());
                          }
                          catch (Exception e)
                          {
                              MessageBox.Show(e.ToString());
                          }
                          return(0);
                      }
                  } },
            };
            parent = new GTWPF.Control(this);
            #endregion
        }
コード例 #3
0
        public ScrollFlat()
        {
            HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;

            #region
            members = new Dictionary <string, Variable>
            {
                { "Width", new FVariable {
                      ongetvalue = () => new Gnumber(Width),
                      onsetvalue = (value) => { Width = Convert.ToDouble(value); return(0); }
                  } },
                { "Height", new FVariable
                  {
                      ongetvalue = () => new Gnumber(Height),
                      onsetvalue = (value) => { Height = Convert.ToDouble(value); return(0); }
                  } },
                { "Horizontal", new FVariable
                  {
                      ongetvalue = () => new Gstring(HorizontalAlignment.ToString()),
                      onsetvalue = (value) => {
                          if (value.ToString() == "center")
                          {
                              HorizontalAlignment = HorizontalAlignment.Center;
                          }
                          else if (value.ToString() == "left")
                          {
                              HorizontalAlignment = HorizontalAlignment.Left;
                          }
                          else if (value.ToString() == "right")
                          {
                              HorizontalAlignment = HorizontalAlignment.Right;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              HorizontalAlignment = HorizontalAlignment.Stretch;
                          }
                          return(0);
                      }
                  } },
                { "Vertical", new FVariable {
                      ongetvalue = () => new Gstring(VerticalAlignment.ToString()),
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "center")
                          {
                              VerticalAlignment = VerticalAlignment.Center;
                          }
                          else if (value.ToString() == "bottom")
                          {
                              VerticalAlignment = VerticalAlignment.Bottom;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              VerticalAlignment = VerticalAlignment.Stretch;
                          }
                          else if (value.ToString() == "top")
                          {
                              VerticalAlignment = VerticalAlignment.Top;
                          }
                          return(0);
                      }
                  } },
                { "Margin", new FVariable {
                      ongetvalue = () => new Glist {
                          new Variable(Margin.Left), new Variable(Margin.Top), new Variable(Margin.Right), new Variable(Margin.Bottom)
                      },
                      onsetvalue = (value) =>
                      {
                          var list = value.IGetCSValue() as Glist;
                          Margin = new Thickness(
                              Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value)
                              );
                          return(0);
                      }
                  } },
                { "Visibility", new FVariable {
                      ongetvalue = () =>
                      {
                          string s = "null";
                          switch (Visibility)
                          {
                          case Visibility.Collapsed: s = "gone"; break;

                          case Visibility.Hidden: s = "hidden"; break;

                          case Visibility.Visible: s = "visible"; break;
                          }
                          return(new Gstring(s));
                      },
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "gone")
                          {
                              Visibility = Visibility.Collapsed;
                          }
                          else if (value.ToString() == "hidden")
                          {
                              Visibility = Visibility.Hidden;
                          }
                          else if (value.ToString() == "visible")
                          {
                              Visibility = Visibility.Visible;
                          }
                          return(0);
                      }
                  } },


                { "Padding", new FVariable {
                      ongetvalue = () => new Glist {
                          new Variable(Padding.Left), new Variable(Padding.Top), new Variable(Padding.Right), new Variable(Padding.Bottom)
                      },
                      onsetvalue = (value) =>
                      {
                          var list = value.IGetCSValue() as Glist;
                          Padding = new Thickness(
                              Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value)
                              );
                          return(0);
                      }
                  } },
                { "Background", new FVariable {
                      ongetvalue = () => new Gstring(Background.ToString()),
                      onsetvalue = (value) =>
                      {
                          Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value.ToString()));
                          return(0);
                      }
                  } },


                { "ScrollPosition", new FVariable
                  {
                      ongetvalue = () =>
                      {
                          return(new Glist
                            {
                                new Variable(ScrollInfo.HorizontalOffset),
                                new Variable(ScrollInfo.VerticalOffset)
                            });
                      },
                      onsetvalue = (value) =>
                      {
                          if (value.IGetType() == "List")
                          {
                              var list = value.IGetCSValue() as Glist;
                              var ho   = Convert.ToDouble(list[0].value);
                              var vo   = Convert.ToDouble(list[1].value);
                              ScrollToHorizontalOffset(ho);
                              ScrollToVerticalOffset(vo);
                          }
                          else
                          {
                              string s_info = value.ToString();
                              switch (s_info)
                              {
                              case "bottom":
                                  ScrollToBottom();
                                  return(0);

                              case "end":
                                  ScrollToEnd();
                                  return(0);

                              case "home":
                                  ScrollToHome();
                                  return(0);

                              case "leftend":
                                  ScrollToLeftEnd();
                                  return(0);

                              case "rightend":
                                  ScrollToRightEnd();
                                  return(0);

                              case "top":
                                  ScrollToTop();
                                  return(0);

                              default:
                                  break;
                              }
                          }
                          return(0);
                      }
                  } },
                { "SetContent", new Variable(new MFunction(setcontent, this)) }
            };
            parent = new GTWPF.Control(this);
            #endregion
        }
コード例 #4
0
ファイル: GridFlat.cs プロジェクト: freeman888/GI
        public GridFlat()
        {
            #region
            members = new Dictionary <string, Variable>
            {
                { "Width", new FVariable {
                      ongetvalue = () => new Gnumber(Width),
                      onsetvalue = (value) => { Width = Convert.ToDouble(value); return(0); }
                  } },
                { "Height", new FVariable
                  {
                      ongetvalue = () => new Gnumber(Height),
                      onsetvalue = (value) => { Height = Convert.ToDouble(value); return(0); }
                  } },
                { "Horizontal", new FVariable
                  {
                      ongetvalue = () => new Gstring(HorizontalAlignment.ToString()),
                      onsetvalue = (value) => {
                          if (value.ToString() == "center")
                          {
                              HorizontalAlignment = HorizontalAlignment.Center;
                          }
                          else if (value.ToString() == "left")
                          {
                              HorizontalAlignment = HorizontalAlignment.Left;
                          }
                          else if (value.ToString() == "right")
                          {
                              HorizontalAlignment = HorizontalAlignment.Right;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              HorizontalAlignment = HorizontalAlignment.Stretch;
                          }
                          return(0);
                      }
                  } },
                { "Vertical", new FVariable {
                      ongetvalue = () => new Gstring(VerticalAlignment.ToString()),
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "center")
                          {
                              VerticalAlignment = VerticalAlignment.Center;
                          }
                          else if (value.ToString() == "bottom")
                          {
                              VerticalAlignment = VerticalAlignment.Bottom;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              VerticalAlignment = VerticalAlignment.Stretch;
                          }
                          else if (value.ToString() == "top")
                          {
                              VerticalAlignment = VerticalAlignment.Top;
                          }
                          return(0);
                      }
                  } },
                { "Margin", new FVariable {
                      ongetvalue = () => new Glist {
                          new Variable(Margin.Left), new Variable(Margin.Top), new Variable(Margin.Right), new Variable(Margin.Bottom)
                      },
                      onsetvalue = (value) =>
                      {
                          var list = value.IGetCSValue() as Glist;
                          Margin = new Thickness(
                              Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value)
                              );
                          return(0);
                      }
                  } },
                { "Visibility", new FVariable {
                      ongetvalue = () =>
                      {
                          string s = "null";
                          switch (Visibility)
                          {
                          case Visibility.Collapsed: s = "gone"; break;

                          case Visibility.Hidden: s = "hidden"; break;

                          case Visibility.Visible: s = "visible"; break;
                          }
                          return(new Gstring(s));
                      },
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "gone")
                          {
                              Visibility = Visibility.Collapsed;
                          }
                          else if (value.ToString() == "hidden")
                          {
                              Visibility = Visibility.Hidden;
                          }
                          else if (value.ToString() == "visible")
                          {
                              Visibility = Visibility.Visible;
                          }
                          return(0);
                      }
                  } },



                { "Background", new FVariable {
                      ongetvalue = () => new Gstring(Background.ToString()),
                      onsetvalue = (value) =>
                      {
                          Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value.ToString()));
                          return(0);
                      }
                  } },

                { "Add", new Variable(new MFunction(add, this)) },
                { "AddRow", new Variable(new MFunction(addrow, this)) },
                { "AddColumn", new Variable(new MFunction(addcolume, this)) }
            };

            parent = new GTWPF.Control(this);
            #endregion
        }
コード例 #5
0
        public Bubble()
        {
            Style = MainWindow.MainApp.BackButton.Style;
            HorizontalAlignment = HorizontalAlignment.Center;
            VerticalAlignment   = VerticalAlignment.Center;
            Click  += Bubble_Click;
            Padding = new Thickness(12, 7, 12, 7);
            #region
            members = new Dictionary <string, Variable>
            {
                { "Width", new FVariable {
                      ongetvalue = () => new Gnumber(Width),
                      onsetvalue = (value) => { Width = Convert.ToDouble(value); return(0); }
                  } },
                { "Height", new FVariable
                  {
                      ongetvalue = () => new Gnumber(Height),
                      onsetvalue = (value) => { Height = Convert.ToDouble(value); return(0); }
                  } },
                { "Horizontal", new FVariable
                  {
                      ongetvalue = () => new Gstring(HorizontalAlignment.ToString()),
                      onsetvalue = (value) => {
                          if (value.ToString() == "center")
                          {
                              HorizontalAlignment = HorizontalAlignment.Center;
                          }
                          else if (value.ToString() == "left")
                          {
                              HorizontalAlignment = HorizontalAlignment.Left;
                          }
                          else if (value.ToString() == "right")
                          {
                              HorizontalAlignment = HorizontalAlignment.Right;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              HorizontalAlignment = HorizontalAlignment.Stretch;
                          }
                          return(0);
                      }
                  } },
                { "Vertical", new FVariable {
                      ongetvalue = () => new Gstring(VerticalAlignment.ToString()),
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "center")
                          {
                              VerticalAlignment = VerticalAlignment.Center;
                          }
                          else if (value.ToString() == "bottom")
                          {
                              VerticalAlignment = VerticalAlignment.Bottom;
                          }
                          else if (value.ToString() == "stretch")
                          {
                              VerticalAlignment = VerticalAlignment.Stretch;
                          }
                          else if (value.ToString() == "top")
                          {
                              VerticalAlignment = VerticalAlignment.Top;
                          }
                          return(0);
                      }
                  } },
                { "Margin", new FVariable {
                      ongetvalue = () => new Glist {
                          new Variable(Margin.Left), new Variable(Margin.Top), new Variable(Margin.Right), new Variable(Margin.Bottom)
                      },
                      onsetvalue = (value) =>
                      {
                          var list = value.IGetCSValue() as Glist;
                          Margin = new Thickness(
                              Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value)
                              );
                          return(0);
                      }
                  } },
                { "Visibility", new FVariable {
                      ongetvalue = () =>
                      {
                          string s = "null";
                          switch (Visibility)
                          {
                          case Visibility.Collapsed: s = "gone"; break;

                          case Visibility.Hidden: s = "hidden"; break;

                          case Visibility.Visible: s = "visible"; break;
                          }
                          return(new Gstring(s));
                      },
                      onsetvalue = (value) =>
                      {
                          if (value.ToString() == "gone")
                          {
                              Visibility = Visibility.Collapsed;
                          }
                          else if (value.ToString() == "hidden")
                          {
                              Visibility = Visibility.Hidden;
                          }
                          else if (value.ToString() == "visible")
                          {
                              Visibility = Visibility.Visible;
                          }
                          return(0);
                      }
                  } },
                { "Text", new FVariable {
                      ongetvalue = () => new Gstring(Content.ToString()),
                      onsetvalue = (value) =>
                      {
                          Content = value.ToString();
                          return(0);
                      }
                  } },
                { "FontSize", new FVariable {
                      ongetvalue = () => new Gnumber(FontSize),
                      onsetvalue = (value) =>
                      {
                          FontSize = Convert.ToDouble(value);
                          return(0);
                      }
                  } },
                { "Padding", new FVariable {
                      ongetvalue = () => new Glist {
                          new Variable(Padding.Left), new Variable(Padding.Top), new Variable(Padding.Right), new Variable(Padding.Bottom)
                      },
                      onsetvalue = (value) =>
                      {
                          var list = value.IGetCSValue() as Glist;
                          Padding = new Thickness(
                              Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value)
                              );
                          return(0);
                      }
                  } },
                { "Background", new FVariable {
                      ongetvalue = () => new Gstring(Background.ToString()),
                      onsetvalue = (value) =>
                      {
                          Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value.ToString()));
                          return(0);
                      }
                  } },
                { "Foreground", new FVariable {
                      ongetvalue = () => new Gstring(Foreground.ToString()),
                      onsetvalue = (value) =>
                      {
                          Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value.ToString()));
                          return(0);
                      }
                  } },
                { "Clickevent", new FVariable
                  {
                      ongetvalue = () => event_click as IOBJ,
                      onsetvalue = (value) =>
                      {
                          event_click = value;
                          return(0);
                      }
                  } }
            };
            parent = new GTWPF.Control(this);
            #endregion
        }