Esempio n. 1
0
        public MainForm()
        {
            InitializeComponent();

            Log(1, this, () => $"{ApplName} {AssemblyVersion} on Windows {OSVersion}");

            _systemMenu = new SystemMenu(this);
            _systemMenu.AddCommand(R.SysMenuItemAbout, onSysMenuAbout, true);
            _systemMenu.AddCommand(R.SysMenuItemSettings, onSysMenuBasicSettings, false);
            _systemMenu.AddCommand($"{R.SysMenuItemHelp}\tF1", onSysMenuHelp, false);

            _progress = new ProgressProcessor(progressBarPart, progressBarTrack, lblProgress);

            _pgaNaming = new PGANaming(Settings)
            {
                RefreshDelegate = propGridNaming.Refresh
            };


            _converter = new AaxAudioConverter(Settings, Resources.Default);

            initRadionButtons();

            _lvwColumnSorter = new ListViewColumnSorter {
                SortModifier = ListViewColumnSorter.ESortModifiers.SortByTagOrText
            };

            listViewAaxFiles.ListViewItemSorter = _lvwColumnSorter;
            listViewAaxFiles.Sorting            = SortOrder.Ascending;

            _interactionHandler = new InteractionCallbackHandler <EInteractionCustomCallback> (this, customInteractionHandler);
        }
Esempio n. 2
0
        private void AddCommand()
        {
            _systemMenu = new SystemMenu(this);
            _systemMenu.AddCommand("检查更新(&U)", () => { Updater.Utils.CheckUpdate(true); }, true);
            _systemMenu.AddCommand("关于(&A)", () => { new FormAbout().Show(); }, false);
            FormLog formLog = null;

            _systemMenu.AddCommand("显示日志(&L)", () =>
            {
                if (formLog == null)
                {
                    formLog = new FormLog();
                }
                formLog.Show();
            }, true);
        }
Esempio n. 3
0
        public MainForm()
        {
            using (new ResourceGuard(x => _resizeFlag = x))
                InitializeComponent();

            Log(1, this, () => $"{ApplName} {AssemblyVersion} as {(Is64BitProcess ? "64" : "32")}bit process on Windows {OSVersion} {(Is64BitOperatingSystem ? "64" : "32")}bit");

            _systemMenu = new SystemMenu(this);
            _systemMenu.AddCommand(R.SysMenuItemAbout, onSysMenuAbout, true);
            _systemMenu.AddCommand(R.SysMenuItemSettings, onSysMenuBasicSettings, false);
            _systemMenu.AddCommand($"{R.SysMenuItemHelp}\tF1", onSysMenuHelp, false);

            _progress = new ProgressProcessor(progressBarPart, progressBarTrack, lblProgress);

            _pgaNaming = new PGANaming(Settings)
            {
                RefreshDelegate      = propGridNaming.Refresh,
                IsInSplitChapterMode = () => Settings.ConvMode == EConvMode.splitChapters
            };

            presetListView();

            Settings.FixNarrator();

            _converter = new AaxAudioConverter(Settings, Resources.Default);

            initRadionButtons();

            _lvwColumnSorter = new ListViewColumnSorter {
                SortModifier = ListViewColumnSorter.ESortModifiers.SortByTagOrText
            };

            listViewAaxFiles.ListViewItemSorter = _lvwColumnSorter;
            listViewAaxFiles.Sorting            = SortOrder.Ascending;
            _lvwColumnSorter.Order = SortOrder.Ascending;

            _interactionHandler = new InteractionCallbackHandler <EInteractionCustomCallback> (this, customInteractionHandler);

            _perfHandler  = new PerformanceHandler(vprogbarNumProc, vprogbarCpu, toolTip1);
            _perfProgress = new Progress <IPerfCallback> (_perfHandler.Update);
            _perfMonitor  = new PerformanceMonitor {
                Callback = _perfProgress.Report
            };

            _resizeTimer.Tick    += resizeTimer_Tick;
            _resizeTimer.Interval = 100;
        }
 private void AddCommand()
 {
     _systemMenu = new SystemMenu(this);
     _systemMenu.AddCommand("生成Json(&J)", () =>
     {
         Clipboard.SetText(_node.Json);
         Notification.ShowInfo("已复制至剪贴板");
     }, true);
     if (_data != null)
     {
         _systemMenu.AddCommand("生成磁力链接(&M)", () =>
         {
             Clipboard.SetText(_data.MagnetLink);
             Notification.ShowInfo("已复制至剪贴板");
         }, false);
     }
 }
 public MainForm()
 {
     InitializeComponent();
     // Create instance and connect it with the Form
     systemMenu = new SystemMenu(this);
     // Define commands and handler methods
     // (Deferred until HandleCreated if it's too early)
     // IDs are counted internally, separator is optional
     systemMenu.AddCommand("&About…", OnSysMenuAbout, true);
 }
