Пример #1
0
        void tabControl_TabItemAdded(object sender) //, TabItemEventArgs e)
        {
            // Add an Icon to the tabItem
            BitmapImage image = new BitmapImage(new Uri("pack://application:,,,/Test;component/Images/ie.ico"));
            Image img = new Image();
            img.Source = image;
            img.Width = 16;
            img.Height = 16;
            img.Margin = new Thickness(2, 0, 2, 0);

            //e.TabItem.Icon = img;

            // wrap the header in a textblock, this gives us the  character ellipsis (...) when trimmed
            TextBlock tb = new TextBlock();
            tb.Text = "New Tab " + count++;
            tb.TextTrimming = TextTrimming.CharacterEllipsis;
            tb.TextWrapping = TextWrapping.NoWrap;

            //e.TabItem.Header = tb;

            // add a WebControl to the TAbItem
            WindowsFormsHost host = new WindowsFormsHost();
            host.Margin = new Thickness(2);
            System.Windows.Forms.WebBrowser browser = new System.Windows.Forms.WebBrowser();
            browser.DocumentTitleChanged += Browser_DocumentTitleChanged;
            browser.Navigated += Browser_Navigated;

            host.Child = browser;
            //e.TabItem.Content = host;
        }
Пример #2
0
 public MSChart()
 {
     host = new WindowsFormsHost();
     chart = new Chart();
     host.Child = chart;
     Content = host;
 }
Пример #3
0
        public WebBrowserHost(TridentWebBrowser tridentWebBrowser)
        {
            ArgumentUtility.CheckNotNull ("tridentWebBrowser", tridentWebBrowser);
              WebBrowser = tridentWebBrowser;

              Content = new WindowsFormsHost { Child = tridentWebBrowser };
        }
        /// <summary>
        /// Hosts the ExplorerBrowser WinForms wrapper in this control
        /// </summary>
        public ExplorerBrowser()
        {
            InitializeComponent();

            // the ExplorerBrowser WinForms control
            ExplorerBrowserControl = new Microsoft.WindowsAPICodePack.Controls.WindowsForms.ExplorerBrowser();

            // back the dependency collection properties with instances
            //SelectedItems = selectedItems = new ObservableCollection<ShellObject>();
            //Items = items = new ObservableCollection<ShellObject>();
           // NavigationLog = navigationLog = new ObservableCollection<ShellObject>();

            // hook up events for collection synchronization
            //ExplorerBrowserControl.ItemsChanged += new EventHandler(ItemsChanged);
            //ExplorerBrowserControl.SelectionChanged += new EventHandler(SelectionChanged);
            //ExplorerBrowserControl.ViewEnumerationComplete += new EventHandler(ExplorerBrowserControl_ViewEnumerationComplete);
            //ExplorerBrowserControl.ViewSelectedItemChanged += new EventHandler(ExplorerBrowserControl_ViewSelectedItemChanged);
            //ExplorerBrowserControl.NavigationLog.NavigationLogChanged += new EventHandler<NavigationLogEventArgs>(NavigationLogChanged);

            // host the control           
            WindowsFormsHost host = new WindowsFormsHost();
            try
            {
                host.Child = ExplorerBrowserControl;
                this.root.Children.Clear();
                this.root.Children.Add(host);
            }
            catch
            {
                host.Dispose();
                throw;
            }

            Loaded += new RoutedEventHandler(ExplorerBrowser_Loaded);
        }
        public CenterGravity()
        {
            InitializeComponent();

            Chart chart = new Chart();
            ChartArea area = new ChartArea();
            area.AxisX.Title = "t";
            area.AxisX.Minimum = 0;
            area.AxisX.MajorGrid.LineColor = Color.LightGray;
            area.AxisY.Title = "Movement";
            area.AxisY.MajorGrid.LineColor = Color.LightGray;
            chart.ChartAreas.Add(area);
            _serie = new Series();
            _serie.ChartType = SeriesChartType.Line;
            _serie.MarkerStyle = MarkerStyle.Diamond;
            _serie.MarkerSize = 9;
            _serie.Color = Color.LimeGreen;
            chart.Series.Add(_serie);

            WindowsFormsHost host = new WindowsFormsHost();
            host.Child = chart;
            movlive.Children.Add(host);

            _cog = new cog(400, 400);
            coglive.Children.Add(_cog);

            _first = true;

            MainController.GetInstance.DataController.AddSensorDataListener(this);
        }
Пример #6
0
        /// <summary>
        /// Initializes several code routines after the webkit containing element loads
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void browserContainer_Loaded(object sender, RoutedEventArgs e)
        {
            WindowsFormsHost host = new WindowsFormsHost();

            wkBrowser = new WebKit.WebKitBrowser();
            host.Child = wkBrowser;

            this.browserContainer.Children.Add(host);


            wkBrowser.Navigate(ConfigurationManager.AppSettings["url"]);

            this.ViewModel.PropertyChanged += (o, f) =>
            {
                if (f.PropertyName.Equals("URI"))
                {
                    MakeJSCall(this.ViewModel.URI);
                    playSoundFeedback();
                }
            };

            setupTimer.Start();


        }
Пример #7
0
 public MainForm()
 {
     //InitializeComponent();
     _tddGameView = new TerrariumDirectDrawGameView();
     var host = new WindowsFormsHost {Child = _tddGameView};
     //tddGameView.Children.Add(host);
 }
Пример #8
0
        public EditorDocument(string input = "")
        {
            if (input == "")
            {
                Title = "Untitled";
                SavedBefore = false;
            }
            else
            {
                Title = Path.GetFileName(input);
                SavedBefore = true;
                InputFile = input;
            }

            _ruby = Settings.RubyTemplate;
            _scope = Settings.ScopeTemplate;

            var editor = Settings.ScintillaTemplate;
            
            if (input != "")
                editor.Text = File.ReadAllText(input);

            Content = new WindowsFormsHost
            {
                Child = editor
            };
        }
Пример #9
0
   public override object CreateDockableContent()
   {
      //return new UserControl1();

      WindowsFormsHost host = new WindowsFormsHost();
      host.Loaded += new System.Windows.RoutedEventHandler(host_Loaded);
      host.Unloaded += new System.Windows.RoutedEventHandler(host_Unloaded);
      //host.MinWidth = 200;
      //host.MinHeight = 200;
      //host.Width = host.Height = 200;


      OutlinerGUP outlinerInstance = OutlinerGUP.Instance;
      if (!outlinerInstance.SettingsLoaded)
      {
         WinForms::MessageBox.Show(OutlinerResources.Warning_SettingsNotLoaded
                                  , OutlinerResources.Warning_SettingsNotLoaded_Title
                                  , WinForms.MessageBoxButtons.OK
                                  , WinForms.MessageBoxIcon.Error
                                  , WinForms.MessageBoxDefaultButton.Button1
                                  , ControlHelpers.CreateLocalizedMessageBoxOptions());

         host.Child = new Outliner.Controls.Options.OutlinerUserControl();
         host.Child.Width = 150;
         host.Child.Height = 200;

         return host;
      }

      MainControl mainControl = new MainControl();
      this.splitContainer = mainControl.outlinerSplitContainer1;
      this.tree1 = mainControl.TreeView1;
      this.tree2 = mainControl.TreeView2;

      OutlinerState outlinerState = outlinerInstance.State;

      this.tree1.Colors = outlinerInstance.ColorScheme.TreeViewColorScheme;
      this.tree2.Colors = outlinerInstance.ColorScheme.TreeViewColorScheme;

      this.splitContainer.Orientation = outlinerState.SplitterOrientation;
      this.splitContainer.SplitterDistance = outlinerState.SplitterDistance;
      this.splitContainer.Panel1Collapsed = outlinerState.Panel1Collapsed;
      this.splitContainer.Panel2Collapsed = outlinerState.Panel2Collapsed;

      TreeMode mode1 = outlinerInstance.SwitchPreset(tree1, outlinerState.Tree1Preset, false);
      TreeMode mode2 = outlinerInstance.SwitchPreset(tree2, outlinerState.Tree2Preset, false);

      mode1.Filters = outlinerState.Tree1Filters;
      mode2.Filters = outlinerState.Tree2Filters;

      mainControl.NameFilterBindingSource.DataSource = outlinerInstance.CommonNameFilter;

      this.splitContainer.PanelCollapsedChanged += panelCollapsedChanged;

      host.Child = mainControl;

      return host;
   }
Пример #10
0
 public WindowsMediaPlayer()
 {
     WindowsFormsHost host = new WindowsFormsHost();
     AxWMP = new AxWMPLib.AxWindowsMediaPlayer();
     host.Child = AxWMP;
     Content = host;
     Loaded += WindowsMediaPlayer_Loaded;
     Unloaded += WindowsMediaPlayer_Unloaded;
 }
Пример #11
0
 private void OnLoaded(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.Panel hostPanel = new System.Windows.Forms.Panel();
     hostPanel.Controls.Add(this.reflexilWindow);
     WindowsFormsHost host = new WindowsFormsHost()
     {
         Child = hostPanel
     };
     this.root.Children.Add(host);
 }
 public PdfFileView()
 {
     InitializeComponent();
       _pdfRenderer = new PdfRenderer();
       _windowsFormsHost = new WindowsFormsHost
       {
     Child = _pdfRenderer
       };
       MainGrid.Children.Add(_windowsFormsHost);
 }
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            var hostPanel = new Panel { };
            hostPanel.Controls.Add(reflexilWindow);

            var host = new WindowsFormsHost { };
            host.Child = hostPanel;

            root.Children.Add(host);
        }
Пример #14
0
        public void PlaceHero()
        {
            System.Windows.Forms.Panel hero = new System.Windows.Forms.Panel();
            hero.BackgroundImage = herosomething.Image ;
            System.Windows.Forms.Button button = new System.Windows.Forms.Button();
            WindowsFormsHost host = new WindowsFormsHost();
            host.Child = hero ;


            PutImage.Children.Add(host);
        }
 public MainWindowViewModel(IDialogService dialogService, WindowsFormsHost windowsFormsHostGraph)
 {
     this.dialogService = dialogService;
     this.windowsFormsHostGraph = windowsFormsHostGraph;
     Initializate();
     var module = UnityConfig.GetConfiguredContainer().Resolve<IE2010>();
     if (!module.OpenLDevice())
     {
         this.dialogService.ShowMessage("","Устройство не подключено");
     }
 }
Пример #16
0
        private void AddPanelToWindow(MainWindow window)
        {
            WindowsFormsHost host = new WindowsFormsHost();
            //host.Background = Brushes.White;
            host.Width = window.Width - 100;
            host.Height = window.Height - 100;

            m_DrawingPanel = new FormDrawing();
            host.Child = m_DrawingPanel;
            window.grid1.Children.Add(host);
        }
Пример #17
0
		public ReflexilHost(IPackage package)
		{
			InitializeComponent();

			_package = package;

			var hostPanel = new Panel();
			hostPanel.Controls.Add(_package.ReflexilWindow);

			var host = new WindowsFormsHost { Child = hostPanel };
			Root.Children.Add(host);
		}
