Exemple #1
0
        public static void TDialog()
        {
            var win = new DirectoryCheck("Lang.Windows.DirectoryCheck");

            win.ShowSubWindow();
            win.Show();
        }
Exemple #2
0
        static void Main()
        {
            string thisProcessName = Process.GetCurrentProcess().ProcessName;

            if (Process.GetProcesses().Count(p => p.ProcessName == thisProcessName) > 1)
            {
                MessageBox.Show("LanDOXer уже запущен", "LanDOXer");
                return;
            }
            //TODO: Включить
            //System.AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionTrapper;
            //MakeAutoLaunch();
            var lanDox           = new DirectoryCheck();
            var fileWithByteData = new ReadWriteBytesData();
            var notifications    = new SomeNotifications();

            while (true)
            {
                lanDox.CheckDirectoryExistence(lanDox.FullPath());
                fileWithByteData.CreateFileIfNotExists();
                if (fileWithByteData.FolderHasChangedByBytesInFiles(lanDox.LanDoxDirectory))
                {
                    const string boxTitle = "LanDOXer";
                    const string boxText  =
                        "В Ландоксе изменения! Взгляните! \n\"Да\" - открыть папку LanDocs \n \"Нет\" - напомнить посмотреть позже \"";
                    notifications.LanDoxMessageBoxNotification(boxText, boxTitle, lanDox.FullPath(), fileWithByteData,
                                                               lanDox.LanDoxDirectory);
                }

                Thread.Sleep(TimeToSleep);
            }
        }
Exemple #3
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                var isSingle = SingleInstance.IsSingle();
                if (!isSingle)
                {
                    SingleInstance.SetForeground();
                    return;
                }

                var isTrueDirectory = DirectoryCheck.IsTrueDirectory();
                if (!isTrueDirectory)
                {
                    throw new Exception(I18N.GetString("FileNotFound"));
                }

                var isAdmin = Administrator.IsAdmin();
                if (e.Args.Length == 0 && isAdmin)
                {
                    switch (MessageBox.Show($"{I18N.GetString("Setup")}", name,
                                            MessageBoxButton.YesNoCancel, MessageBoxImage.Information))
                    {
                    case MessageBoxResult.Yes:
                        Autorun.Add();
                        DesktopMenu.Add();
                        break;

                    case MessageBoxResult.No:
                        Autorun.Remove();
                        DesktopMenu.Remove();
                        V2Ray.Stop();
                        break;

                    default:
                        break;
                    }
                }
                else if (e.Args.Length == 0 && !isAdmin)
                {
                    throw new Exception(I18N.GetString("PermissionDenied"));
                }
                else if (e.Args[0] == "-start")
                {
                    V2Ray.Start();
                }
                else if (e.Args[0] == "-stop")
                {
                    V2Ray.Stop();
                }
                else if (e.Args[0] == "-config")
                {
                    var window = new MainWindow();
                    window.ShowDialog();
                }
                else
                {
                    throw new ArgumentException();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, name, MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                Environment.Exit(Environment.ExitCode);
            }
        }