private void VariablesCommand_Execute(object o, ExecutedRoutedEventArgs args) { if (variableView == null) { variableView = new VariableView(this.processor) { Owner = this, Top = Settings.Default.VarWindowTop == -1 ? this.Top + 100 : Settings.Default.VarWindowTop, Left = Settings.Default.VarWindowLeft == -1 ? this.Left + this.Width - 300 : Settings.Default.VarWindowLeft, Width = Settings.Default.VarWindowWidth, Height = Settings.Default.VarWindowHeight }; variableView.Closed += (lo, larg) => { if (Settings.Default.RememberSizeAndPosition) { Settings.Default.VarWindowTop = variableView.Top; Settings.Default.VarWindowLeft = variableView.Left; Settings.Default.VarWindowWidth = variableView.Width; Settings.Default.VarWindowHeight = variableView.Height; } else { Settings.Default.VarWindowTop = double.Parse(Settings.Default.Properties["VarWindowTop"].DefaultValue.ToString()); Settings.Default.VarWindowLeft = double.Parse(Settings.Default.Properties["VarWindowLeft"].DefaultValue.ToString()); Settings.Default.VarWindowWidth = double.Parse(Settings.Default.Properties["VarWindowWidth"].DefaultValue.ToString()); Settings.Default.VarWindowHeight = double.Parse(Settings.Default.Properties["VarWindowHeight"].DefaultValue.ToString()); } variableView = null; }; } if (variableView.Visibility == Visibility.Visible) variableView.Activate(); else variableView.Visibility = Visibility.Visible; }