Пример #18
0
		public PadViewModel(PadDescriptor padDescriptor)
		{
			this.padDescriptor = padDescriptor;
			this.padDescriptor.CreatePad();
			
			this.control = padDescriptor.PadContent.Control;
			if (control is System.Windows.Forms.Control) {
				var host = new WindowsFormsHost();
				host.Child = (System.Windows.Forms.Control)padDescriptor.PadContent.Control;
				this.control = host;
			}
		}
        public CorWpfPlatform(WindowsFormsHost winformsHost)
        {
            var program = new WpfProgram();
            var api = new Xna4Api();

            api.InitialiseDependencies(program);
            program.InitialiseDependencies(api);

            Api = api;
            Program = program;

            winformsHost.Child = program.glControl;
        }
Пример #20
0
        private void dockManager_Loaded(object sender, RoutedEventArgs e)
        {
            LayoutDocument document = new LayoutDocument();
            document.CanClose = true;
            document.CanFloat = true;
            //document.DockAsDocument();
            document.Title = "test";

            WindowsFormsHost host = new WindowsFormsHost();
            host.Child = new RoomListPanel();

            documentsPane.Children.Add(document);
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            WindowsFormsHost host = new WindowsFormsHost();

            ZedGraphDiagnosticsControl.DiagnosticsControlZedGraph graph = new ZedGraphDiagnosticsControl.DiagnosticsControlZedGraph();

            host.Child = graph;
            gridLayout.Children.Add(host);
            this.Width = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width;
            this.Height = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height;

            graph.Disposed += new EventHandler(graph_Disposed);

        }
Пример #22
0
        private void WindowLoaded(object sender, System.Windows.RoutedEventArgs e)
        {
            // Create the interop host control.
            var host = new WindowsFormsHost();
            this.codeEditorControl = new Scintilla { MatchBraces = true };
            this.codeEditorControl.DocumentChange += this.CodeEditorControlTextChanged;

            // Assign the MaskedTextBox control as the host control's child.
            host.Child = this.codeEditorControl;

            // Add the interop host control to the Grid
            // control's collection of child controls.
            this.CodeEditorGrid.Children.Add(host);
        }
Пример #23
0
        private void LoadPivot()
        {
            try
            {

                //Create a Windows Forms Host to host a form
                WindowsFormsHost host = new WindowsFormsHost();

                host.HorizontalAlignment = HorizontalAlignment.Stretch;
                host.VerticalAlignment = VerticalAlignment.Stretch;


                pivotView.Width = 1000;
                pivotView.Height = 570;
                pivotView.AppearanceSettings.SchemaVisible = true;
                pivotView.AppearanceSettings.ExpandGlyphs = ExpandGlyphsStyle.On;
                pivotView.AutoRefreshGrid = true;
                pivotView.CardLayout.DisplayPanels = false;


                RdDataSource dataSource = new RdDataSource();
                pivotView.DataSource = dataSource;

                string qString = Util.GetConfigOption("CNNSTR");
                dataSource.ConnectionString = qString;
                //dataSource.ConnectionString = "Data Source=CRMES;Initial Catalog=WMS30;User Id=sa;Password=2289";


                dataSource.ConnectionType = DataDynamics.Analysis.DataSources.ConnectionType.Sql;
                dataSource.CustomSchemaFile = "receiving.schema";
                dataSource.QueryString = "SELECT * FROM dbo.vwReceivingProcess";

                dataSource.Connect();
                LoadPivotLayout();

                host.Child = pivotView;
                gridP.Children.Add(host);


                pivotView.Run();

            }
            catch (Exception ex)
            {
                Util.ShowMessage("Problem loading the cube. " + ex.Message);
                return;
            }

        }
        public OfflineGraphsWindow(List<List<int>> external_data)
        {
            InitializeComponent();

            data = new List<List<int>>();
            data = external_data;

            // Custom setup
            winFormHost = wfhOffline;
            winFormHost.Child = graph;
            cbbItem.SelectedIndex = 0;
            setupGraphs();
            UpdateGraphPane();
            drawGraphs();
        }
Пример #25
0
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            // Create the interop host control.
            var host =
                new WindowsFormsHost();

            // Create the MaskedTextBox control.
            var mtbDate = new MaskedTextBox("00/00/0000");

            // Assign the MaskedTextBox control as the host control's child.
            host.Child = mtbDate;

            // Add the interop host control to the Grid
            // control's collection of child controls.
            grid1.Children.Add(host);
        }
Пример #26
0
 /// <summary>
 /// Standard constructor for the tool window.
 /// </summary>
 public MyToolWindow()
     : base(null)
 {
     // Set the window title reading it from the resources.
     this.Caption = Resources.ToolWindowTitle;
     // Set the image that will appear on the tab of the window frame
     // when docked with an other window
     // The resource ID correspond to the one defined in the resx file
     // while the Index is the offset in the bitmap strip. Each image in
     // the strip being 16x16.
     this.BitmapResourceID = 301;
     this.BitmapIndex = 1;
     WindowsFormsHost host = new WindowsFormsHost();
     host.Child = new NunitView();
     control = host;
 }
Пример #27
0
        private void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            // Create the host and the ActiveX control
            WindowsFormsHost host = new WindowsFormsHost();
            rdClient = new AxMsRdpClient8NotSafeForScripting();

            // Add the ActiveX control to the host, and the host to the WPF panel
            host.Child = rdClient;
            tiGrid0.Children.Add(host);

            rdClient.Server = txtServer.Text.Trim();
            rdClient.DesktopWidth = rdClient.Width = (int)TabControl1.Width;
            rdClient.DesktopHeight = rdClient.Height = (int)TabControl1.Height;
            //rdClient.AdvancedSettings8.ClearTextPassword = "******";
            rdClient.AdvancedSettings8.EnableCredSspSupport = true;
            rpcConnect();
        }
Пример #28
0
        private void Load(string path)
        {
            WinFormPdfHost formsPdfHost;
            if (LayoutRoot.Children.Count == 0)
            {
                WindowsFormsHost formsHost = new WindowsFormsHost();
                formsPdfHost = new WinFormPdfHost();
                formsHost.Child = formsPdfHost;
                LayoutRoot.Children.Add(formsHost);
            }
            else
            {
                formsPdfHost = (WinFormPdfHost)((WindowsFormsHost)LayoutRoot.Children[0]).Child;
            }

            formsPdfHost.LoadFile(path);
        }
Пример #29
0
        public UserControl1(CaseObject caseObj)
        {
            m_CaseObj = caseObj;

            InitializeComponent();

            foreach (DataAttachment attachment in m_CaseObj.attachments.GetManifestAttachments())
            {
                try
                {
                    if (!Directory.Exists(TempDir))
                    {
                        Directory.CreateDirectory(TempDir);
                    }

                    String filename = TempDir + attachment.attachmentId;

                    if (File.Exists(filename))
                    {
                        File.Delete(filename);
                    }

                    using (MemoryStream ms = new MemoryStream(attachment.attachmentData.GetBuffer()))
                    {
                        FileStream fs = new FileStream(filename, FileMode.OpenOrCreate, FileAccess.ReadWrite);
                        fs.Write(ms.ToArray(), 0, (int)ms.Length);
                        fs.Close();
                    }
                    
                    PDFHolder pf = new PDFHolder();
                    pf.LoadPDF(filename);

                    WindowsFormsHost wfh = new WindowsFormsHost();
                    wfh.Child = pf;
                    TabItem ti1 = new TabItem();
                    ti1.Header = attachment.attachmentId;
                    ti1.Content = wfh;
                    
                    ManifestTab.Items.Add(ti1);
                }
                catch(Exception ex)
                {
                    //TODO: Log Message here.
                }
            }
        }
Пример #30
0
        public CameraViewModel(IApplicationController app)
            : base()
        {
            _app = app;

            // Add loading label
            Label loadingLabel      = new Label();
            loadingLabel.Text       = "Camera is being loaded...";
            loadingLabel.ForeColor  = Color.White;
            loadingLabel.AutoSize   = false;
            loadingLabel.Dock       = DockStyle.Fill;
            loadingLabel.TextAlign  = ContentAlignment.MiddleCenter;

            WindowsFormsHost host = new WindowsFormsHost();
            host.Child = loadingLabel;
            CameraHost = host;
        }
Пример #31
0
        /// <summary>
        /// создать менеджера роботов
        /// </summary>
        /// <param name="hostChart">область для чарта</param>
        /// <param name="hostGlass">область для стакана</param>
        /// <param name="hostOpenDeals">область для таблицы открытых сделок</param>
        /// <param name="hostCloseDeals">область для таблицы закрытых сделок</param>
        /// <param name="hostAllDeals">область всех сделок</param>
        /// <param name="hostLogBot">область для бот лога</param>
        /// <param name="hostLogPrime">область для прайм лога</param>
        /// <param name="rectangleAroundChart">квадрат за чартом</param>
        /// <param name="hostAlerts">область для алертов</param>
        /// <param name="tabPanel">панель с роботами</param>
        /// <param name="tabBotTab">панель робота с вкладками инструментов</param>
        /// <param name="textBoxLimitPrice">текстБокс с ценой лимитника при вводе заявки</param>
        public OsTraderMaster(WindowsFormsHost hostChart, WindowsFormsHost hostGlass, WindowsFormsHost hostOpenDeals,
                              WindowsFormsHost hostCloseDeals, WindowsFormsHost hostAllDeals, WindowsFormsHost hostLogBot, WindowsFormsHost hostLogPrime, Rectangle rectangleAroundChart, WindowsFormsHost hostAlerts,
                              TabControl tabPanel, TabControl tabBotTab, TextBox textBoxLimitPrice)
        {
            NumberGen.GetNumberOrder();
            if (ServerMaster.IsTester)
            {
                _typeWorkKeeper = ConnectorWorkType.Tester;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingStartEvent += StrategyKeeper_TestingStartEvent;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingFastEvent  += StrategyKeeper_TestingFastEvent;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingEndEvent   += StrategyKeeper_TestingEndEvent;
            }

            if (!ServerMaster.IsTester)
            {
                ServerMaster.Activate();
            }

            ServerMaster.LogMessageEvent += SendNewLogMessage;

            _tabBotTab = tabBotTab;

            if (_tabBotTab.Items != null)
            {
                _tabBotTab.Items.Clear();
            }
            _textBoxLimitPrice    = textBoxLimitPrice;
            _hostChart            = hostChart;
            _hostGlass            = hostGlass;
            _hostOpenDeals        = hostOpenDeals;
            _hostCloseDeals       = hostCloseDeals;
            _hostAllDeals         = hostAllDeals;
            _hostboxLog           = hostLogBot;
            _rectangleAroundChart = rectangleAroundChart;
            _hostAlerts           = hostAlerts;

            _tabBotNames = tabPanel;
            _tabBotNames.Items.Clear();

            _riskManager = new RiskManager.RiskManager("GlobalRiskManager");
            _riskManager.RiskManagerAlarmEvent += _riskManager_RiskManagerAlarmEvent;
            _riskManager.LogMessageEvent       += SendNewLogMessage;
            _globalController = new GlobalPosition(_hostAllDeals);
            _globalController.LogMessageEvent += SendNewLogMessage;

            _log = new Log("Prime");
            _log.StartPaint(hostLogPrime);
            _log.Listen(this);
            _hostLogPrime = hostLogPrime;

            Load();
            _tabBotNames.SelectionChanged += _tabBotControl_SelectionChanged;
            ReloadRiskJournals();
            _globalController.StartPaint();
        }
