/// <summary> /// Initializes a new instance of the <see cref="EventLogControlVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> /// <exception cref="System.ArgumentNullException">@ mainWindowVm</exception> public EventLogControlVm(MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.MainWindowVm = mainWindowVm; this.SortCommand = new DelegateCommand(this.SortBy); this.deleteEventLogCommand = new DelegateCommand(this.DeleteEventLog); this.EventLogs = new ObservableCollection <ImsOpcBridgeEventLog>(); // set default values this.FilterExpression = string.Empty; this.SortedBy = string.Empty; this.ButtonControlLabel = Resources.DeleteEventLog; this.TimeHeader = Resources.TimeHeader; this.EventHeader = Resources.EventHeader; this.ButtonControlBitmapPath = @"/EH.ImsOpcBridge.Configurator.Wpf;component/Resources/DesignA2\Delete active.png"; mainWindowVm.Host.UserInterface.ToggleMessageAgent += this.UserInterfaceToggleMessageAgent; this.UpdateNumberOfItems(); }
protected override async void OnStartup(StartupEventArgs e) { var mainWindow = new MainWindow(); var mainWindowVm = new MainWindowVm(mainWindow); mainWindowVm.Show(); }
public void ApplicationStartup(object sender, StartupEventArgs e) { var mainWindowVm = new MainWindowVm(); var mainWindow = new MainWindow(mainWindowVm); mainWindow.Show(); }
public MainWindow() { InitializeComponent(); var sourceLocation = File.Exists(@"..\..\MainWindow.xaml") ? XamlDisplayerPanel.SourceEnum.LoadFromLocal : XamlDisplayerPanel.SourceEnum.LoadFromRemote; XamlDisplayerPanel.Initialize( source: sourceLocation, defaultLocalPath: $@"..\..\", defaultRemotePath: @"https://raw.githubusercontent.com/ButchersBoy/MaterialDesignInXamlToolkit/master/MainDemo.Wpf/", attributesToBeRemoved: new List <string>() { "xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"", "xmlns:materialDesign=\"http://materialdesigninxaml.net/winfx/xaml/themes\"", "xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"" }); Task.Factory.StartNew(() => { Thread.Sleep(2500); }).ContinueWith(t => { //note you can use the message queue from any thread, but just for the demo here we //need to get the message queue from the snackbar, so need to be on the dispatcher MainSnackbar.MessageQueue.Enqueue("Welcome to Material Design In XAML Tookit"); }, TaskScheduler.FromCurrentSynchronizationContext()); DataContext = new MainWindowVm(MainSnackbar.MessageQueue); Snackbar = this.MainSnackbar; }
/// <summary> /// Initializes a new instance of the <see cref="BridgeGatewaySettingsControlVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> /// <exception cref="System.ArgumentNullException">@ mainWindowVm</exception> public BridgeGatewaySettingsControlVm(MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.mainWindowViewModel = mainWindowVm; this.TextBoxLabel1 = Resources.Model; this.TextBoxLabelUnit1 = string.Empty; this.IdentificationLabel1 = Resources.UniqueIdentifier; this.ActivationKeyLabel2 = Resources.ActivationKey; this.ButtonControlLabel = Resources.GenerateActivationKey; this.setTextBox1Text = new DelegateCommand(this.OnTextBox1Text); this.setActivationKeyText = new DelegateCommand(this.OnSetActivationKeyText); this.setIdentificationText = new DelegateCommand(this.OnSetIdentificationText); this.generateActivationKey = new DelegateCommand(this.GenerateActivationKey); this.ActivationKeyText = string.Empty; this.IdentificationText = string.Empty; this.TextBox1Text = string.Empty; this.mainWindowViewModel.ServiceDataReceiver.ConfigurationResponse += this.HandleConfigurationResponse; }
public MainWindow() { InitializeComponent(); var vm = new MainWindowVm(); DataContext = vm; }
/// <summary> /// Initializes a new instance of the <see cref="MessageAgentVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> /// <exception cref="System.ArgumentNullException">@ mainWindowVm</exception> public MessageAgentVm(MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.mainWindowVm = mainWindowVm; this.ProgressViewModel = mainWindowVm.ProgressViewModel; this.AgentMode = AgentMode.None; this.timerMessage = new DispatcherTimer { Interval = TimeSpan.FromSeconds(10.0) }; this.timerMessage.Tick += this.TimerTickEventHandlerMessage; this.timerTime = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1.0) }; this.timerTime.Start(); this.timerTime.Tick += this.TimerTickEventHandlerTime; this.showListCommand = new DelegateCommand(this.ShowListCommandPressed); this.Messages = new ObservableCollection <string>(); this.ShowListButtonText = ">"; }
/// <summary> /// Initializes a new instance of the <see cref="SupplyCareSettingCtrlVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> public SupplyCareSettingCtrlVm(MainWindowVm mainWindowVm) { this.SupplyCareSettingItems = new ObservableCollection <SupplyCareSettingItemVm>(); this.mainWindowViewModel = mainWindowVm; this.saveConfigurationCommand = new DelegateCommand(this.SaveConfiguration); this.loadConfigurationCommand = new DelegateCommand(this.LoadConfiguration); this.exportConfigurationCommand = new DelegateCommand(this.ExportConfiguration); this.importConfigurationCommand = new DelegateCommand(this.ImportConfiguration); var supplyCareWebServerSettingsCtrl = new SupplyCareWebServerSettingsCtrl(); this.supplyCareWebServerSettingsControlVm = new SupplyCareWebServerSettingsControlVm(mainWindowVm); var supplyCareSamplingRateSettingsCtrl = new SupplyCareSamplingRateSettingsCtrl(); this.supplyCareSamplingRateSettingsControlVm = new SupplyCareSamplingRateSettingsControlVm(mainWindowVm); var supplyCareSettingItemVm = new SupplyCareSettingItemVm(this, supplyCareWebServerSettingsCtrl, this.supplyCareWebServerSettingsControlVm, Resources.WebServer, true, @"SupplyCare WebServer Configuration"); supplyCareSettingItemVm.IsExpanded = false; this.SupplyCareSettingItems.Add(supplyCareSettingItemVm); supplyCareSettingItemVm = new SupplyCareSettingItemVm(this, supplyCareSamplingRateSettingsCtrl, this.supplyCareSamplingRateSettingsControlVm, Resources.OPCTimeSchedule, true, @"OPC time schedule"); supplyCareSettingItemVm.IsExpanded = false; this.SupplyCareSettingItems.Add(supplyCareSettingItemVm); }
/// <summary> /// Initializes a new instance of the <see cref="FisProxySettingsControlVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> /// <exception cref="System.ArgumentNullException">@ mainWindowVm</exception> public FisProxySettingsControlVm(MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.mainWindowViewModel = mainWindowVm; this.CheckBoxLabel = Resources.EnableProxy; this.TextBoxLabel1 = Resources.URL; this.TextBoxLabelUnit1 = string.Empty; this.TextBoxLabel2 = Resources.Port; this.TextBoxLabelUnit2 = string.Empty; this.setTextBox1Text = new DelegateCommand(this.OnTextBox1Text); this.setTextBox2Text = new DelegateCommand(this.OnTextBox2Text); this.TextBox1Text = string.Empty; this.TextBox2Text = string.Empty; this.IsChecked = false; this.LoginLabel1 = Resources.Login; this.PassWordLabel2 = Resources.PassWord; this.CheckBoxLabelAuthentication = Resources.EnableAuthentication; this.setPassWordText = new DelegateCommand(this.OnSetPassWordText); this.setLoginText = new DelegateCommand(this.OnSetLoginText); this.mainWindowViewModel.ServiceDataReceiver.ConfigurationResponse += this.HandleConfigurationResponse; }
public MainWindow() { try { AppWindow = this; AppCommon = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); AppDataPath = Path.Combine(AppCommon, "Mapping Tools"); ExportPath = Path.Combine(AppDataPath, "Exports"); HttpClient = new HttpClient(); HttpClient.DefaultRequestHeaders.Add("user-agent", "Mapping Tools"); InitializeComponent(); Setup(); SettingsManager.LoadConfig(); ListenerManager = new ListenerManager(); DataContext = new MainWindowVm(); MessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(2)); MainSnackbar.MessageQueue = MessageQueue; if (SettingsManager.Settings.MainWindowRestoreBounds.HasValue) { SetToRect(SettingsManager.Settings.MainWindowRestoreBounds.Value); } SetFullscreen(SettingsManager.Settings.MainWindowMaximized); SetCurrentMaps(SettingsManager.GetLatestCurrentMaps()); // Set currentmap to previously opened map } catch (Exception ex) { ex.Show(); } }
/// <summary> /// Initializes a new instance of the <see cref="ServerControlVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> /// <exception cref="System.ArgumentNullException">@ mainWindowVm</exception> public ServerControlVm(MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.mainWindowViewModel = mainWindowVm; this.NameHeader = Resources.ServerNameHeader; this.ClassIdHeader = Resources.ClassIdHeader; this.FilterHeader = Resources.Filter; this.EnterFilterTerm = Resources.EnterFilterTerm; this.ActiveServer = Resources.NoServerForAddressSpaceBrowsingActivated; this.OpcServerItems = new ObservableCollection <ServerData>(); var view = (CollectionView)CollectionViewSource.GetDefaultView(this.OpcServerItems); view.Filter = this.UserFilter; this.connectServerCommand = new DelegateCommand(this.GoToConnectServer); this.SelectedServer = new OpcServerItem(true); this.mainWindowViewModel.ServiceDataReceiver.OpcServersResponse += this.HandleOpcServersResponse; this.mainWindowViewModel.ServiceDataReceiver.ReadOpcAddressSpaceResponse += this.HandleReadOpcAddressSpaceResponse; this.UpdateNumberOfItems(); }
public MainWindow() { DataContext = new MainWindowVm(); DamageTest(); InitializeComponent(); }
/// <summary> /// Initializes a new instance of the <see cref="FisTimeScheduleSettingsControlVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> /// <exception cref="System.ArgumentNullException"> @ mainWindowVm</exception> public FisTimeScheduleSettingsControlVm(MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.mainWindowViewModel = mainWindowVm; this.SamplingRates = new ObservableCollection <string>(); this.ComboBoxLabel = Resources.Interval; this.ComboBoxLabelUnit = string.Empty; this.TextBoxLabel = string.Empty; this.TextBoxLabelUnit = string.Empty; this.setTextBoxText = new DelegateCommand(this.OnSetTextBoxText); this.samplingRatesSelectionChanged = new DelegateCommand(this.OnSamplingRatesSelectionChanged); this.ActiveSamplingRate = string.Empty; this.mainWindowViewModel.ServiceDataReceiver.ConfigurationResponse += this.HandleConfigurationResponse; this.InitializeViewControls(); }
public MainWindow(MainWindowVm mainWindowVm) { this._mainWindowVm = mainWindowVm; DataContext = mainWindowVm; Closing += (sender, e) => { Dispose(); }; InitializeComponent(); WindowStartupLocation = WindowStartupLocation.CenterScreen; }
public MainWindow(MainWindowVm mainWindowVm) { this.mainWindowVm = mainWindowVm; DataContext = mainWindowVm; Closing += (sender, e) => { Dispose(); }; InitializeComponent(); }
/// <summary> /// Initializes a new instance of the <see cref="AriadnePathControlVm" /> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> public AriadnePathControlVm(MainWindowVm mainWindowVm) { this.IsVisible = true; this.IsEnabled = false; this.mainWindowVm = mainWindowVm; this.PathItems = new ObservableCollection <AriadnePathControlItemVm>(); this.ClearPath(); }
public void ApplicationStartup(object sender, StartupEventArgs e) { Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var mainWindowVm = new MainWindowVm(); var mainWindow = new MainWindow(mainWindowVm); mainWindow.Show(); }
public static void Main() { var viewmodel = new MainWindowVm(); var view = new MainWindow { DataContext = viewmodel }; var app = new Application(); app.Run(view); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); _viewModel = new MainWindowVm(); var view = new MainWindow(_viewModel); view.Closing += ViewOnClosing;//prije zatvaranja spremi u bazu view.Show(); }
public MainWindow() { InitializeComponent(); DataContext = new MainWindowVm(); _avalonDockManager.Loaded += _avalonDockManager_Loaded; LoadLayoutEvent.Instance.Subscribe(OnLoadLayout); SaveLayoutEvent.Instance.Subscribe(OnSaveLayout); }
public MainWindow(MainWindowVm vm) { InitializeComponent(); // Bind View with ViewModel DataContext = vm; // Bind View event vm.RequestClose += delegate { Close(); }; vm.RequestOpenAssembliesView += OpenAssembliesView; }
public MainWindow() { InitializeComponent(); PreviewDragOver += MainWindow_DragOver; PreviewDrop += MainWindow_Drop; _viewModel = DataContext as MainWindowVm; Messenger.Default.Register <ErrorMsg>(this, true, OnError); Messenger.Default.Register <SucceedMsg>(this, true, OnSucceed); Messenger.Default.Register <CallPostRestorePlugins>(this, true, InvokePostRestorePlugins); Loaded += OnLoaded; }
public MainWindow() { InitializeComponent(); _viewModel = DataContext as MainWindowVm; Loaded += OnLoaded; SetupWindowClosingActions(); _viewModel.PropertyChanged += OnPrDescriptionChanged; TxtPrDescription.Navigating += WebBrowser_OnNavigating; InputManager.Current.PreNotifyInput += ProcessF5RefreshHotKey; }
/// <summary> /// Initializes a new instance of the <see cref="OpcItemMappingTreeParentVm"/> class. /// </summary> /// <param name="opcItems">The opc items.</param> /// <param name="mainWindowVm">The main window vm.</param> public OpcItemMappingTreeParentVm(IEnumerable <OpcItem> opcItems, MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.mainWindowViewModel = mainWindowVm; this.AllowDrag = true; this.OpcItems = new ObservableCollection <OpcItemMappingTreeRootVm>((from opcItem in opcItems select new OpcItemMappingTreeRootVm(opcItem, this.mainWindowViewModel)).ToList()); }
/// <summary> /// Initializes a new instance of the <see cref="OpcItemMappingTreeRootVm"/> class. /// </summary> /// <param name="opcItem"> /// The opc item. /// </param> /// <param name="mainWindowVm"> /// The main window vm. /// </param> public OpcItemMappingTreeRootVm(OpcItem opcItem, MainWindowVm mainWindowVm) : base(null, true) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.mainWindowViewModel = mainWindowVm; this.opcItem = opcItem; this.IsExpanded = true; this.RootOpcItemName = this.mainWindowViewModel.ConnectedServer.Name; }
/// <summary> /// Initializes a new instance of the <see cref="SupplyCareSamplingRateSettingsControlVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> /// <exception cref="System.ArgumentNullException">@ mainWindowVm</exception> public SupplyCareSamplingRateSettingsControlVm(MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.mainWindowViewModel = mainWindowVm; this.TextBoxLabel1 = Resources.Interval; this.TextBoxLabelUnit1 = Resources.LabelUnitStartTime; this.setTextBox1Text = new DelegateCommand(this.OnTextBox1Text); this.TextBox1Text = string.Empty; this.mainWindowViewModel.ServiceDataReceiver.ConfigurationResponse += this.HandleConfigurationResponse; }
public SettingsVm(MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.MainWindowVm = mainWindowVm; this.InitializeSettings(); this.bridgeSettingControlVm = new BridgeSettingCtrlVm(mainWindowVm); this.bridgeSettingControl = new BridgeSettingControl(); this.supplyCareSettingCtrlVm = new SupplyCareSettingCtrlVm(mainWindowVm); this.supplyCareSettingControl = new SupplyCareSettingControl(); this.fisSettingControlVm = new FisSettingCtrlVm(mainWindowVm); this.fisSettingControl = new FisSettingControl(); this.languageControlVm = new LanguageControlVm(this.settings, mainWindowVm.Host); this.languageControl = new LanguageControl(); this.OwnConfiguration = new OwnConfigurationControlVm(); this.CurrentSection = SettingsSection.Bridge; this.Choice = new BaseSelectorControlViewModel(); this.Choice.SelectedItemChanged += this.ChoiceSelectedItemChangedHandler; this.Choice.Items.Add(new BaseSelectorItemViewModel(Resources.ImsOpcBridge, string.Empty, string.Empty, "automId_ImsOpcBridge", SettingsSection.Bridge, 1)); this.Choice.Items.Add(new BaseSelectorItemViewModel(Resources.SupplyCareEnterprise, string.Empty, string.Empty, "automId_SupplyCareEnterprise", SettingsSection.SupplyCareEnterprise, 2)); // emilio temp FIS disabled for the first release. Only this line must be commented / uncommented. // this.Choice.Items.Add(new BaseSelectorItemViewModel(Resources.FieldInformationServer, string.Empty, string.Empty, "automId_FieldInformationServer", SettingsSection.FieldInformationServer, 3)); //// this.Choice.Items.Add(new BaseSelectorItemViewModel(Resources.UserLoginPassword, string.Empty, string.Empty, "automId_UserLoginPassword", SettingsSection.UserLoginPassword, 4)); if (ImsOpcBridgeSettings.Singleton.AllowCultureChange) { this.Choice.Items.Add(new BaseSelectorItemViewModel(Resources.LanguageCommandName, string.Empty, string.Empty, "automId_Language", SettingsSection.Language, 4)); } ////this.Choice.Items.Add(new BaseSelectorItemViewModel(string.Empty, string.Empty, string.Empty, "automId_Empty1", SettingsSection.Default, 5)); this.Choice.SelectItem(this.CurrentSection); }
protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); var window = new MainWindow(); var viewModel = new MainWindowVm(); EventHandler handler = null; handler = delegate { viewModel.RequestClose -= handler; window.Close(); }; viewModel.RequestClose += handler; window.DataContext = viewModel; window.Show(); }
/// <summary> /// Initializes a new instance of the <see cref="BridgeSettingCtrlVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> public BridgeSettingCtrlVm(MainWindowVm mainWindowVm) { this.BridgeSettingItems = new ObservableCollection <BridgeSettingItemVm>(); this.mainWindowViewModel = mainWindowVm; this.saveConfigurationCommand = new DelegateCommand(this.SaveConfiguration); this.loadConfigurationCommand = new DelegateCommand(this.LoadConfiguration); this.exportConfigurationCommand = new DelegateCommand(this.ExportConfiguration); this.importConfigurationCommand = new DelegateCommand(this.ImportConfiguration); var bridgeGatewaySettingsCtrl = new BridgeGatewaySettingsCtrl(); this.bridgeGatewaySettingsControlVm = new BridgeGatewaySettingsControlVm(mainWindowVm); var bridgeSettingItem = new BridgeSettingItemVm(this, bridgeGatewaySettingsCtrl, this.bridgeGatewaySettingsControlVm, Resources.Gateway, true, @"Gateway"); bridgeSettingItem.IsExpanded = true; this.BridgeSettingItems.Add(bridgeSettingItem); }
/// <summary> /// Initializes a new instance of the <see cref="FisConnectionSettingsControlVm"/> class. /// </summary> /// <param name="mainWindowVm">The main window vm.</param> /// <exception cref="System.ArgumentNullException">@ mainWindowVm</exception> public FisConnectionSettingsControlVm(MainWindowVm mainWindowVm) { if (mainWindowVm == null) { throw new ArgumentNullException(@"mainWindowVm"); } this.mainWindowViewModel = mainWindowVm; this.CheckBoxLabel = Resources.EnableConnection; this.TextBoxLabel1 = Resources.URL; this.TextBoxLabelUnit1 = string.Empty; // emilio temp: it was decided, 2015.01.22, to hide this label and textbox (Port Number). // this.TextBoxLabel2 = Resources.Port; this.TextBoxLabel2 = string.Empty; this.TextBoxLabelUnit2 = string.Empty; this.LoginLabel1 = Resources.Login; this.PassWordLabel2 = Resources.PassWord; this.ButtonControlLabel = Resources.FISRegistration; this.setTextBox1Text = new DelegateCommand(this.OnTextBox1Text); this.setTextBox2Text = new DelegateCommand(this.OnTextBox2Text); this.setPassWordText = new DelegateCommand(this.OnSetPassWordText); this.setLoginText = new DelegateCommand(this.OnSetLoginText); this.fisRegistration = new DelegateCommand(this.OnFisRegistration); this.TextBox1Text = string.Empty; this.TextBox2Text = string.Empty; this.LoginText = string.Empty; this.PassWordText = string.Empty; this.IsChecked = false; this.mainWindowViewModel.ServiceDataReceiver.ConfigurationResponse += this.HandleConfigurationResponse; }
public DoBattleCommand(MainWindowVm main) : base(main) { }
protected BaseCommand(MainWindowVm main) { Main = main; }