Exemplo n.º 1
0
        public DataChanger(EditWindowType type, UserData user)
        {
            InitializeComponent();
            this.type = type;
            User      = user;
            switch (type)
            {
            case EditWindowType.NewPass: newPass.Visibility = Visibility.Visible; break;

            case EditWindowType.SetPass: setPass.Visibility = Visibility.Visible; break;

            case EditWindowType.NewLogin: newLogin.Visibility = Visibility.Visible; break;
            }
        }
        public void OpenSpecialWindow(string name, EditWindowType type, SpecialWindowContent content = null)
        {
            var w = Model.EditWindows.FirstOrDefault(x => x.Type == type && x.StoreObject.Name == name);

            if (w == null)
            {
                w = new EditWindowDetails {
                    StoreObject = new SpecialWindowStoreObject {
                        Name = name, Content = content
                    }, Type = type
                };
                Model.EditWindows.Add(w);
            }

            ActiveWindowIndex = GetEditWindows().IndexOf(w);
            ActiveWindowName  = w.StoreObject.Name;
        }