Пример #32
0
        /// <summary>
        /// Perform an SQLite, MySQL, SqlServer. OleDb or Odbc command (not a query) on a database.
        /// If this database is viewed in a dataview then unsaved user changes will be lost when the dataview is updated following this operation.
        /// </summary>
        /// <param name="database">The existing database label (see ConnectSQLite, ConnectMySQL, ConnectSqlServer, ConnectOleDb or ConnectOdbc).</param>
        /// <param name="command">The SQL Command.</param>
        /// <returns>The number of rows updated.</returns>
        public static Primitive Command(Primitive database, Primitive command)
        {
            int rowsUpdated = 0;

            try
            {
                DataBase dataBase = GetDataBase(database);
                if (null == dataBase)
                {
                    return(rowsUpdated);
                }
                switch (dataBase.dbType)
                {
                case DataBase.DBType.SQLite:
                {
                    dataBase.commandSQLite.CommandText = command;
                    rowsUpdated = dataBase.commandSQLite.ExecuteNonQuery();
                }
                break;

                case DataBase.DBType.MySql:
                {
                    dataBase.commandMySql.CommandText = command;
                    rowsUpdated = dataBase.commandMySql.ExecuteNonQuery();
                }
                break;

                case DataBase.DBType.SqlServer:
                {
                    dataBase.commandSqlServer.CommandText = command;
                    rowsUpdated = dataBase.commandSqlServer.ExecuteNonQuery();
                }
                break;

                case DataBase.DBType.OleDb:
                {
                    dataBase.commandOleDb.CommandText = command;
                    rowsUpdated = dataBase.commandOleDb.ExecuteNonQuery();
                }
                break;

                case DataBase.DBType.Odbc:
                {
                    dataBase.commandOdbc.CommandText = command;
                    rowsUpdated = dataBase.commandOdbc.ExecuteNonQuery();
                }
                break;
                }

                Type GraphicsWindowType = typeof(GraphicsWindow);
                Dictionary <string, UIElement> _objectsMap;
                _objectsMap = (Dictionary <string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
                foreach (KeyValuePair <string, UIElement> kvp in _objectsMap)
                {
                    if (kvp.Value.GetType() == typeof(WindowsFormsHost))
                    {
                        WindowsFormsHost host = (WindowsFormsHost)kvp.Value;
                        if (null != host.Child && host.Child.GetType() == typeof(DataGridView))
                        {
                            DataGridView dataView = (DataGridView)host.Child;
                            if (null != dataView.Tag && dataView.Tag.GetType() == typeof(DataTable))
                            {
                                DataTable dataTable = (DataTable)dataView.Tag;
                                if (null != dataTable)
                                {
                                    string tableName = dataTable.TableName;
                                    string query     = "SELECT * FROM " + tableName;
                                    GetDataTable(dataBase, query, dataTable);
                                    dataView.Refresh();

                                    //EditTable(database, dataTable.TableName, dataView.Name);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }

            return(rowsUpdated);
        }
Пример #33
0
 public MainWindow()
 {
     InitializeComponent();
     WindowsFormsHost.EnableWindowsFormsInterop();
 }
Пример #34
0
 /// <summary>
 /// start drawing log
 /// начать прорисовку лога
 /// </summary>
 public void StartPaintLog(WindowsFormsHost logHost)
 {
     _log.StartPaint(logHost);
 }
Пример #35
0
        void _initializeBehaviorListsPage()
        {
            //Initialize the page items
            BehaviorListsPageTabItem        = new TabItem();
            BehaviorListsPageTabItem.Header = "Behavior Lists";
            BehaviorListsPageTabItem.Width  = 100;
            PagesTabControl.Items.Add(BehaviorListsPageTabItem);
            BehaviorListsGrid = new Grid();

            //Asteroids in range
            Label asteroidsInRangeLabel = new Label();

            asteroidsInRangeLabel.Content             = "Asteroids In Range";
            asteroidsInRangeLabel.Height              = 28;
            asteroidsInRangeLabel.HorizontalAlignment = HorizontalAlignment.Left;
            asteroidsInRangeLabel.Margin              = new Thickness(6, 6, 0, 0);
            asteroidsInRangeLabel.VerticalAlignment   = VerticalAlignment.Top;
            BehaviorListsGrid.Children.Add(asteroidsInRangeLabel);

            AsteroidsInRangeListBox        = new ListBox();
            AsteroidsInRangeListBox.Height = 100;
            AsteroidsInRangeListBox.HorizontalAlignment = HorizontalAlignment.Left;
            AsteroidsInRangeListBox.VerticalAlignment   = VerticalAlignment.Top;
            AsteroidsInRangeListBox.Margin = new Thickness(4, 37, 0, 0);
            AsteroidsInRangeListBox.Width  = 345;
            BehaviorListsGrid.Children.Add(AsteroidsInRangeListBox);

            //Asteroids out of range
            Label asteroidsOutOfRangeLabel = new Label();

            asteroidsOutOfRangeLabel.Content             = "Asteroids Out of Range";
            asteroidsOutOfRangeLabel.Height              = 28;
            asteroidsOutOfRangeLabel.HorizontalAlignment = HorizontalAlignment.Left;
            asteroidsOutOfRangeLabel.Margin              = new Thickness(354, 6, 0, 0);
            asteroidsOutOfRangeLabel.VerticalAlignment   = VerticalAlignment.Top;
            BehaviorListsGrid.Children.Add(asteroidsOutOfRangeLabel);

            AsteroidsOutOfRangeListBox        = new ListBox();
            AsteroidsOutOfRangeListBox.Height = 100;
            AsteroidsOutOfRangeListBox.HorizontalAlignment = HorizontalAlignment.Right;
            AsteroidsOutOfRangeListBox.VerticalAlignment   = VerticalAlignment.Top;
            AsteroidsOutOfRangeListBox.Margin = new Thickness(0, 37, 4, 0);
            AsteroidsOutOfRangeListBox.Width  = 345;
            BehaviorListsGrid.Children.Add(AsteroidsOutOfRangeListBox);

            //Labels for the DataGridViewHosts
            Label itemsMined_MovedLabel = new Label();

            itemsMined_MovedLabel.Content             = "Items Mined / Moved";
            itemsMined_MovedLabel.HorizontalAlignment = HorizontalAlignment.Left;
            itemsMined_MovedLabel.VerticalAlignment   = VerticalAlignment.Top;
            itemsMined_MovedLabel.Margin = new Thickness(6, 143, 0, 0);
            BehaviorListsGrid.Children.Add(itemsMined_MovedLabel);

            Label ammo_crystalsUsed = new Label();

            ammo_crystalsUsed.Content             = "Ammo / Crystals Used";
            ammo_crystalsUsed.HorizontalAlignment = HorizontalAlignment.Left;
            ammo_crystalsUsed.VerticalAlignment   = VerticalAlignment.Top;
            ammo_crystalsUsed.Margin = new Thickness(356, 143, 0, 0);
            BehaviorListsGrid.Children.Add(ammo_crystalsUsed);

            //Initialize the WindowsFormHosts for the DataGridViews, set their children to their DataGridViews,
            //and add them to the grid.
            System.Windows.Forms.DataGridViewCell templateCell = new System.Windows.Forms.DataGridViewTextBoxCell();
            ItemsMined_MovedDataGridView = new System.Windows.Forms.DataGridView();
            ItemsMined_MovedDataGridView.AllowUserToAddRows    = false;
            ItemsMined_MovedDataGridView.AllowUserToDeleteRows = false;
            ItemsMined_MovedDataGridView.Columns.Add(new System.Windows.Forms.DataGridViewColumn()
            {
                Name = "Items Mined / Moved", CellTemplate = templateCell, Width = 175
            });
            ItemsMined_MovedDataGridView.Columns.Add(new System.Windows.Forms.DataGridViewColumn()
            {
                Name = "Quantity", CellTemplate = templateCell
            });
            ItemsMined_MovedDataGridViewHost = new WindowsFormsHost();
            ItemsMined_MovedDataGridViewHost.VerticalAlignment   = VerticalAlignment.Top;
            ItemsMined_MovedDataGridViewHost.HorizontalAlignment = HorizontalAlignment.Left;
            ItemsMined_MovedDataGridViewHost.Margin = new Thickness(4, 177, 0, 0);
            ItemsMined_MovedDataGridViewHost.Height = 100;
            ItemsMined_MovedDataGridViewHost.Width  = 345;
            ItemsMined_MovedDataGridViewHost.Child  = ItemsMined_MovedDataGridView;
            BehaviorListsGrid.Children.Add(ItemsMined_MovedDataGridViewHost);

            Ammo_CrystalsUsedDataGridView = new System.Windows.Forms.DataGridView();
            Ammo_CrystalsUsedDataGridView.AllowUserToAddRows    = false;
            Ammo_CrystalsUsedDataGridView.AllowUserToDeleteRows = false;
            Ammo_CrystalsUsedDataGridView.Columns.Add(new System.Windows.Forms.DataGridViewColumn()
            {
                Name = "Ammo / Crystal Type", CellTemplate = templateCell, Width = 175
            });
            Ammo_CrystalsUsedDataGridView.Columns.Add(new System.Windows.Forms.DataGridViewColumn()
            {
                Name = "Quantity", CellTemplate = templateCell
            });
            Ammo_CrystalsUsedDataGridViewHost = new WindowsFormsHost();
            Ammo_CrystalsUsedDataGridViewHost.VerticalAlignment   = VerticalAlignment.Top;
            Ammo_CrystalsUsedDataGridViewHost.HorizontalAlignment = HorizontalAlignment.Left;
            Ammo_CrystalsUsedDataGridViewHost.Margin = new Thickness(354, 177, 0, 0);
            Ammo_CrystalsUsedDataGridViewHost.Height = 100;
            Ammo_CrystalsUsedDataGridViewHost.Width  = 345;
            Ammo_CrystalsUsedDataGridViewHost.Child  = Ammo_CrystalsUsedDataGridView;
            BehaviorListsGrid.Children.Add(Ammo_CrystalsUsedDataGridViewHost);

            BehaviorListsPageTabItem.Content = BehaviorListsGrid;
        }
Пример #36
0
        public void SpawnReportViewerWindow(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                var menuItem = sender as MenuItem;
                if (menuItem == null)
                {
                    return;
                }
                var menuInfo = menuItem.CommandParameter as MenuCommandParameters;
                if (menuInfo == null)
                {
                    return;
                }

                WindowsFormsHost wh = new WindowsFormsHost();
                ReportGrid       rg = new ReportGrid();

                var ds = new DataSet();

                using (IRepository repository = RepoHelper.CreateRepository(menuInfo.Connectionstring))
                {
                    var sqlText = string.Format(Environment.NewLine + "SELECT * FROM [{0}]", menuInfo.Name)
                                  + Environment.NewLine + "GO";
                    ds = repository.ExecuteSql(sqlText);
                }
                rg.DataSet   = ds;
                rg.TableName = menuInfo.Name;
                wh.Child     = rg;

                string tabTitle     = System.IO.Path.GetFileNameWithoutExtension(menuInfo.Caption) + "-" + menuInfo.Name + "-Report";
                bool   alreadyThere = false;
                int    i            = -1;
                foreach (var item in _parent.FabTab.Items)
                {
                    i++;
                    if (item is FabTabItem)
                    {
                        FabTabItem ftItem = (FabTabItem)item;
                        if (ftItem.Header.ToString() == tabTitle)
                        {
                            alreadyThere = true;
                        }
                    }
                }
                if (alreadyThere)
                {
                    _parent.FabTab.SelectedIndex = i;
                    _parent.FabTab.Focus();
                }
                else
                {
                    FabTabItem tab = new FabTabItem();
                    tab.Content = wh;
                    tab.Header  = tabTitle;
                    _parent.FabTab.Items.Add(tab);
                    _parent.FabTab.SelectedIndex = _parent.FabTab.Items.Count - 1;
                    rg.Focus();
                }
                return;
            }
            catch (System.IO.FileNotFoundException)
            {
                MessageBox.Show("Microsoft Report Viewer 2010 not installed, please download and install to use this feature  http://www.microsoft.com/en-us/download/details.aspx?id=6442");
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(Helpers.DataConnectionHelper.ShowErrors(ex));
            }
        }
 public static UserControl userControl(this WindowsFormsHost windowsFormsHost)
 {
     return(windowsFormsHost.userControl <UserControl>());
 }
Пример #38
0
        void CreateGridPatternsGrid(DataGridView grid, WindowsFormsHost host)
        {
            grid.AllowUserToOrderColumns = true;
            grid.AllowUserToResizeRows   = true;
            grid.AutoSizeRowsMode        = DataGridViewAutoSizeRowsMode.AllCells;
            grid.AllowUserToDeleteRows   = false;
            grid.AllowUserToAddRows      = false;
            grid.RowHeadersVisible       = false;
            grid.SelectionMode           = DataGridViewSelectionMode.FullRowSelect;
            grid.MultiSelect             = false;

            DataGridViewCellStyle style = new DataGridViewCellStyle();

            style.Alignment       = DataGridViewContentAlignment.TopLeft;
            style.WrapMode        = DataGridViewTriState.True;
            grid.DefaultCellStyle = style;

            DataGridViewTextBoxCell cell0 = new DataGridViewTextBoxCell();

            cell0.Style = style;

            DataGridViewComboBoxCell cellComboBox = new DataGridViewComboBoxCell();

            cellComboBox.Style = style;

            DataGridViewColumn column0 = new DataGridViewColumn();

            column0.CellTemplate = cell0;
            column0.HeaderText   = @"№";
            column0.ReadOnly     = true;
            column0.Width        = 40;

            grid.Columns.Add(column0);

            DataGridViewColumn column1 = new DataGridViewColumn();

            column1.CellTemplate = cell0;
            column1.HeaderText   = @"Тип";
            column1.ReadOnly     = true;
            column1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grid.Columns.Add(column1);

            DataGridViewColumn column2 = new DataGridViewColumn();

            column2.CellTemplate = cell0;
            column2.HeaderText   = @"Вес";
            column2.ReadOnly     = false;
            column2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grid.Columns.Add(column2);

            DataGridViewColumn column4 = new DataGridViewColumn();

            column4.CellTemplate = cell0;
            column4.HeaderText   = @"Узнаваемость";
            column4.ReadOnly     = false;
            column4.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            grid.Columns.Add(column4);

            grid.Rows.Add(null, null);

            host.Child = grid;
        }
Пример #39
0
        public void Init()
        {
            InitializeComponent();
            IsManipulationEnabled = true;
            // ReSharper disable once UseObjectOrCollectionInitializer
            _host = new WindowsFormsHost();
            _host.IsManipulationEnabled = true;

            Loaded += CefView_Loaded;
            var settings = new CefSettings {
                RemoteDebuggingPort = RemoteDebuggingPort,
                CachePath           = CacheEnabled ? CachePath : "",
                UserAgent           = UserAgent
            };

            CefSharpSettings.ShutdownOnExit = false;

            switch (LogLevel)
            {
            case 0:
                settings.LogSeverity = LogSeverity.Default;
                break;

            case 1:
                settings.LogSeverity = LogSeverity.Verbose;
                break;

            case 2:
                settings.LogSeverity = LogSeverity.Info;
                break;

            case 3:
                settings.LogSeverity = LogSeverity.Warning;
                break;

            case 4:
                settings.LogSeverity = LogSeverity.Error;
                break;

            case 99:
                settings.LogSeverity = LogSeverity.Disable;
                break;

            default:
                settings.LogSeverity = LogSeverity.Disable;
                break;
            }
            settings.WindowlessRenderingEnabled = false;
            settings.BrowserSubprocessPath      = BrowserSubprocessPath;

            foreach (var kvp in CommandLineArgs)
            {
                settings.CefCommandLineArgs.Add(kvp.Key, kvp.Value);
            }


            Cef.EnableHighDPISupport();
            // ReSharper disable once InvertIf
            if (Cef.Initialize(settings))
            {
                var browser = CreateNewBrowser();

                CurrentBrowser = browser;
                _host.Child    = browser;
                MainGrid.Children.Add(_host);
            }
        }
Пример #40
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
            DAP.Startup.AutoMapperStart();
            Database.SetInitializer(new MigrateDatabaseToLatestVersion <DAPContext, Hys.CareAgent.Main.Migrations.Configuration>());

            string proc = Process.GetCurrentProcess().ProcessName;

            Process[] processes = Process.GetProcessesByName(proc);
            if (processes.Length > 1)
            {
                System.Windows.MessageBox.Show("Program is already running");
                Shutdown();
                return;
            }
            WindowsFormsHost.EnableWindowsFormsInterop();
            // Catch all unhandled exceptions in all threads.
            AppDomain.CurrentDomain.UnhandledException += UnhandledException;
            Dispatcher.UnhandledException += UnhandledException;
            System.Windows.Forms.Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Catch all handled exceptions in managed code, before the runtime searches the Call Stack
            //AppDomain.CurrentDomain.FirstChanceException += FirstChanceException;

            // Catch all unobserved task exceptions.
            TaskScheduler.UnobservedTaskException += UnobservedTaskException;

            // Catch all unhandled exceptions.
            System.Windows.Forms.Application.ThreadException += ThreadException;

            // Catch all WPF unhandled exceptions.
            Dispatcher.CurrentDispatcher.UnhandledException += CurrentDispatcher_UnhandledException;

            Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN");

            try
            {
                uploadInterval = Convert.ToInt32(ConfigurationManager.AppSettings["UploadInterval"]) * 1000;

                _risProTaskHost = new WebServiceHost(typeof(RisProTaskService));
                var fileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase), "log4net.config");
                if (fileName.StartsWith(@"file:\"))
                {
                    fileName = fileName.Substring(@"file:\".Length);
                }
                XmlConfigurator.ConfigureAndWatch(new FileInfo(fileName));
                _logger.Info("Agent start...");

                _risProTaskHost.Open();
                StartDICOMReceiver();

                #region init CEF
                Cef.EnableHighDPISupport();
                var settings = new CefSettings()
                {
                    //By default CefSharp will use an in-memory cache, you need to specify a Cache Folder to persist data
                    CachePath = Path.Combine(Directory.GetCurrentDirectory(), "CefSharp\\Cache"),
                    Locale    = "zh-CN"
                };

                if (!Cef.IsInitialized)
                {
                    //Perform dependency check to make sure all relevant resources are in our output directory.
                    Cef.Initialize(settings, true, true);
                }
                #endregion

                setDefaultConfig();
                //reg
                registerTimer = new Timer(_ => registerTimer_Tick(), null, uploadInterval, Timeout.Infinite);

                //upload
                uploadTimer = new Timer(_ => uploadTimer_Tick(), null, uploadInterval, Timeout.Infinite);

                //upload
                confExitTimer = new Timer(_ => confExitTimer_Tick(), null, uploadInterval, Timeout.Infinite);
            }
            catch (Exception exception)
            {
                _logger.Error("App_OnStartup", exception);
            }
        }
Пример #41
0
        private void gWebBrowserContainer_Loaded(object sender, RoutedEventArgs e)
        {
            var container = sender as Grid;

            if (container != null && container.Children.Count == 0)
            {
                WindowsFormsHost host = new WindowsFormsHost();
                container.Children.Add(host);
                var          model = this.DataContext as SecureBrowserViewModel;
                WebBrowserEx wb    = new WebBrowserEx(model.SelectedTabItem);
                wb.Navigating += wb_Navigating;
                wb.Navigated  += wb_Navigated;
                //wb.Validating += wb_Validating;
                wb.FileDownload          += wb_FileDownload;
                wb.DocumentCompleted     += wb_DocumentCompleted;
                wb.ProgressChanged       += wb_ProgressChanged;
                wb.ScriptErrorsSuppressed = true; //disable popup for javascript errors

                SHDocVw.WebBrowser axBrowser = (SHDocVw.WebBrowser)wb.ActiveXInstance;
                axBrowser.NewWindow3 += axBrowser_NewWindow3;
                //axBrowser.NewWindow2 += axBrowser_NewWindow2;
                //wb.IsWebBrowserContextMenuEnabled = false; //disable context menu
                //dynamic d = wb.ActiveXInstance;
                //string uri = string.Empty;

                //d.BeforeNavigate2 += new BeforeNavigate2((object pDisp,
                //    ref dynamic url,
                //    ref dynamic Flags,
                //    ref dynamic TargetFrameName,
                //    ref dynamic PostData,
                //    ref dynamic Headers,
                //    ref bool Cancel) =>
                //    {

                //        uri = url.ToString();
                //        Trace.WriteLine(uri);
                //    });

                //d.FileDownload += new FileDownload((bool bActiveDocument, ref bool bCancel) =>
                //{
                //    bool isFile = uri.EndsWith("exe");

                //    if (isFile)
                //    {
                //        bCancel = true;
                //        Trace.Write("Canceled a file download from the DLR.");
                //    }
                //});

                host.Child = wb;

                if (model != null && model.SelectedTabItem != null)
                {
                    model.SelectedTabItem.SearchBar.OnNavigateRequired += SearchBar_OnNavigateRequired;
                    model.SelectedTabItem.WebBrowser = wb;
                    if (!string.IsNullOrWhiteSpace(model.SelectedTabItem.SearchBar.Address))
                    {
                        wb.Navigate(model.SelectedTabItem.SearchBar.Address);
                    }
                }
            }
        }
Пример #42
0
        public ExercisePage(String msg, String youtube_id)
        {
            //Client client = (Client)Application.Current.Resources["ApplicationScopeResource"];

            //string exercise = client.recvMsg();
            string exercise = msg;

            /**************************************************************************/
            // get the kinectSensor object
            this.kinectSensor = KinectSensor.GetDefault();

            // open the reader for the color frames
            this.colorFrameReader = this.kinectSensor.ColorFrameSource.OpenReader();

            // wire handler for frame arrival
            this.colorFrameReader.FrameArrived += this.Reader_ColorFrameArrived;

            // get the coordinate mapper
            this.coordinateMapper = this.kinectSensor.CoordinateMapper;

            // create the colorFrameDescription from the ColorFrameSource using Bgra format
            FrameDescription colorFrameDescription = this.kinectSensor.ColorFrameSource.CreateFrameDescription(ColorImageFormat.Bgra);

            // get the depth (display) extents
            FrameDescription frameDescription = this.kinectSensor.DepthFrameSource.FrameDescription;

            this.displayWidth  = colorFrameDescription.Width;
            this.displayHeight = colorFrameDescription.Height;


            // create the bitmap to display
            this.colorBitmap = new WriteableBitmap(colorFrameDescription.Width, colorFrameDescription.Height, 96.0, 96.0, PixelFormats.Bgr32, null);

            /***********************************************************************************************************/
            // open the reader for the body frames
            this.bodyFrameReader = this.kinectSensor.BodyFrameSource.OpenReader();

            // a bone defined as a line between two joints
            this.bones = new List <Tuple <JointType, JointType> >();


            if (exercise.Equals("Lunges") || exercise.Equals("SidePlank") || exercise.Equals("StandingVRaise") || exercise.Equals("StandingPikeCrunch"))
            {
                //상체 운동

                // Torso
                this.bones.Add(new Tuple <JointType, JointType>(JointType.Head, JointType.Neck));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.Neck, JointType.SpineShoulder));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineShoulder, JointType.SpineMid));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineMid, JointType.SpineBase));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineShoulder, JointType.ShoulderRight));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineShoulder, JointType.ShoulderLeft));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineBase, JointType.HipRight));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.SpineBase, JointType.HipLeft));

                // Right Arm
                this.bones.Add(new Tuple <JointType, JointType>(JointType.ShoulderRight, JointType.ElbowRight));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.ElbowRight, JointType.WristRight));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.WristRight, JointType.HandRight));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.HandRight, JointType.HandTipRight));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.WristRight, JointType.ThumbRight));

                // Left Arm
                this.bones.Add(new Tuple <JointType, JointType>(JointType.ShoulderLeft, JointType.ElbowLeft));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.ElbowLeft, JointType.WristLeft));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.WristLeft, JointType.HandLeft));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.HandLeft, JointType.HandTipLeft));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.WristLeft, JointType.ThumbLeft));
            }
            else
            {
                //하체운동

                // Right Leg
                this.bones.Add(new Tuple <JointType, JointType>(JointType.HipRight, JointType.KneeRight));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.KneeRight, JointType.AnkleRight));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.AnkleRight, JointType.FootRight));

                // Left Leg
                this.bones.Add(new Tuple <JointType, JointType>(JointType.HipLeft, JointType.KneeLeft));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.KneeLeft, JointType.AnkleLeft));
                this.bones.Add(new Tuple <JointType, JointType>(JointType.AnkleLeft, JointType.FootLeft));
            }

            // populate body colors, one for each BodyIndex
            this.bodyColors = new List <Pen>();

            this.bodyColors.Add(new Pen(Brushes.Red, 6));
            this.bodyColors.Add(new Pen(Brushes.Orange, 6));
            this.bodyColors.Add(new Pen(Brushes.Green, 6));
            this.bodyColors.Add(new Pen(Brushes.Blue, 6));
            this.bodyColors.Add(new Pen(Brushes.Indigo, 6));
            this.bodyColors.Add(new Pen(Brushes.Violet, 6));



            //*************************************************//
            // set IsAvailableChanged event notifier
            this.kinectSensor.IsAvailableChanged += this.Sensor_IsAvailableChanged;

            // open the sensor
            this.kinectSensor.Open();

            // set the status text
            this.StatusText = this.kinectSensor.IsAvailable ? Properties.Resources.RunningStatusText
                                                            : Properties.Resources.NoSensorStatusText;


            //*********************************************

            // Create the drawing group we'll use for drawing
            this.drawingGroup = new DrawingGroup();

            // Create an image source that we can use in our image control
            this.imageSource = new DrawingImage(this.drawingGroup);

            // use the window object as the view model in this simple example
            this.DataContext = this;



            // use the window object as the view model in this simple example
            this.DataContext = this;
            InitializeComponent();

            Gecko.Xpcom.Initialize("Firefox");

            WindowsFormsHost host    = new WindowsFormsHost();
            GeckoWebBrowser  browser = new GeckoWebBrowser();

            host.Child = browser;
            GridWeb.Children.Add(host);
            browser.Navigate("https://www.youtube.com/embed/" + youtube_id + "?autoplay=1");



            Ex_Name.Text = msg;
            SetDescription(msg);



            //youtube url 설정
            //Youtube_View.URL = "https://www.youtube.com/embed/"+youtube_id+"?autoplay=1";


            /*
             * switch (exercise)
             * {
             *  case "Lunges":
             *      Youtube_View.URL = "https://www.youtube.com/embed/QF0BQS2W80k?autoplay=1";
             *      break;
             *  case "StandingPikeCrunch":
             *      Youtube_View.URL = "https://www.youtube.com/embed/QF0BQS2W80k?autoplay=1";
             *      break;
             *
             *  case "SidePlank":
             *      Youtube_View.URL = "https://www.youtube.com/embed/QF0BQS2W80k?autoplay=1";
             *      break;
             *
             *  case "StandingVRaise":
             *      Youtube_View.URL = "https://www.youtube.com/embed/QF0BQS2W80k?autoplay=1";
             *      break;
             *
             *  default:
             *      Youtube_View.URL = "https://www.youtube.com/embed/QF0BQS2W80k?autoplay=1";
             *      break;
             * }
             */
        }
