コード例 #1
0
        /// <summary>
        /// Loads App resources.  Called on App_Startup
        /// </summary>
        /// <returns></returns>
        public async Task Load()
        {
            Log = new Logger();

            CompanyViewModel    = new CompanyViewModel(DialogCoordinator.Instance);
            ConnectionViewModel = new ConnectionViewModel(DialogCoordinator.Instance);

            Connection = Connection.Load();
            ConnectionViewModel.Connection = Connection;

            // Wait for MainWindow
            while (App.Current.MainWindow == null)
            {
                await Task.Delay(1000);
            }

            // Get Hostname list for configuration
            Task.Run(() => ConnectionViewModel.Hostnames = HostnameResolver.GetHostnameList());

            // Potential valid connection
            if (!Connection.IsEmpty)
            {
                // Connect to database
                if (await ConnectionViewModel.Connect(false))
                {
                    return;
                }
            }

            // Move to ConnectionView tab page
            (App.Current.MainWindow as MainWindow).SelectedIndex++;
        }
コード例 #2
0
ファイル: Index.razor.cs プロジェクト: lanicon/FlowDesigner
        protected override async Task OnInitializedAsync()
        {
            var componentBuilder = new ComponentBuilder();
            var width            = 200;
            var height           = 100;

            var component1 = new ConnectedComponentViewModel(Rectangle.Create(20, 20, 10, 5));
            var component2 = new ConnectedComponentViewModel(Rectangle.Create(40, 40, 10, 5));

            var connectionPoint1 = component1.AddConnectionPoint();
            var connectionPoint2 = component2.AddConnectionPoint();

            var scene      = new SceneViewModel(new Vector2(width, height));
            var connection = ConnectionViewModel.Connect(scene, connectionPoint1, connectionPoint2);

            scene.Components.Add(component1);
            scene.Components.Add(component2);
            scene.Components.Add(connection);

            SceneController = new FlowDesignerSceneController(scene);

            await base.OnInitializedAsync();
        }
コード例 #3
0
 private void OpenConnectionWindowsAuth_Click(object sender, RoutedEventArgs e)
 {
     _viewModel.Connect(_viewModel.ConnectionString);
 }