Example #1
0
        public ChatWindow(ChatViewModel vm)
        {
            InitializeComponent();
            MainContent = ChatContent;
            BoundaryRef = Boundary;
            Init(vm.WindowSettings);
            AddHandler(DragablzItem.IsDraggingChangedEvent, new RoutedPropertyChangedEventHandler <bool>(OnIsDraggingChanged));

            VM          = vm;
            DataContext = vm;
            if (VM == null)
            {
                throw new NullReferenceException("Window DataContext is null!");
            }

            VM.RefreshHideTimer();
            VM.ForceSizePosUpdateEvent += OnForceSizePosUpdate;

            if (WindowSettings == null)
            {
                return;
            }

            ((ChatWindowSettings)WindowSettings).FadeoutChanged += () => VM.RefreshHideTimer();
        }
 public ChatWindow(ChatWindowSettings ws, ChatViewModel vm) : this(ws)
 {
     DataContext = vm;
     VM          = DataContext as ChatViewModel;
     if (VM == null)
     {
         return;
     }
     VM.WindowSettings = ws;
     ((ChatWindowSettings)WindowSettings).FadeoutChanged += () => VM.RefreshHideTimer();
     VM.RefreshHideTimer();
 }