Пример #43
0
 /// <summary>
 /// добавить элементы, на котором будут прорисовываться портфели и ордера
 /// </summary>
 public static void SetHostTable(WindowsFormsHost hostPortfolio, WindowsFormsHost hostOrders)
 {
     _painter = new ServerMasterPortfoliosPainter();
     _painter.LogMessageEvent += SendNewLogMessage;
     _painter.SetHostTable(hostPortfolio, hostOrders);
 }
 public void AquireKeyboardFocusAndLogicalFocus()
 {
     WindowsFormsHost.TabInto(new TraversalRequest(FocusNavigationDirection.First));
     Keyboard.Focus(this);
 }
Пример #45
0
 /// <summary>
 /// start drawing this robot /
 /// начать прорисовку этого робота
 /// </summary>
 public void StartPaint(WindowsFormsHost host, Rectangle rectangle)
 {
     _chartMaster.StartPaint(host, rectangle);
 }
Пример #46
0
        private EitherControl InitView(out TextBox usernameBox, out System.Windows.Forms.TextBox passwordBox)
        {
            var grid = new Grid {
                Background = SystemColors.ControlBrush
            };

            var colDef1 = new ColumnDefinition {
                Width = GridLength.Auto
            };
            var colDef2 = new ColumnDefinition {
                Width = GridLength.Auto, MinWidth = AVATAR_SIZE
            };

            grid.ColumnDefinitions.Add(colDef1);
            grid.ColumnDefinitions.Add(colDef2);

            // Define the Rows
            var rowDef1 = new RowDefinition {
                Height = GridLength.Auto
            };
            var rowDef2 = new RowDefinition {
                Height = GridLength.Auto
            };
            var rowDef3 = new RowDefinition {
                Height = GridLength.Auto
            };
            var rowDef4 = new RowDefinition {
                Height = GridLength.Auto, MinHeight = AVATAR_SIZE,
            };

            grid.RowDefinitions.Add(rowDef1);
            grid.RowDefinitions.Add(rowDef2);
            grid.RowDefinitions.Add(rowDef3);
            grid.RowDefinitions.Add(rowDef4);

            var header = new Label {
                Content = "GitHub access"
            };

            Grid.SetColumn(header, 0);
            Grid.SetColumnSpan(header, 2);
            Grid.SetRow(header, 0);

            var usernameLabel = new Label {
                Content = "Username:"******"Password:"
            };

            Grid.SetColumn(passwordLabel, 0);
            Grid.SetRow(passwordLabel, 2);

            passwordBox = new System.Windows.Forms.TextBox {
                UseSystemPasswordChar = true
            };
            var passwordHost = new WindowsFormsHost {
                Child = passwordBox
            };

            Grid.SetColumn(passwordHost, 1);
            Grid.SetRow(passwordHost, 2);

            var imageBox = new Image {
                Width = AVATAR_SIZE, Margin = new Thickness(0, 10, 0, 10)
            };

            // Create source
            var image = new BitmapImage();

            // BitmapImage.UriSource must be in a BeginInit/EndInit block
            image.BeginInit();
            image.UriSource        = new Uri(GetAvatar());
            image.DecodePixelWidth = AVATAR_SIZE;
            image.EndInit();
            //set image source
            imageBox.Source = image;
            Grid.SetColumn(imageBox, 1);
            Grid.SetRow(imageBox, 3);

            grid.AddChild(header);
            grid.AddChild(usernameLabel);
            grid.AddChild(usernameBox);
            grid.AddChild(passwordLabel);
            grid.AddChild(passwordHost);
            grid.AddChild(imageBox);

            return(grid);
        }
