Example #1
0
            protected override bool OnInitialize(System.Collections.ObjectModel.ReadOnlyCollection <string> commandLineArgs)
            {
                try
                {
                    ChangeUICulture(Settings.Default.UICulture.Name);

                    // Register skins.
                    DevExpress.UserSkins.BonusSkins.Register();
                    DevExpress.UserSkins.OfficeSkins.Register();

                    // Set user skin.
                    UserLookAndFeel.Default.SetSkinStyle(Settings.Default.SkinName);

                    // Initialize automatic error handling.
                    Application.ThreadException += Application_ThreadException;
                    _BugReportPresenter          = new FormBugReportPresenter(new BugSubmitter(), new FormBugReport());
                }
                catch (Exception ex)
                {
                    // NOTE: Here we can't use FormBugReport because it may not be initialized.
                    MessageBox.Show(
                        "Unfortunally FileWall failed to initialize. Please send us screenshot of this window.\r\n" +
                        BugSubmitter.FormatErrorMessage(ex), "FileWall", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }

                try
                {
                    _FormMain = new FormMain();

                    _ServiceGateway          = new ServiceGateway(new AdvSC("FileWallService"), new ServiceInterfaceManager());
                    _ServiceGateway.Started += ServiceGateway_Started;

                    _Presenter = new FormMainPresenter(_FormMain,
                                                       _ServiceGateway,
                                                       new LogViewModel(new EventLog("APAccess")));

                    // Start service if it's needed.
                    if (!_Presenter.ServiceGateway.IsStarted)
                    {
                        _Presenter.ServiceGateway.Start();
                    }
                    else
                    {
                        // Subscribing to events.
                        var accessRequestedWrapper = new AccessRequestedWrapper(_ServiceGateway.ServiceInterface);
                        accessRequestedWrapper.AccessRequested += AccessRequested;
                    }
                }
                catch (Exception ex)
                {
                    _BugReportPresenter.Show(ex);
                    return(false);
                }

                return(true);
            }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            var serviceInterface = (new ServiceInterfaceManager()).GetMarshalledInteface();

            var rules = serviceInterface.GetRuleset();

            AccessRequestedWrapper wrapper = new AccessRequestedWrapper(serviceInterface);

            wrapper.AccessRequested += serviceInterface_AccessRequested;
            button1.Enabled          = false;
        }
Example #3
0
            private void ServiceGateway_Started(object sender, EventArgs e)
            {
                var accessRequestedWrapper = new AccessRequestedWrapper(_ServiceGateway.ServiceInterface);

                accessRequestedWrapper.AccessRequested += AccessRequested;
            }