示例#1
0
        /// <summary>
        /// main window constructor
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();
            try
            {
                //set application callbacks
                AddonManager.AddLoadedCallback((s) =>
                {
                    Title = $"C3IDE - {s.AddonId} - {s.Id}";
                    AddonLoadDelegate();
                });

                //setup callback
                NotificationManager.SetInfoCallback(OpenNotification);
                NotificationManager.SetErrorCallback(OpenErrorNotification);
                OptionsManager.OptionChangedCallback = OptionChanged;

                //load data
                AddonManager.LoadAllAddons();

                //setup window manager
                WindowManager.MainWindow         = this;
                WindowManager.OpenFindAndReplace = OpenFindAndReplace;
                WindowManager.SetWindowChangeCallback(NavigateToWindow);
                WindowManager.ShowDialog         = ShowDialogBox;
                WindowManager.ShowInputDialog    = ShowInputDialogBox;
                WindowManager.ShowLoadingOverlay = ShowLoadingOverlay;
                WindowManager.CurrentWindow      = ApplicationWindows.DashboardWindow;

                //setup themes and menu
                ThemeManager.SetupTheme();
                MenuManager.SetupMainMenu();

                //setup default view
                SetupMenus(PluginType.SingleGlobalPlugin);
                ActiveItem.Content = ApplicationWindows.DashboardWindow;
                ApplicationWindows.DashboardWindow.OnEnter();
                OptionChanged(OptionsManager.CurrentOptions);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                LogManager.AddErrorLog(ex);
                throw;
            }
        }