Пример #47
0
        /// <summary>
        /// create a robot manager
        /// создать менеджера роботов
        /// </summary>
        /// <param name="gridChart">chart area wpf / область для чарта</param>
        /// <param name="hostChart">chart area windows forms / область для чарта</param>
        /// <param name="hostGlass">market depth area / область для стакана</param>
        /// <param name="hostOpenDeals">open positions table area / область для таблицы открытых сделок</param>
        /// <param name="hostCloseDeals">closed positions table area / область для таблицы закрытых сделок</param>
        /// <param name="hostAllDeals">area of all positions / область всех сделок</param>
        /// <param name="hostLogBot">bot log area / область для бот лога</param>
        /// <param name="hostLogPrime">prime log area / область для прайм лога</param>
        /// <param name="rectangleAroundChart">square by chart / квадрат за чартом</param>
        /// <param name="hostAlerts">area for alerts / область для алертов</param>
        /// <param name="tabPanel">bots tabControl / панель с роботами</param>
        /// <param name="tabBotTab">toolbar robot panel / панель робота с вкладками инструментов</param>
        /// <param name="textBoxLimitPrice">Textbox with limit price when entering an position / текстБокс с ценой лимитника при вводе заявки</param>
        /// <param name="gridChartControlPanel">grid for chart control panel / грид для панели управления чартом</param>
        /// <param name="startProgram">type of program that requested class creation / тип программы который запросил создание класса</param>
        public OsTraderMaster(Grid gridChart, WindowsFormsHost hostChart, WindowsFormsHost hostGlass, WindowsFormsHost hostOpenDeals,
                              WindowsFormsHost hostCloseDeals, WindowsFormsHost hostAllDeals, WindowsFormsHost hostLogBot, WindowsFormsHost hostLogPrime, Rectangle rectangleAroundChart,
                              WindowsFormsHost hostAlerts,
                              TabControl tabPanel, TabControl tabBotTab, TextBox textBoxLimitPrice, Grid gridChartControlPanel, StartProgram startProgram)
        {
            NumberGen.GetNumberOrder(startProgram);
            _startProgram = startProgram;

            if (_startProgram == StartProgram.IsTester)
            {
                _typeWorkKeeper = ConnectorWorkType.Tester;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingStartEvent += StrategyKeeper_TestingStartEvent;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingFastEvent  += StrategyKeeper_TestingFastEvent;
                ((TesterServer)ServerMaster.GetServers()[0]).TestingEndEvent   += StrategyKeeper_TestingEndEvent;
            }

            if (_startProgram != StartProgram.IsTester)
            {
                ServerMaster.ActivateAutoConnection();
            }

            ServerMaster.LogMessageEvent += SendNewLogMessage;

            _tabBotTab = tabBotTab;

            if (_tabBotTab.Items != null)
            {
                _tabBotTab.Items.Clear();
            }

            _gridChart             = gridChart;
            _textBoxLimitPrice     = textBoxLimitPrice;
            _hostChart             = hostChart;
            _hostGlass             = hostGlass;
            _hostOpenDeals         = hostOpenDeals;
            _hostCloseDeals        = hostCloseDeals;
            _hostAllDeals          = hostAllDeals;
            _hostboxLog            = hostLogBot;
            _rectangleAroundChart  = rectangleAroundChart;
            _hostAlerts            = hostAlerts;
            _gridChartControlPanel = gridChartControlPanel;

            _tabBotNames = tabPanel;
            _tabBotNames.Items.Clear();

            _riskManager = new RiskManager.RiskManager("GlobalRiskManager", _startProgram);
            _riskManager.RiskManagerAlarmEvent += _riskManager_RiskManagerAlarmEvent;
            _riskManager.LogMessageEvent       += SendNewLogMessage;
            _globalController = new GlobalPosition(_hostAllDeals, _startProgram);
            _globalController.LogMessageEvent += SendNewLogMessage;

            _log = new Log("Prime", _startProgram);
            _log.StartPaint(hostLogPrime);
            _log.Listen(this);
            _hostLogPrime = hostLogPrime;

            SendNewLogMessage(OsLocalization.Trader.Label1, LogMessageType.User);

            Load();
            _tabBotNames.SelectionChanged += _tabBotControl_SelectionChanged;
            ReloadRiskJournals();
            _globalController.StartPaint();

            Master = this;

            if (_startProgram == StartProgram.IsOsTrader && PrimeSettingsMaster.AutoStartApi)
            {
                ApiMaster = new AdminApiMaster(Master);
            }
        }