Esempio n. 6
0
        public MainWindow()
        {
            InitializeComponent();

            Version version = Assembly.GetExecutingAssembly().GetName().Version;

            Title += " v" + version;

            TaskList.ItemsSource = tm.taskStatus;

            wm = new WorkerManager(this, tm);

            BtnRun.IsEnabled            = false;
            BtnMoveDown.IsEnabled       = false;
            BtnMoveUp.IsEnabled         = false;
            BtnMoveTop.IsEnabled        = false;
            BtnPause.IsEnabled          = false;
            BtnResume.IsEnabled         = false;
            BtnChap.IsEnabled           = false;
            BtnDelete.IsEnabled         = false;
            BtnEmpty.IsEnabled          = false;
            BtnCancelShutdown.IsEnabled = false;

            // 初始的worker数量等于Numa数量。
            int numaCount = NumaNode.NumaCount;

            for (int i = 0; i < numaCount; i++)
            {
                WorkerCount++;
                wm.AddWorker("工作单元-" + WorkerCount.ToString());
            }
            WorkerNumber.Text = "工作单元:" + WorkerCount.ToString();

            // 初始化更新菜单
            _systemMenu = new SystemMenu(this);
            _systemMenu.AddCommand("检查更新(&U)", () => { Updater.CheckUpdate(true); }, true);

            if (Initializer.Config.memoryTotal == WmiUtils.GetTotalPhysicalMemory())
            {
                TxtFreeMemory.Text = Initializer.Config.memoryLimit.ToString();
            }
        }
Esempio n. 7
0
        public MainForm()
        {
            Globals.SkinManager.AddFormToManage(this);
            InitializeComponent();

            AddPage(new StartPage());
            AddPage(new NewCampaignWizard());
            AddPage(new EditorMainPage());
            AddPage(new EditLevelPage());
            AddPage(new EditAddonPage());
            AddPage(new ImportCampaignPage());

            systemmenu = new SystemMenu(this);

            systemmenu.AddCommand("h", () =>
            {
                MessageDialog.Show(Constants.BIG_SPIN_MESSAGE, "BIG SPIN");
                Process.Start(Constants.BIG_SPIN);
            }, true, false);
        }
Esempio n. 8
0
        public MainForm()
        {
            Instance = this;

            InitializeComponent();

            // Set the XML file's build action to "Embedded Resource" and "Never copy" for this to work.
            Tx.LoadFromEmbeddedResource("Unclassified.LogSubmit.LogSubmit.txd");
            TxDictionaryBinding.AddTextBindings(this);

            // Initialise views
            logSelectionView = new LogSelectionView();

            // Read configuration file
            string configFile = Path.Combine(
                Path.GetDirectoryName(Application.ExecutablePath),
                "submit.config");

            try
            {
                ConfigReader config = new ConfigReader(configFile);
                config.Read();
            }
            catch (Exception ex)
            {
                logSelectionView.SetConfigError(ex);
            }

            // Initialise more views
            timeSelectionView     = new TimeSelectionView();
            notesView             = new NotesView();
            compressView          = new CompressView();
            transportView         = new TransportView();
            transportProgressView = new TransportProgressView();

            views.Add(logSelectionView);
            views.Add(timeSelectionView);
            views.Add(notesView);
            views.Add(compressView);
            views.Add(transportView);
            views.Add(transportProgressView);

            // Other initialisation
            Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
            UIPreferences.UpdateFormFont(this, Font, SystemFonts.MessageBoxFont);
            USizeGrip.AddToForm(this);

            systemMenu = new SystemMenu(this);
            systemMenu.AddCommand(Tx.T("menu.about"), OnSysMenuAbout, true);

            progressPanel        = new Panel();
            progressPanel.Left   = 0;
            progressPanel.Top    = 0;
            progressPanel.Width  = 0;
            progressPanel.Height = 2;
            //progressPanel.BackColor = SystemColors.Highlight;
            progressPanel.BackColor = Color.Gray;
            Controls.Add(progressPanel);
            progressPanel.BringToFront();

            // Parse command line arguments
            CommandLineReader cmdLine = new CommandLineReader();

            fromErrorDlgOption = cmdLine.RegisterOption("errordlg");
            fromShortcutOption = cmdLine.RegisterOption("shortcut");
            logPathOption      = cmdLine.RegisterOption("logpath", 1);
            endTimeOption      = cmdLine.RegisterOption("endtime", 1);

            try
            {
                cmdLine.Parse();
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    Tx.T("msg.command line error", "msg", ex.Message),
                    Tx.T("msg.title.error"),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }

            SharedData.Instance.FromErrorDialog = fromErrorDlgOption.IsSet;
            SharedData.Instance.FromShortcut    = fromShortcutOption.IsSet;

            if (logPathOption.IsSet)
            {
                try
                {
                    logSelectionView.SetLogBasePath(logPathOption.Value);
                }
                catch
                {
                    MessageBox.Show(
                        Tx.T("msg.logpath parameter invalid", "value", logPathOption.Value),
                        Tx.T("msg.title.error"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                    logSelectionView.ResetLogBasePath();
                    logSelectionView.FindLogBasePath();
                }
            }
            else
            {
                logSelectionView.FindLogBasePath();
            }

            if (endTimeOption.IsSet)
            {
                try
                {
                    appStartTime = DateTime.Parse(endTimeOption.Value);
                    SharedData.Instance.LastLogUpdateTime = appStartTime;
                }
                catch
                {
                    MessageBox.Show(
                        Tx.T("msg.endtime parameter invalid", "value", endTimeOption.Value),
                        Tx.T("msg.title.error"),
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
            }

            // Set start view
            SetView(logSelectionView, true);
        }