예제 #1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            NetworkCredentials.Instance().NetworkDomain   = Properties.Settings.Default.networkdomain;
            NetworkCredentials.Instance().NetworkUsername = Properties.Settings.Default.networkusername;
            NetworkCredentials.Instance().NetworkPassord  = Properties.Settings.Default.networkpassword;
            //NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
            //p.UncFileExist(@"\\DESKTOP-E9KNOCC\ciccio\ciccio.txt");

            //initialize skinning properties
            barManager.ForceInitialize();
            MyBarLocalizer.Active = new MyBarLocalizer();
            SkinHelper.InitSkinPopupMenu(mPaintStyle);


            //initialize navigator
            _navUtil = new NavigationUtils(splitContainerControl.Panel2, this);

            //renders startup controls
            if (_customerId == "")
            {
                _navUtil.NavigateToStartupControl(Properties.Settings.Default.Main_StartCommand);
            }
            else
            {
                try
                {
                    IOpenCommand cmd = new CustomerCommand(this);
                    Hashtable    h   = new Hashtable();
                    h.Add("Id", _customerId);
                    cmd.Execute(h);
                    HistoryOfCommands.Instance().AddCommandToHistory(cmd);
                    MemoryHelper.ReduceMemory();
                }
                catch (Exception ex)
                {
                    ErrorHandler.Show(ex);
                    _navUtil.NavigateToStartupControl(Properties.Settings.Default.Main_StartCommand);
                }
            }

            //sets the caption text
            this.Text = "Gestionale appuntamenti - " + Properties.Settings.Default.Main_AppName;

            //sets the name of the current logged user
            string nome = ((User)(SecurityManager.Instance.CurrentUser)).Username;

            sItem.Caption = string.Format("Benvenuto: {0}!", nome);

            if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
            {
                // barRipristina.Visibility = BarItemVisibility.Always;ù
                barButtonbackup.Visibility = BarItemVisibility.Always;
                UpdateLastBackInfo();
                barBack.Visibility = BarItemVisibility.Always;
            }
            else
            {
                //barRipristina.Visibility = BarItemVisibility.Never;
                barButtonbackup.Visibility = BarItemVisibility.Never;
                barBack.Visibility         = BarItemVisibility.Never;
            }



            //sets initial view
            splitContainerControl.Collapsed = Properties.Settings.Default.Main_PanelCollapsed;
            administration.Visible          = !Properties.Settings.Default.Main_ShowOnlyAgendaFunctions;
        }