Пример #48
0
        private void cmdView_Execute(object obj)
        {
            try
            {
                if (fromInvoiceDate > toInvoiceDate)
                {
                    UIHelper.ShowErrorMessage("From Date cannot not be greater than To Date");
                    return;
                }
                if ((toInvoiceDate - fromInvoiceDate).Days > 31)
                {
                    UIHelper.ShowErrorMessage("Days Difference should not be greater than 31");
                    return;
                }
                if (fromInvoiceNo > toInvoiceNo)
                {
                    UIHelper.ShowErrorMessage("From Invoice No. cannot not be greater than To Invoice No.");
                    return;
                }
                if (fromInvoiceDate > toInvoiceDate)
                {
                    UIHelper.ShowErrorMessage("From Date cannot not be greater than To Date");
                    return;
                }
                if (fromInvoiceNo != 0 && fromInvoiceNo != toInvoiceNo)
                {
                    using (System.Windows.Forms.FolderBrowserDialog browse = new System.Windows.Forms.FolderBrowserDialog())
                    {
                        browse.ShowDialog();
                        folderPath = browse.SelectedPath;
                    }
                    if (string.IsNullOrEmpty(folderPath))
                    {
                        UIHelper.ShowErrorMessage("Select Path to save reports");
                        return;
                    }
                }
                using (DataServiceClient pxy = new DataServiceClient())
                {
                    ObservableCollection <CompanyMaster> objComp = new ObservableCollection <CompanyMaster>
                    {
                        pxy.GetCompanyDetails()
                    };
                    ObservableCollection <InvoiceReport> lstInvRept = pxy.FinalInvoiceReport(fromInvoiceNo, toInvoiceNo, fromInvoiceDate, toInvoiceDate);
                    if (lstInvRept.Count <= 0)
                    {
                        UIHelper.ShowMessage("Data not found");
                        return;
                    }
                    for (int i = 0; i < lstInvRept.Count; i++)
                    {
                        Viewer = new WindowsFormsHost();
                        using (ReportViewer reportViewer = new ReportViewer())
                        {
                            reportViewer.LocalReport.DataSources.Clear();
                            ObservableCollection <InvoiceReport> objTemp = new ObservableCollection <InvoiceReport>
                            {
                                lstInvRept[i]
                            };
                            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dataSetCompany", objComp));
                            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dataSetInvoiceReport", objTemp));
                            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("dataSetInvoice", lstInvRept[i].lstDetails));
                            if (lstInvRept[i].lstDetails.Sum(p => p.IGST) > 0)
                            {
                                reportViewer.LocalReport.ReportPath = System.Windows.Forms.Application.StartupPath + "//Views//Reports//I0003_IGST.rdlc";
                            }
                            else
                            {
                                reportViewer.LocalReport.ReportPath = System.Windows.Forms.Application.StartupPath + "//Views//Reports//I0003_CSGST.rdlc";
                            }

                            reportViewer.RefreshReport();
                            Viewer.Child = reportViewer;
                            if (fromInvoiceNo != 0 && fromInvoiceNo != toInvoiceNo)
                            {
                                byte[] Bytes = reportViewer.LocalReport.Render(format: "PDF", deviceInfo: "");
                                using (FileStream stream = new FileStream(folderPath + "//" + lstInvRept[i].InvoiceNo + ".pdf", FileMode.Create))
                                {
                                    stream.Write(Bytes, 0, Bytes.Length);
                                }
                            }
                        }
                    }
                }
            }
            catch (FaultException ex)
            {
                UIHelper.ShowErrorMessage(ex.Message);
            }
            catch (Exception ex)
            {
                UIHelper.ShowErrorMessage(ex.Message);
            }
        }
Пример #49
0
        public void SpawnDataEditorWindow(object sender, ExecutedRoutedEventArgs e)
        {
            try
            {
                var menuItem = sender as MenuItem;
                if (menuItem == null)
                {
                    return;
                }
                var menuInfo = menuItem.CommandParameter as MenuCommandParameters;
                if (menuInfo == null)
                {
                    return;
                }

                WindowsFormsHost wh = new WindowsFormsHost();
                ResultsetGrid    rg = new ResultsetGrid();
                List <int>       readOnlyColumns = new List <int>();

                using (IRepository repository = RepoHelper.CreateRepository(menuInfo.Connectionstring))
                {
                    System.Collections.Generic.List <PrimaryKey> pks = repository.GetAllPrimaryKeys();
                    var tpks = repository.GetAllPrimaryKeys().Where(pk => pk.TableName == menuInfo.Name).ToList();
                    if (tpks.Count == 0)
                    {
                        rg.ReadOnly = true;
                    }
                    List <Column> cols = repository.GetAllColumns();
                    cols = cols.Where(c => c.TableName == menuInfo.Name).ToList();
                    int x = 0;
                    foreach (Column col in cols)
                    {
                        if (col.AutoIncrementBy > 0 || col.RowGuidCol)
                        {
                            readOnlyColumns.Add(x);
                        }
                        x++;
                    }
                }
                var sqlText = string.Format(Environment.NewLine + "SELECT TOP({0}) * FROM [{1}]", Properties.Settings.Default.MaxRowsToEdit, menuInfo.Name);
                rg.TableName        = sqlText;
                rg.ConnectionString = menuInfo.Connectionstring;
                rg.Tag             = wh;
                rg.ReadOnlyColumns = readOnlyColumns;
                wh.Child           = rg;

                string tabTitle = System.IO.Path.GetFileNameWithoutExtension(menuInfo.Caption) + "-" + menuInfo.Name + "-Edit";
                if (rg.ReadOnly)
                {
                    tabTitle = System.IO.Path.GetFileNameWithoutExtension(menuInfo.Caption) + "-" + menuInfo.Name + "-ReadOnly";
                }
                bool alreadyThere = false;
                int  i            = -1;
                foreach (var item in _parent.FabTab.Items)
                {
                    i++;
                    if (item is FabTabItem)
                    {
                        FabTabItem ftItem = (FabTabItem)item;
                        if (ftItem.Header.ToString() == tabTitle)
                        {
                            alreadyThere = true;
                        }
                    }
                }
                if (alreadyThere)
                {
                    _parent.FabTab.SelectedIndex = i;
                    _parent.FabTab.Focus();
                }
                else
                {
                    FabTabItem tab = new FabTabItem();
                    tab.Content = wh;
                    tab.Header  = tabTitle;
                    _parent.FabTab.Items.Add(tab);
                    _parent.FabTab.SelectedIndex = _parent.FabTab.Items.Count - 1;
                    rg.Focus();
                }
                return;
            }
            catch (Exception ex)
            {
                MessageBox.Show(Helpers.DataConnectionHelper.ShowErrors(ex));
            }
        }
Пример #50
0
 private void OnModelessEnable(object sender, RoutedEventArgs e)
 => WindowsFormsHost.EnableWindowsFormsInterop();
Пример #51
0
        public void Init()
        {
            InitializeComponent();
            IsManipulationEnabled = true;
            // ReSharper disable once UseObjectOrCollectionInitializer
            _host = new WindowsFormsHost();
            _host.IsManipulationEnabled = true;

            Loaded += CefView_Loaded;
            var settings = new CefSettings {
                RemoteDebuggingPort = RemoteDebuggingPort,
                CachePath           = CachePath,
                UserAgent           = UserAgent
            };

            CefSharpSettings.ShutdownOnExit = false;

            switch (LogLevel)
            {
            case 0:
                settings.LogSeverity = LogSeverity.Default;
                break;

            case 1:
                settings.LogSeverity = LogSeverity.Verbose;
                break;

            case 2:
                settings.LogSeverity = LogSeverity.Info;
                break;

            case 3:
                settings.LogSeverity = LogSeverity.Warning;
                break;

            case 4:
                settings.LogSeverity = LogSeverity.Error;
                break;

            case 99:
                settings.LogSeverity = LogSeverity.Disable;
                break;

            default:
                settings.LogSeverity = LogSeverity.Disable;
                break;
            }
            settings.WindowlessRenderingEnabled = false;
            settings.BrowserSubprocessPath      = BrowserSubprocessPath;

            foreach (var kvp in CommandLineArgs)
            {
                settings.CefCommandLineArgs.Add(kvp.Key, kvp.Value);
            }



            Cef.EnableHighDPISupport();
            // ReSharper disable once InvertIf
            if (Cef.Initialize(settings))
            {
                Browser = new ChromiumWebBrowser(InitialUrl)
                {
                    Dock = DockStyle.Fill
                };

                Browser.RegisterAsyncJsObject("webViewANE", new BoundObject(), BindingOptions.DefaultBinder);


                // ReSharper disable once UseObjectOrCollectionInitializer
                var dh = new DownloadHandler();
                dh.OnDownloadUpdatedFired += OnDownloadUpdatedFired;
                dh.OnBeforeDownloadFired  += OnDownloadFired;

                // ReSharper disable once UseObjectOrCollectionInitializer
                var kh = new KeyboardHandler();
                kh.OnKeyEventFired += OnKeyEventFired;

                if (EnableDownloads)
                {
                    Browser.DownloadHandler = dh;
                }
                Browser.KeyboardHandler = kh;

                // ReSharper disable once UseObjectOrCollectionInitializer
                var gh = new GeolocationHandler();
                gh.OnPermissionResult     += OnPermissionResult;
                Browser.GeolocationHandler = gh;


                // ReSharper disable once UseObjectOrCollectionInitializer
                var sh = new LifeSpanHandler(PopupBehaviour, PopupDimensions);
                sh.OnPermissionPopup += OnPermissionPopup;

                Browser.LifeSpanHandler              = sh;
                Browser.FrameLoadEnd                += OnFrameLoaded;
                Browser.AddressChanged              += OnBrowserAddressChanged;
                Browser.TitleChanged                += OnBrowserTitleChanged;
                Browser.LoadingStateChanged         += OnBrowserLoadingStateChanged;
                Browser.LoadError                   += OnLoadError;
                Browser.IsBrowserInitializedChanged += OnBrowserInitialized;
                Browser.StatusMessage               += OnStatusMessage;

                if (!ContextMenuEnabled)
                {
                    Browser.MenuHandler = new MenuHandler();
                }

                // ReSharper disable once UseObjectOrCollectionInitializer
                var rh = new RequestHandler(WhiteList);
                rh.OnUrlBlockedFired += OnUrlBlockedFired;

                Browser.RequestHandler = rh;

                _host.Child = Browser;

                MainGrid.Children.Add(_host);
            }
        }
