Пример #1
0
        private void OKInvButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(CountTextBox.Text))
            {
                Infinium.LightMessageBox.Show(ref TopForm, false,
                                              "Введите остаток",
                                              "Ошибка");
                CountTextBox.Focus();
                CountTextBox.SelectAll();
                return;
            }

            FactCount = Convert.ToDecimal(CountTextBox.Text);

            if ((FactCount != CurrentCount || CurrentCount < FactCount) && string.IsNullOrWhiteSpace(NotesRichTextBox.Text))
            {
                Infinium.LightMessageBox.Show(ref TopForm, false,
                                              "Введите примечание",
                                              "Ошибка");
                NotesRichTextBox.Focus();
                NotesRichTextBox.SelectAll();
                return;
            }

            Notes = NotesRichTextBox.Text;

            IsOKPress            = true;
            FormEvent            = eClose;
            AnimateTimer.Enabled = true;
        }
        private void Notes_AppendFromTxt_Click(object sender, RoutedEventArgs e)
        {
            WinForms.OpenFileDialog BrowseTextFile = new WinForms.OpenFileDialog();
            BrowseTextFile.Filter = ".txt|*.txt";

            if (BrowseTextFile.ShowDialog() == WinForms.DialogResult.OK)
            {
                NotesRichTextBox.AppendText(File.ReadAllText(BrowseTextFile.FileName));
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            try { PublicIP.Content = new WebClient().DownloadString(new Uri("http://ipinfo.io/ip")); } catch { PublicIP.Content = "Unable to get IP"; }

            ramLimit.Text       = serverWrapper.ServerRAM.ToString();
            ServerFilePath.Text = serverWrapper.ServerPath;
            //----------BUG: Force Online Mode prevents app from starting outside of debug folder----------

            /*
             * if (serverWrapper.ServerForceOnlineMode)
             * {
             *  ForceOnlineMode.IsChecked = serverWrapper.ServerForceOnlineMode;
             *  //VisualStateManager.GoToState(ForceOnlineMode, "CheckBoxChecked", true);
             * }
             * if (!serverWrapper.RunServerOnStartUp)
             * {
             *  RunServerOnStartUp.IsChecked = serverWrapper.RunServerOnStartUp;
             *  //VisualStateManager.GoToState(RunServerOnStartUp, "CheckBoxChecked", true);
             * }
             */

            ServerOutputWindow_AutoScrollButton.Opacity = 0;
            TitleBar.Background = new SolidColorBrush(Color.FromRgb(serverWrapper.TitleBarColor.R, serverWrapper.TitleBarColor.G, serverWrapper.TitleBarColor.B));
            serverPropertiesManager.TitleBar.Background = new SolidColorBrush(Color.FromRgb(serverWrapper.TitleBarColor.R, serverWrapper.TitleBarColor.G, serverWrapper.TitleBarColor.B));
            wrapperSettings.TitleBar.Background         = new SolidColorBrush(Color.FromRgb(serverWrapper.TitleBarColor.R, serverWrapper.TitleBarColor.G, serverWrapper.TitleBarColor.B));
            DefaultOutputColor     = Color.FromRgb(serverWrapper.DefaultOutputColor.R, serverWrapper.DefaultOutputColor.G, serverWrapper.DefaultOutputColor.B);
            WarningOutputColor     = Color.FromRgb(serverWrapper.WarningOutputColor.R, serverWrapper.WarningOutputColor.G, serverWrapper.WarningOutputColor.B);
            ErrorOutputColor       = Color.FromRgb(serverWrapper.ErrorOutputColor.R, serverWrapper.ErrorOutputColor.G, serverWrapper.ErrorOutputColor.B);
            PlayerEventOutputColor = Color.FromRgb(serverWrapper.PlayerEventOutputColor.R, serverWrapper.PlayerEventOutputColor.G, serverWrapper.PlayerEventOutputColor.B);
            ServerDoneLoadingColor = Color.FromRgb(serverWrapper.ServerLoadingDoneColor.R, serverWrapper.ServerLoadingDoneColor.G, serverWrapper.ServerLoadingDoneColor.B);
            NotesRichTextBox.AppendText(serverWrapper.Notes);

            //Does server path exist and is auto start available
            if (File.Exists(ServerFilePath.Text))
            {
                ServerCheck("ServerPath");
                StatusLightColor(1);
            }
            if (ServerFilePath.Text == "...\\server.jar")
            {
                ShowInExplorer.IsEnabled  = false;
                StartStopServer.IsEnabled = false;
                StatusIndicator.Content   = "No server selected";
                StatusLightColor(0);
            }
            if (!File.Exists(ServerFilePath.Text) && ServerFilePath.Text != "...\\server.jar")
            {
                StatusIndicator.Content = "Could not find server file at last known path";
                StatusLightColor(0);
            }
            if (File.Exists(ServerFilePath.Text) && serverWrapper.RunServerOnStartUp == true)
            {
                OnServerStart();
            }

            //Skinning [wip]
            UpdateSkin(0.95f, serverWrapper.BackgroundSkin);

            ModsPluginsWatcher.Changed += ModsPlugins_OnChanged;
            ModsPluginsWatcher.Created += ModsPlugins_OnChanged;
            ModsPluginsWatcher.Deleted += ModsPlugins_OnChanged;
            ModsPluginsWatcher.Renamed += ModsPlugins_OnChanged;

            //if (ModsPluginsWatcher.Path != null) { ModsPluginsWatcher.EnableRaisingEvents = true; }

            WorldsWatcher.Changed += Worlds_OnChanged;
            WorldsWatcher.Created += Worlds_OnChanged;
            WorldsWatcher.Deleted += Worlds_OnChanged;
            WorldsWatcher.Renamed += Worlds_OnChanged;

            //if (WorldsWatcher.Path != null) { WorldsWatcher.EnableRaisingEvents = true; }
        }