/* ============= * = FUNCTIONS = * ============= */ private void GridButton_PointerPressed(object sender, PointerRoutedEventArgs e) { if (!isSelected) { current_sheet = (ModuleSheetNotification)DataContext; current_sheet.type = ModuleSheetNotificationType.SelectSheet; Messenger.Default.Send(current_sheet); } }
private void SheetButton_Loaded(object sender, RoutedEventArgs e) { SetMessenger(); SetTheme(); //Auto selection if (!isSelected) { current_sheet = (ModuleSheetNotification)DataContext; current_sheet.type = ModuleSheetNotificationType.SelectSheet; Messenger.Default.Send(current_sheet); } }
private void SheetButton_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args) { if (DataContext != null) { current_sheet = (ModuleSheetNotification)DataContext; name_sheet.Text = current_sheet.sheetName; icon_sheet.Source = current_sheet.sheetIcon; if (current_sheet.sheetSystem) { close_sheet.Visibility = Visibility.Collapsed; } } }
private void AddModule(ModuleSheetNotification notif) { string name = "" + notif.id; while (ModulesSheetContent.FindName(name) != null) { name = "" + (int.Parse(name) + 1); } ModuleSheet button = new ModuleSheet(); button.DataContext = notif; button.Name = name; button.Margin = new Thickness(0, 5, 0, 0); ModulesSheetContent.Children.Add(button); }
private void SheetButton_Loaded(object sender, RoutedEventArgs e) { if (GlobalVariables.CurrentDevice == SCEELibs.Editor.CurrentDevice.WindowsMobile) { isMobile = true; } SetMessenger(); SetTheme(); //Auto selection if (!isSelected) { current_sheet = (ModuleSheetNotification)DataContext; current_sheet.type = ModuleSheetNotificationType.SelectSheet; Messenger.Default.Send(current_sheet); } CheckFullViewMode(); }
private void SetMessenger() { Messenger.Default.Register <EditorViewNotification>(this, async(notification_ui) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { try { SetTheme(); } catch { } }); }); Messenger.Default.Register <ModuleSheetNotification>(this, async(notification) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { try { switch (notification.type) { case ModuleSheetNotificationType.SelectSheet: if (notification.id == current_sheet.id) { isSelected = true; GridButton.Opacity = 1; pin_sheet.Visibility = Visibility.Visible; GridButton.Width = 67; icon_sheet.Margin = new Thickness(5, 0, 2, 0); } else { isSelected = false; GridButton.Opacity = 0.7; GridButton.Width = 32; icon_sheet.Margin = new Thickness(2, 0, 2, 0); pin_sheet.Visibility = Visibility.Collapsed; } break; case ModuleSheetNotificationType.UpdatedSheet: if (notification.id == current_sheet.id) { current_sheet = notification; } break; case ModuleSheetNotificationType.TriggerSheet: if (notification.id == current_sheet.id) { current_sheet.type = ModuleSheetNotificationType.SelectSheet; Messenger.Default.Send(current_sheet); } break; } } catch { } }); }); if (!isInitialized) { current_sheet.type = ModuleSheetNotificationType.InitalizedSheet; Messenger.Default.Send(current_sheet); isInitialized = true; } }
private void SetMessenger() { Messenger.Default.Register <EditorViewNotification>(this, async(notification_ui) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { try { SetTheme(); } catch { } }); }); Messenger.Default.Register <SettingsNotification>(this, async(notification_settings) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { try { CheckFullViewMode(); } catch { } }); }); Messenger.Default.Register <ModuleSheetNotification>(this, async(notification) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { try { switch (notification.type) { case ModuleSheetNotificationType.SelectSheet: if (notification.id == current_sheet.id) { isSelected = true; GridButton.Opacity = 1; if (!FullViewEnabled && !isMobile) { pin_sheet.Visibility = Visibility.Visible; } GridButton.Width = 67; icon_sheet.Margin = new Thickness(5, 0, 2, 0); } else { isSelected = false; GridButton.Opacity = 0.7; GridButton.Width = 32; icon_sheet.Margin = new Thickness(2, 0, 2, 0); pin_sheet.Visibility = Visibility.Collapsed; if (GlobalVariables.CurrentDevice == SCEELibs.Editor.CurrentDevice.WindowsMobile && !current_sheet.sheetSystem) { current_sheet.type = ModuleSheetNotificationType.RemoveSheet; Messenger.Default.Send(current_sheet); } } break; case ModuleSheetNotificationType.UpdatedSheet: if (notification.id == current_sheet.id) { current_sheet = notification; } break; case ModuleSheetNotificationType.TriggerSheet: if (notification.id == current_sheet.id) { current_sheet.type = ModuleSheetNotificationType.SelectSheet; Messenger.Default.Send(current_sheet); } break; } } catch { } }); }); if (!isInitialized) { current_sheet.type = ModuleSheetNotificationType.InitalizedSheet; Messenger.Default.Send(current_sheet); isInitialized = true; } }
private void SetMessenger() { Messenger.Default.Register <EditorViewNotification>(this, async(notification_ui) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { try { SetTheme(); } catch { } }); }); Messenger.Default.Register <ModuleSheetNotification>(this, async(notification) => { await DispatcherHelper.ExecuteOnUIThreadAsync(() => { try { switch (notification.type) { case ModuleSheetNotificationType.SelectSheet: if (notification.id == current_sheet.id) { isSelected = true; GridButton.BorderThickness = new Thickness(1); } else { isSelected = false; GridButton.BorderThickness = new Thickness(0); } break; case ModuleSheetNotificationType.UpdatedSheet: if (notification.id == current_sheet.id) { current_sheet = notification; } break; case ModuleSheetNotificationType.TriggerSheet: if (notification.id == current_sheet.id) { current_sheet.type = ModuleSheetNotificationType.SelectSheet; Messenger.Default.Send(current_sheet); } break; } } catch { } }); }); if (!isInitialized) { current_sheet.type = ModuleSheetNotificationType.InitalizedSheet; Messenger.Default.Send(current_sheet); isInitialized = true; } }