Пример #52
0
        /// <summary>
        /// start drawing this robot /
        /// начать прорисовку этого робота
        /// </summary>
        public void StartPaint(Grid gridChart, WindowsFormsHost hostChart, WindowsFormsHost glass, WindowsFormsHost hostOpenDeals,
                               WindowsFormsHost hostCloseDeals, WindowsFormsHost boxLog, Rectangle rectangle, WindowsFormsHost hostAlerts,
                               TabControl tabBotTab, TextBox textBoxLimitPrice, Grid gridChartControlPanel)
        {
            if (_isPainting)
            {
                return;
            }

            _gridChart             = gridChart;
            _tabBotTab             = tabBotTab;
            _hostChart             = hostChart;
            _hostGlass             = glass;
            _hostOpenDeals         = hostOpenDeals;
            _hostCloseDeals        = hostCloseDeals;
            _rectangle             = rectangle;
            _hostAlerts            = hostAlerts;
            _textBoxLimitPrice     = textBoxLimitPrice;
            _gridChartControlPanel = gridChartControlPanel;

            try
            {
                if (!_tabBotTab.Dispatcher.CheckAccess())
                {
                    _tabBotTab.Dispatcher.Invoke(new Action <Grid, WindowsFormsHost, WindowsFormsHost, WindowsFormsHost,
                                                             WindowsFormsHost, WindowsFormsHost, Rectangle, WindowsFormsHost, TabControl, TextBox, Grid>
                                                     (StartPaint), gridChart, hostChart, glass, hostOpenDeals, hostCloseDeals, boxLog, rectangle, hostAlerts, tabBotTab, textBoxLimitPrice);
                    return;
                }

                _log.StartPaint(boxLog);

                _isPainting = true;

                ReloadTab();

                if (ActivTab != null)
                {
                    ChangeActivTab(ActivTab.TabNum);
                }
                else
                {
                    if (_tabBotTab != null &&
                        _tabBotTab.Items.Count != 0 &&
                        _tabBotTab.SelectedItem != null)
                    {
                        ChangeActivTab(_tabBotTab.SelectedIndex);
                    }
                    else if (_tabBotTab != null &&
                             _tabBotTab.Items.Count != 0 &&
                             _tabBotTab.SelectedItem == null)
                    {
                        ChangeActivTab(0);
                    }
                }
            }
            catch (Exception error)
            {
                SendNewLogMessage(error.ToString(), LogMessageType.Error);
            }
        }
Пример #53
0
 private void cmdEnableSupport_Click(object sender, RoutedEventArgs e)
 {
     WindowsFormsHost.EnableWindowsFormsInterop();
 }
Пример #54
0
        public static UIElement Create(DisplayInfoTypes displayInfoTypes, params object[] param)
        {
            StackPanel panel;
            TextBlock  label;
            TextBlock  data;
            Binding    binding;

            switch (displayInfoTypes)
            {
            case DisplayInfoTypes.UsagePeriod:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_lblUsagePeriod");
                panel.Children.Add(label);

                data = createDataLabel("Account.PeriodStart", new DateConverter(), "d MMMM");
                panel.Children.Add(data);

                data = createDataLabel(null, null, null);

                binding        = new Binding("Text.ClientDashboard_At");
                binding.Mode   = BindingMode.OneTime;
                binding.Source = ressource;
                data.SetBinding(TextBlock.TextProperty, binding);
                data.Margin = new Thickness(4, 0, 4, 0);

                panel.Children.Add(data);

                data = createDataLabel("Account.PeriodEnd", new DateConverter(), "d MMMM yyyy");
                panel.Children.Add(data);

                return(panel);

            case DisplayInfoTypes.Overcharge:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_Overcharge");
                panel.Children.Add(label);

                data = createDataLabel("Account.Overcharge", new DoubleConverter(), "C");
                panel.Children.Add(data);

                return(panel);

            case DisplayInfoTypes.DayRemaining:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_lblDayRemaining");
                panel.Children.Add(label);

                data = createDataLabel("Account.DayRemaining", new TimeSpanConverter(), null);
                panel.Children.Add(data);

                return(panel);

            case DisplayInfoTypes.Upload:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_Upload");
                panel.Children.Add(label);

                data = createDataLabel("Account.Upload", new SIUnitStringConverter(), null);
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.UploadPercent:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_UploadPercent");
                panel.Children.Add(label);

                data = createDataLabel("Account.UploadPercent", new DoubleConverter(), "P");
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.Download:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_Download");
                panel.Children.Add(label);

                data = createDataLabel("Account.Download", new SIUnitStringConverter(), null);
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.DownloadPercent:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_DownloadPercent");
                panel.Children.Add(label);

                data = createDataLabel("Account.DownloadPercent", new DoubleConverter(), "P");
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.Combined:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_Combined");
                panel.Children.Add(label);

                data = createDataLabel("Account.Combined", new SIUnitStringConverter(), null);
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.CombinedPercent:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_CombinedPercent");
                panel.Children.Add(label);

                data = createDataLabel("Account.CombinedPercent", new DoubleConverter(), "P");
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.CombinedOnTotal:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_CombinedOnTotal");
                panel.Children.Add(label);

                data = createDataLabel("Account.Combined", new SIUnitStringConverter(), null);
                panel.Children.Add(data);

                label = createLabel("Text.On");
                label.SetResourceReference(TextBlock.StyleProperty, "DynamicData");
                panel.Children.Add(label);

                data = createDataLabel("Account.CombinedMaximum", new SIUnitStringConverter(), null);
                panel.Children.Add(data);

                return(panel);

            case DisplayInfoTypes.AverageCombined:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_AverageCombined");
                panel.Children.Add(label);

                data = createDataLabel("Account.AverageCombined", new SIUnitStringConverter(), null);
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.SuggestCombined:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_lblSuggestCombined");
                panel.Children.Add(label);

                data = createDataLabel("Account.SuggestCombined", new SIUnitStringConverter(), null);
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.SuggestCombinedPercent:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_SuggestCombinedPercent");
                panel.Children.Add(label);

                data = createDataLabel("Account.SuggestCombinedPercent", new DoubleConverter(), "P");
                panel.Children.Add(data);

                return(panel);

            case DisplayInfoTypes.EstimateCombined:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_EstimateCombined");
                panel.Children.Add(label);

                data = createDataLabel("Account.EstimateCombined", new SIUnitStringConverter(), null);
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.EstimateTotalCombined:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_AtThisRate");
                panel.Children.Add(label);

                data = createDataLabel("Account.EstimateTotalCombined", new UpDownConverter(), null);
                panel.Children.Add(data);

                label = createLabel("Text.ClientDashboard_OfYourLimit");
                panel.Children.Add(label);

                return(panel);

            case DisplayInfoTypes.TheoryDailyCombined:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_TheoryDailyCombined");
                panel.Children.Add(label);

                data = createDataLabel("Account.TheoryDailyCombined", new SIUnitStringConverter(), null);
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.TheoryDailyCombinedPercent:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_TheoryDailyCombinedPercent");
                panel.Children.Add(label);

                data = createDataLabel("Account.TheoryDailyCombinedPercent", new DoubleConverter(), "P");
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.TheoryCombinedDifference:
                panel             = new StackPanel();
                panel.Orientation = Orientation.Horizontal;

                label = createLabel("Text.ClientDashboard_TheoryCombinedDifference");
                panel.Children.Add(label);

                data = createDataLabel("Account.TheoryCombinedVersusCombined", new SIUnitStringConverter(), null);
                panel.Children.Add(data);
                return(panel);

            case DisplayInfoTypes.UploadDownloadGraph:
                return(new UploadDownload());

            case DisplayInfoTypes.CombinedGraph:
                return(new Combined());

            case DisplayInfoTypes.HistoryGraph:
                WindowsFormsHost host = new WindowsFormsHost();
                host.Name    = "zedHost";
                host.Margin  = new Thickness(0, 5, 0, 0);
                host.Padding = new Thickness(6, 0, 6, 0);
                host.Height  = 230;

                CIVAccount account = param[0] as CIVAccount;

                host.Child = new GraphFactory().Generate(account.Account.Username,
                                                         new Period()
                {
                    Start = account.Account.PeriodStart,
                    End   = account.Account.PeriodEnd
                }, 0, 0);

                return(host);
            }
            return(new StackPanel());
        }
        private void CreateTable()
        {
            if (MainWindow.GetDispatcher.CheckAccess() == false)
            {
                MainWindow.GetDispatcher.Invoke(new Action(CreateTable));
                return;
            }

            _host = new WindowsFormsHost();

            DataGridView newGrid =
                DataGridFactory.GetDataGridView(DataGridViewSelectionMode.FullRowSelect,
                                                DataGridViewAutoSizeRowsMode.AllCells);

            newGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            DataGridViewTextBoxCell cell0 = new DataGridViewTextBoxCell();

            cell0.Style = newGrid.DefaultCellStyle;

            DataGridViewColumn colum0 = new DataGridViewColumn();

            colum0.CellTemplate = cell0;
            colum0.HeaderText   = "Time";
            colum0.ReadOnly     = true;
            colum0.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            newGrid.Columns.Add(colum0);

            DataGridViewColumn colum01 = new DataGridViewColumn();

            colum01.CellTemplate = cell0;
            colum01.HeaderText   = "Slow Sma";
            colum01.ReadOnly     = true;
            colum01.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            newGrid.Columns.Add(colum01);

            DataGridViewColumn colum02 = new DataGridViewColumn();

            colum02.CellTemplate = cell0;
            colum02.HeaderText   = "Fast Sma";
            colum02.ReadOnly     = true;
            colum02.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            newGrid.Columns.Add(colum02);

            DataGridViewColumn colum03 = new DataGridViewColumn();

            colum03.CellTemplate = cell0;
            colum03.HeaderText   = "Atr";
            colum03.ReadOnly     = true;
            colum03.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            newGrid.Columns.Add(colum03);

            DataGridViewColumn colum04 = new DataGridViewColumn();

            colum04.CellTemplate = cell0;
            colum04.HeaderText   = "Len in Atr";
            colum04.ReadOnly     = true;
            colum04.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            newGrid.Columns.Add(colum04);

            _host.Child = newGrid;
            _grid       = newGrid;
        }
Пример #56
0
 /// <summary>
 /// start drawing this robot /
 /// начать прорисовку этого робота
 /// </summary>
 public void StartPaint(Grid grid, WindowsFormsHost host, Rectangle rectangle)
 {
     _chartMaster.StartPaint(grid, host, rectangle);
 }
