/// <summary> /// Изменить отображаемый экран, не меняя стек. /// </summary> /// <param name="name">Имя экрана</param> /// <param name="args">Словарь аргументов</param> /// <param name="css">Путь к файлу стилей</param> /// /// <param name="animation">Анимация перехода</param> public static void ModalMove(string name, IDictionary <string, object> args = null, string css = null, ShowAnimationType animation = ShowAnimationType.GoNext) { var screenInfo = CreateScreenInfoFromName(name, css); ModalMove(screenInfo, args, animation: animation); }
/// <summary> /// Изменить отображаемый экран, не меняя стек. /// </summary> /// <param name="screenInfo">Информация об экране</param> /// <param name="args">Словарь аргументов</param> /// <param name="screen">Ссылка на целевой экран</param> public static void ModalMove(ScreenInfo screenInfo, IDictionary <string, object> args = null, Screen screen = null, ShowAnimationType AnimationType = ShowAnimationType.GoNext) { try { DConsole.WriteLine($"Moving to {screenInfo.Name}"); try { screen = screen ?? (Screen)Application.CreateInstance($"Test.{screenInfo.Name}"); } catch { DConsole.WriteLine($"Can't load screen with name {screenInfo.Name}"); if (!_nonModalMove || ScreenInfoStack.Count < 1) { return; } ScreenInfoStack.Pop(); ScreenStack.Pop(); return; } screen.SetData(args); try { screen.LoadFromStream(Application.GetResourceStream(screenInfo.Xml)); } catch (Exception e) { DConsole.WriteLine($"Error while loading {screenInfo.Name}'s xml ({screenInfo.Xml})"); DConsole.WriteLine($"{e.Message}"); } try { screen.LoadStyleSheet(Application.GetResourceStream(screenInfo.Css)); } catch { screen.LoadStyleSheet(Application.GetResourceStream(DefaultStyle)); } CurrentScreenInfo = screenInfo; CurrentScreen = screen; screen.Show(AnimationType); _nonModalMove = false; } catch (Exception e) { DConsole.WriteLine($"{e.GetType().FullName}:{e.Message}"); DConsole.WriteLine($"{e.StackTrace}"); } }
static extern private void tguiWidget_hideWithEffect(IntPtr cPointer, ShowAnimationType type, Time duration);
/// <summary> /// Hides the widget by making it leave with an animation /// </summary> /// <param name="type">Type of the animation</param> /// <param name="duration">Duration of the animation</param> /// <remarks> /// If the widget is already hidden then the animation will still play but you will not see it. /// /// During the animation the position, size and/or opacity may change. Once the animation is done the widget will /// be back in the state in which it was when this function was called, except that it will no longer be visible. /// </remarks> public void HideWithEffect(ShowAnimationType type, Time duration) { tguiWidget_hideWithEffect(CPointer, type, duration); }
/// <summary> /// Constructor that creates the arguments object /// </summary> /// <param name="type">The type of the animation</param> /// <param name="visible">Is the widget being shown or being hidden?</param> public SignalArgsAnimation(ShowAnimationType type, bool visible) { Type = type; Visible = visible; }