Пример #57
0
        public CefPage(string initialUrl, string userAgent, int cefLogSeverity, int remoteDebuggingPort, string cachePath,
                       Dictionary <string, string> settingsDict, string cefBrowserSubprocessPath, byte r, byte g, byte b, bool enableDownloads)
        {
            _initialUrl = initialUrl;
            InitializeComponent();
            IsManipulationEnabled = true;
            var host = new WindowsFormsHost();

            host.IsManipulationEnabled = true;

            Background = new SolidColorBrush(Color.FromRgb(r, g, b));
            Loaded    += CefPage_Loaded;
            var settings = new CefSettings {
                RemoteDebuggingPort = remoteDebuggingPort,
                CachePath           = cachePath,
                UserAgent           = userAgent
            };

            CefSharpSettings.ShutdownOnExit = false;

            switch (cefLogSeverity)
            {
            case 0:
                settings.LogSeverity = LogSeverity.Default;
                break;

            case 1:
                settings.LogSeverity = LogSeverity.Verbose;
                break;

            case 2:
                settings.LogSeverity = LogSeverity.Info;
                break;

            case 3:
                settings.LogSeverity = LogSeverity.Warning;
                break;

            case 4:
                settings.LogSeverity = LogSeverity.Error;
                break;

            case 99:
                settings.LogSeverity = LogSeverity.Disable;
                break;

            default:
                settings.LogSeverity = LogSeverity.Disable;
                break;
            }


            settings.WindowlessRenderingEnabled = false;
            settings.BrowserSubprocessPath      = cefBrowserSubprocessPath;

            foreach (var kvp in settingsDict)
            {
                settings.CefCommandLineArgs.Add(kvp.Key, kvp.Value);
            }

            Cef.EnableHighDPISupport();
            if (Cef.Initialize(settings))
            {
                Browser = new ChromiumWebBrowser(_initialUrl)
                {
                    Dock = DockStyle.Fill
                };

                Browser.RegisterAsyncJsObject("webViewANE", new BoundObject(this), BindingOptions.DefaultBinder);


                // ReSharper disable once UseObjectOrCollectionInitializer
                var dh = new DownloadHandler();
                dh.OnDownloadUpdatedFired += OnDownloadUpdatedFired;
                dh.OnBeforeDownloadFired  += OnDownloadFired;

                var kh = new KeyboardHandler();
                kh.OnKeyEventFired += OnKeyEventFired;

                if (enableDownloads)
                {
                    Browser.DownloadHandler = dh;
                }
                Browser.KeyboardHandler              = kh;
                Browser.FrameLoadEnd                += OnFrameLoaded;
                Browser.AddressChanged              += OnBrowserAddressChanged;
                Browser.TitleChanged                += OnBrowserTitleChanged;
                Browser.LoadingStateChanged         += OnBrowserLoadingStateChanged;
                Browser.LoadError                   += OnLoadError;
                Browser.IsBrowserInitializedChanged += OnBrowserInitialized;

                //Browser.LifeSpanHandler.OnBeforePopup();

                // Browser.ConsoleMessage += OnConsoleMessage;
                Browser.StatusMessage += OnStatusMessage;

                host.Child = Browser;

                MainGrid.Children.Add(host);
            }
        }
Пример #58
0
        /// <summary>
        /// Provides derived classes an opportunity to manage custom focus strategy.
        /// </summary>
        /// <remarks>
        /// Derived classes should not call base class if don't want AvalonDock to set focus on <see cref="DefaultElement"/> object
        /// </remarks>
        protected virtual void FocusContent()
        {
            if (IsActiveContent && !IsKeyboardFocused)
            {
                #region Focus on winforms content
                if (this.Content is WindowsFormsHost)
                {
                    //Use reflection in order to remove WinForms assembly reference
                    WindowsFormsHost contentHost = this.Content as WindowsFormsHost;

                    object childCtrl = contentHost.GetType().GetProperty("Child").GetValue(contentHost, null);

                    if (childCtrl != null)
                    {
                        if (!childCtrl.GetPropertyValue <bool>("Focused"))
                        {
                            childCtrl.CallMethod("Focus", null);
                        }
                    }

                    //Dispatcher.BeginInvoke(DispatcherPriority.Background, new ThreadStart(delegate
                    //        {
                    //            if (IsActiveContent && !IsKeyboardFocused)
                    //            {
                    //                if (this.Content is WindowsFormsHost)
                    //                {
                    //                    //Use reflection in order to remove WinForms assembly reference
                    //                    WindowsFormsHost contentHost = this.Content as WindowsFormsHost;

                    //                    object childCtrl = contentHost.GetType().GetProperty("Child").GetValue(contentHost, null);

                    //                    if (childCtrl != null)
                    //                    {
                    //                        if (!childCtrl.GetPropertyValue<bool>("Focused"))
                    //                        {
                    //                            childCtrl.CallMethod("Focus", null);
                    //                        }
                    //                    }
                    //                }
                    //            }
                    //        }));
                }
                #endregion

                if (DefaultElement != null)
                {
                    Debug.WriteLine("Try to set kb focus to " + DefaultElement);

                    IInputElement kbFocused = Keyboard.Focus(DefaultElement);

                    if (kbFocused != null)
                    {
                        Debug.WriteLine("Focused element " + kbFocused);
                    }
                    else
                    {
                        Debug.WriteLine("No focused element");
                    }
                }
                else if (this.Content is IInputElement)
                {
                    Debug.WriteLine("Try to set kb focus to " + this.Content.ToString());
                    IInputElement kbFocused = Keyboard.Focus(this.Content as IInputElement);
                    if (kbFocused != null)
                    {
                        Debug.WriteLine("Focused element " + kbFocused);
                    }
                    else
                    {
                        Debug.WriteLine("No focused element");
                    }
                }
            }
        }
        /// <summary>
        /// добавить элементы, на котором будут прорисовываться портфели и ордера
        /// </summary>
        public void SetHostTable(WindowsFormsHost hostPortfolio, WindowsFormsHost hostOrders)
        {
            try
            {
                _gridPosition       = new DataGridView();
                _positionHost       = hostPortfolio;
                _positionHost.Child = _gridPosition;

                _gridPosition.AllowUserToOrderColumns = false;
                _gridPosition.AllowUserToResizeRows   = false;
                _gridPosition.AllowUserToDeleteRows   = false;
                _gridPosition.AllowUserToAddRows      = false;
                _gridPosition.RowHeadersVisible       = false;
                _gridPosition.SelectionMode           = DataGridViewSelectionMode.FullRowSelect;
                _gridPosition.MultiSelect             = false;

                DataGridViewCellStyle style = new DataGridViewCellStyle();
                style.Alignment = DataGridViewContentAlignment.BottomRight;

                DataGridViewTextBoxCell cell0 = new DataGridViewTextBoxCell();
                cell0.Style = style;

                DataGridViewColumn column0 = new DataGridViewColumn();
                column0.CellTemplate = cell0;
                column0.HeaderText   = @"Портфель";
                column0.ReadOnly     = true;
                column0.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridPosition.Columns.Add(column0);

                DataGridViewColumn column = new DataGridViewColumn();
                column.CellTemplate = cell0;
                column.HeaderText   = @"Средства входящие";
                column.ReadOnly     = true;
                column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridPosition.Columns.Add(column);

                DataGridViewColumn column1 = new DataGridViewColumn();
                column1.CellTemplate = cell0;
                column1.HeaderText   = @"Средства сейчас";
                column1.ReadOnly     = true;
                column1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridPosition.Columns.Add(column1);

                DataGridViewColumn column3 = new DataGridViewColumn();
                column3.CellTemplate = cell0;
                column3.HeaderText   = @"Средства блок.";
                column3.ReadOnly     = true;
                column3.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridPosition.Columns.Add(column3);

                DataGridViewColumn column4 = new DataGridViewColumn();
                column4.CellTemplate = cell0;
                column4.HeaderText   = @"Инструмент";
                column4.ReadOnly     = true;
                column4.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridPosition.Columns.Add(column4);

                DataGridViewColumn column5 = new DataGridViewColumn();
                column5.CellTemplate = cell0;
                column5.HeaderText   = @"Объём входящий";
                column5.ReadOnly     = true;
                column5.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridPosition.Columns.Add(column5);

                DataGridViewColumn column6 = new DataGridViewColumn();
                column6.CellTemplate = cell0;
                column6.HeaderText   = @"Объём сейчас";
                column6.ReadOnly     = true;
                column6.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridPosition.Columns.Add(column6);

                DataGridViewColumn column7 = new DataGridViewColumn();
                column7.CellTemplate = cell0;
                column7.HeaderText   = @"Объём блокирован";
                column7.ReadOnly     = true;
                column7.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridPosition.Columns.Add(column7);

                _positionHost.Child.Show();
                _positionHost.Child.Refresh();


                _gridOrders       = new DataGridView();
                _ordersHost       = hostOrders;
                _ordersHost.Child = _gridOrders;

                _gridOrders.AllowUserToOrderColumns = false;
                _gridOrders.AllowUserToResizeRows   = false;
                _gridOrders.AllowUserToDeleteRows   = false;
                _gridOrders.AllowUserToAddRows      = false;
                _gridOrders.RowHeadersVisible       = false;
                _gridOrders.SelectionMode           = DataGridViewSelectionMode.FullRowSelect;
                _gridOrders.MultiSelect             = false;

                DataGridViewColumn colu = new DataGridViewColumn();
                colu.CellTemplate = cell0;
                colu.HeaderText   = @"Время";
                colu.ReadOnly     = true;
                colu.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridOrders.Columns.Add(colu);

                DataGridViewColumn colum1 = new DataGridViewColumn();
                colum1.CellTemplate = cell0;
                colum1.HeaderText   = @"Инструмент";
                colum1.ReadOnly     = true;
                colum1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridOrders.Columns.Add(colum1);

                DataGridViewColumn colum2 = new DataGridViewColumn();
                colum2.CellTemplate = cell0;
                colum2.HeaderText   = @"Направление";
                colum2.ReadOnly     = true;
                colum2.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridOrders.Columns.Add(colum2);

                DataGridViewColumn colum3 = new DataGridViewColumn();
                colum3.CellTemplate = cell0;
                colum3.HeaderText   = @"Статус";
                colum3.ReadOnly     = true;
                colum3.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridOrders.Columns.Add(colum3);

                DataGridViewColumn colum4 = new DataGridViewColumn();
                colum4.CellTemplate = cell0;
                colum4.HeaderText   = @"Цена";
                colum4.ReadOnly     = true;
                colum4.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridOrders.Columns.Add(colum4);

                DataGridViewColumn colum5 = new DataGridViewColumn();
                colum5.CellTemplate = cell0;
                colum5.HeaderText   = @"Объём";
                colum5.ReadOnly     = true;
                colum5.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridOrders.Columns.Add(colum5);

                DataGridViewColumn colum6 = new DataGridViewColumn();
                colum6.CellTemplate = cell0;
                colum6.HeaderText   = @"Ожидает";
                colum6.ReadOnly     = true;
                colum6.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                _gridOrders.Columns.Add(colum6);

                _gridOrders.Click += _gridOrders_Click;
            }
            catch (Exception error)
            {
                SendNewLogMessage(error.ToString(), LogMessageType.Error);
            }
        }
Пример #60
0
 public WindowsFormsHostHandler()
 {
     Control = new WindowsFormsHost();
 }