示例#1
0
        void ReleaseDesignerOutlets()
        {
            if (CboKey != null)
            {
                CboKey.Dispose();
                CboKey = null;
            }

            if (CboServersScoringRule != null)
            {
                CboServersScoringRule.Dispose();
                CboServersScoringRule = null;
            }

            if (CboSpeedResolutions != null)
            {
                CboSpeedResolutions.Dispose();
                CboSpeedResolutions = null;
            }

            if (ChkLockedMode != null)
            {
                ChkLockedMode.Dispose();
                ChkLockedMode = null;
            }

            if (ChkRemember != null)
            {
                ChkRemember.Dispose();
                ChkRemember = null;
            }

            if (ChkServersLockCurrent != null)
            {
                ChkServersLockCurrent.Dispose();
                ChkServersLockCurrent = null;
            }

            if (ChkServersShowAll != null)
            {
                ChkServersShowAll.Dispose();
                ChkServersShowAll = null;
            }

            if (CmdAreasBlackList != null)
            {
                CmdAreasBlackList.Dispose();
                CmdAreasBlackList = null;
            }

            if (CmdAreasUndefined != null)
            {
                CmdAreasUndefined.Dispose();
                CmdAreasUndefined = null;
            }

            if (CmdAreasWhiteList != null)
            {
                CmdAreasWhiteList.Dispose();
                CmdAreasWhiteList = null;
            }

            if (CmdCancel != null)
            {
                CmdCancel.Dispose();
                CmdCancel = null;
            }

            if (CmdConnect != null)
            {
                CmdConnect.Dispose();
                CmdConnect = null;
            }

            if (CmdDisconnect != null)
            {
                CmdDisconnect.Dispose();
                CmdDisconnect = null;
            }

            if (CmdLogin != null)
            {
                CmdLogin.Dispose();
                CmdLogin = null;
            }

            if (CmdLogsClean != null)
            {
                CmdLogsClean.Dispose();
                CmdLogsClean = null;
            }

            if (CmdLogsCommand != null)
            {
                CmdLogsCommand.Dispose();
                CmdLogsCommand = null;
            }

            if (CmdLogsCopy != null)
            {
                CmdLogsCopy.Dispose();
                CmdLogsCopy = null;
            }

            if (CmdLogsOpenVpnManagement != null)
            {
                CmdLogsOpenVpnManagement.Dispose();
                CmdLogsOpenVpnManagement = null;
            }

            if (CmdLogsSave != null)
            {
                CmdLogsSave.Dispose();
                CmdLogsSave = null;
            }

            if (CmdLogsSupport != null)
            {
                CmdLogsSupport.Dispose();
                CmdLogsSupport = null;
            }

            if (CmdMainMenu != null)
            {
                CmdMainMenu.Dispose();
                CmdMainMenu = null;
            }

            if (CmdNetworkLock != null)
            {
                CmdNetworkLock.Dispose();
                CmdNetworkLock = null;
            }

            if (CmdProviderAdd != null)
            {
                CmdProviderAdd.Dispose();
                CmdProviderAdd = null;
            }

            if (CmdProviderEdit != null)
            {
                CmdProviderEdit.Dispose();
                CmdProviderEdit = null;
            }

            if (CmdProviderRemove != null)
            {
                CmdProviderRemove.Dispose();
                CmdProviderRemove = null;
            }

            if (CmdServersBlackList != null)
            {
                CmdServersBlackList.Dispose();
                CmdServersBlackList = null;
            }

            if (CmdServersConnect != null)
            {
                CmdServersConnect.Dispose();
                CmdServersConnect = null;
            }

            if (CmdServersMore != null)
            {
                CmdServersMore.Dispose();
                CmdServersMore = null;
            }

            if (CmdServersRefresh != null)
            {
                CmdServersRefresh.Dispose();
                CmdServersRefresh = null;
            }

            if (CmdServersRename != null)
            {
                CmdServersRename.Dispose();
                CmdServersRename = null;
            }

            if (CmdServersUndefined != null)
            {
                CmdServersUndefined.Dispose();
                CmdServersUndefined = null;
            }

            if (CmdServersWhiteList != null)
            {
                CmdServersWhiteList.Dispose();
                CmdServersWhiteList = null;
            }

            if (ImgConnectedCountry != null)
            {
                ImgConnectedCountry.Dispose();
                ImgConnectedCountry = null;
            }

            if (ImgNetworkLock != null)
            {
                ImgNetworkLock.Dispose();
                ImgNetworkLock = null;
            }

            if (ImgProgress != null)
            {
                ImgProgress.Dispose();
                ImgProgress = null;
            }

            if (ImgTopFlag != null)
            {
                ImgTopFlag.Dispose();
                ImgTopFlag = null;
            }

            if (ImgTopPanel != null)
            {
                ImgTopPanel.Dispose();
                ImgTopPanel = null;
            }

            if (LblConnect != null)
            {
                LblConnect.Dispose();
                LblConnect = null;
            }

            if (LblConnectedLocation != null)
            {
                LblConnectedLocation.Dispose();
                LblConnectedLocation = null;
            }

            if (LblConnectedServerName != null)
            {
                LblConnectedServerName.Dispose();
                LblConnectedServerName = null;
            }

            if (LblDevice != null)
            {
                LblDevice.Dispose();
                LblDevice = null;
            }

            if (LblKey != null)
            {
                LblKey.Dispose();
                LblKey = null;
            }

            if (LblLogin != null)
            {
                LblLogin.Dispose();
                LblLogin = null;
            }

            if (LblLoginIcon != null)
            {
                LblLoginIcon.Dispose();
                LblLoginIcon = null;
            }

            if (LblNetLockStatus != null)
            {
                LblNetLockStatus.Dispose();
                LblNetLockStatus = null;
            }

            if (LblPassword != null)
            {
                LblPassword.Dispose();
                LblPassword = null;
            }

            if (LblTopStatus != null)
            {
                LblTopStatus.Dispose();
                LblTopStatus = null;
            }

            if (LblVersion != null)
            {
                LblVersion.Dispose();
                LblVersion = null;
            }

            if (LblWaiting1 != null)
            {
                LblWaiting1.Dispose();
                LblWaiting1 = null;
            }

            if (LblWaiting2 != null)
            {
                LblWaiting2.Dispose();
                LblWaiting2 = null;
            }

            if (MnuAreasBlacklist != null)
            {
                MnuAreasBlacklist.Dispose();
                MnuAreasBlacklist = null;
            }

            if (MnuAreasUndefined != null)
            {
                MnuAreasUndefined.Dispose();
                MnuAreasUndefined = null;
            }

            if (MnuAreasWhitelist != null)
            {
                MnuAreasWhitelist.Dispose();
                MnuAreasWhitelist = null;
            }

            if (MnuLogsCopyAll != null)
            {
                MnuLogsCopyAll.Dispose();
                MnuLogsCopyAll = null;
            }

            if (MnuLogsCopySelected != null)
            {
                MnuLogsCopySelected.Dispose();
                MnuLogsCopySelected = null;
            }

            if (MnuLogsSaveAll != null)
            {
                MnuLogsSaveAll.Dispose();
                MnuLogsSaveAll = null;
            }

            if (MnuLogsSaveSelected != null)
            {
                MnuLogsSaveSelected.Dispose();
                MnuLogsSaveSelected = null;
            }

            if (MnuServersBlacklist != null)
            {
                MnuServersBlacklist.Dispose();
                MnuServersBlacklist = null;
            }

            if (MnuServersConnect != null)
            {
                MnuServersConnect.Dispose();
                MnuServersConnect = null;
            }

            if (MnuServersMore != null)
            {
                MnuServersMore.Dispose();
                MnuServersMore = null;
            }

            if (MnuServersRefresh != null)
            {
                MnuServersRefresh.Dispose();
                MnuServersRefresh = null;
            }

            if (MnuServersRename != null)
            {
                MnuServersRename.Dispose();
                MnuServersRename = null;
            }

            if (MnuServersUndefined != null)
            {
                MnuServersUndefined.Dispose();
                MnuServersUndefined = null;
            }

            if (MnuServersWhitelist != null)
            {
                MnuServersWhitelist.Dispose();
                MnuServersWhitelist = null;
            }

            if (MnuTray != null)
            {
                MnuTray.Dispose();
                MnuTray = null;
            }

            if (MnuTrayAbout != null)
            {
                MnuTrayAbout.Dispose();
                MnuTrayAbout = null;
            }

            if (MnuTrayClientArea != null)
            {
                MnuTrayClientArea.Dispose();
                MnuTrayClientArea = null;
            }

            if (MnuTrayConnect != null)
            {
                MnuTrayConnect.Dispose();
                MnuTrayConnect = null;
            }

            if (MnuTrayForwardingPorts != null)
            {
                MnuTrayForwardingPorts.Dispose();
                MnuTrayForwardingPorts = null;
            }

            if (MnuTrayHome != null)
            {
                MnuTrayHome.Dispose();
                MnuTrayHome = null;
            }

            if (MnuTrayPreferences != null)
            {
                MnuTrayPreferences.Dispose();
                MnuTrayPreferences = null;
            }

            if (MnuTrayQuit != null)
            {
                MnuTrayQuit.Dispose();
                MnuTrayQuit = null;
            }

            if (MnuTrayRestore != null)
            {
                MnuTrayRestore.Dispose();
                MnuTrayRestore = null;
            }

            if (MnuTraySpeedTest != null)
            {
                MnuTraySpeedTest.Dispose();
                MnuTraySpeedTest = null;
            }

            if (MnuTrayStatus != null)
            {
                MnuTrayStatus.Dispose();
                MnuTrayStatus = null;
            }

            if (MnuTrayUpdate != null)
            {
                MnuTrayUpdate.Dispose();
                MnuTrayUpdate = null;
            }

            if (PanelConnected != null)
            {
                PanelConnected.Dispose();
                PanelConnected = null;
            }

            if (PanelWaiting != null)
            {
                PanelWaiting.Dispose();
                PanelWaiting = null;
            }

            if (PanelWelcome != null)
            {
                PanelWelcome.Dispose();
                PanelWelcome = null;
            }

            if (PnlChart != null)
            {
                PnlChart.Dispose();
                PnlChart = null;
            }

            if (ServersContextMenu != null)
            {
                ServersContextMenu.Dispose();
                ServersContextMenu = null;
            }

            if (TableAreas != null)
            {
                TableAreas.Dispose();
                TableAreas = null;
            }

            if (TableLogs != null)
            {
                TableLogs.Dispose();
                TableLogs = null;
            }

            if (TableProviders != null)
            {
                TableProviders.Dispose();
                TableProviders = null;
            }

            if (TableServers != null)
            {
                TableServers.Dispose();
                TableServers = null;
            }

            if (TableStats != null)
            {
                TableStats.Dispose();
                TableStats = null;
            }

            if (TabMain != null)
            {
                TabMain.Dispose();
                TabMain = null;
            }

            if (TabOverview != null)
            {
                TabOverview.Dispose();
                TabOverview = null;
            }

            if (TxtCommand != null)
            {
                TxtCommand.Dispose();
                TxtCommand = null;
            }

            if (TxtConnectedDownload != null)
            {
                TxtConnectedDownload.Dispose();
                TxtConnectedDownload = null;
            }

            if (TxtConnectedExitIp != null)
            {
                TxtConnectedExitIp.Dispose();
                TxtConnectedExitIp = null;
            }

            if (TxtConnectedSince != null)
            {
                TxtConnectedSince.Dispose();
                TxtConnectedSince = null;
            }

            if (TxtConnectedUpload != null)
            {
                TxtConnectedUpload.Dispose();
                TxtConnectedUpload = null;
            }

            if (TxtLogin != null)
            {
                TxtLogin.Dispose();
                TxtLogin = null;
            }

            if (TxtPassword != null)
            {
                TxtPassword.Dispose();
                TxtPassword = null;
            }

            if (CmdUpdater != null)
            {
                CmdUpdater.Dispose();
                CmdUpdater = null;
            }
        }
示例#2
0
        public void RefreshUi(Engine.RefreshUiMode mode)
        {
            try
            {
                if ((mode == Engine.RefreshUiMode.MainMessage) || (mode == Engine.RefreshUiMode.Full))
                {
                    if (Engine.CurrentServer != null)
                    {
                        ImgTopFlag.Image = NSImage.ImageNamed("flag_" + Engine.CurrentServer.CountryCode.ToLowerInvariant() + ".png");
                    }
                    else
                    {
                        ImgTopFlag.Image = NSImage.ImageNamed("notconnected.png");
                    }

                    LblWaiting1.StringValue = Engine.WaitMessage;

                    if (Engine.IsWaiting())
                    {
                        ImgProgress.StartAnimation(this);
                        ImgTopPanel.Image        = NSImage.ImageNamed("topbar_osx_yellow.png");
                        MnuTrayStatus.Image      = NSImage.ImageNamed("status_yellow_16.png");
                        LblTopStatus.StringValue = Engine.WaitMessage;

                        TabOverview.SelectAt(1);

                        CmdCancel.Hidden       = (Engine.IsWaitingCancelAllowed() == false);
                        CmdCancel.Enabled      = (Engine.IsWaitingCancelPending() == false);
                        MnuTrayConnect.Enabled = CmdCancel.Enabled;
                    }
                    else if (Engine.IsConnected())
                    {
                        ImgProgress.StopAnimation(this);
                        ImgTopPanel.Image        = NSImage.ImageNamed("topbar_osx_green.png");
                        MnuTrayStatus.Image      = NSImage.ImageNamed("status_green_16.png");
                        LblTopStatus.StringValue = MessagesFormatter.Format(MessagesUi.TopBarConnected, Engine.CurrentServer.DisplayName);

                        TabOverview.SelectAt(2);

                        LblConnectedServerName.StringValue = Engine.CurrentServer.DisplayName;
                        LblConnectedLocation.StringValue   = Engine.CurrentServer.GetLocationForList();
                        TxtConnectedExitIp.StringValue     = Engine.ConnectedExitIP.ToString();
                        ImgConnectedCountry.Image          = NSImage.ImageNamed("flag_" + Engine.CurrentServer.CountryCode.ToLowerInvariant() + ".png");
                    }
                    else
                    {
                        ImgProgress.StopAnimation(this);
                        ImgTopPanel.Image   = NSImage.ImageNamed("topbar_osx_red.png");
                        MnuTrayStatus.Image = NSImage.ImageNamed("status_red_16.png");
                        if (Engine.Instance.NetworkLockManager.IsActive())
                        {
                            LblTopStatus.StringValue = MessagesUi.TopBarNotConnectedLocked;
                        }
                        else
                        {
                            LblTopStatus.StringValue = MessagesUi.TopBarNotConnectedExposed;
                        }

                        TabOverview.SelectAt(0);
                    }

                    // Icon update
                    if (StatusItem != null)
                    {
                        //string colorMode = GuiUtils.InterfaceColorMode ();
                        string colorMode = Engine.Storage.Get("gui.osx.style");

                        if (Engine.IsConnected())
                        {
                            StatusItem.Image = NSImage.ImageNamed("menubar_" + colorMode.ToLowerInvariant() + "_green.png");
                            //NSApplication.SharedApplication.DockTile. =  DateTime.Now.ToString ();
                            NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed("icon.png");
                        }
                        else
                        {
                            StatusItem.Image = NSImage.ImageNamed("menubar_" + colorMode.ToLowerInvariant() + "_red.png");
                            //NSApplication.SharedApplication.DockTile.Description =  DateTime.Now.ToString ();
                            NSApplication.SharedApplication.ApplicationIconImage = NSImage.ImageNamed("icon_gray.png");
                        }
                    }

                    EnabledUI();
                }

                if ((mode == Engine.RefreshUiMode.Log) || (mode == Engine.RefreshUiMode.Full))
                {
                    lock (Engine.LogsPending)
                    {
                        while (Engine.LogsPending.Count > 0)
                        {
                            LogEntry l = Engine.LogsPending[0];
                            Engine.LogsPending.RemoveAt(0);

                            Log(l);
                        }
                    }
                    LblWaiting2.StringValue = Engine.Logs.GetLogDetailTitle();
                }

                if ((mode == Engine.RefreshUiMode.Stats) || (mode == Engine.RefreshUiMode.Full))
                {
                    if (Engine.IsConnected())
                    {
                        TxtConnectedSince.StringValue = Engine.Stats.GetValue("VpnConnectionStart");

                        TxtConnectedDownload.StringValue = Core.Utils.FormatBytes(Engine.ConnectedLastDownloadStep, true, false);
                        TxtConnectedUpload.StringValue   = Core.Utils.FormatBytes(Engine.ConnectedLastUploadStep, true, false);

                        string msg  = Engine.Instance.GetConnectedTrayText(true, true);
                        string tmsg = Constants.Name + " - " + msg;
                        this.Window.Title   = tmsg;
                        MnuTrayStatus.Title = "> " + msg;

                        StatusItem.ToolTip = msg;
                        StatusItem.Title   = Engine.Instance.GetConnectedTrayText(Engine.Instance.Storage.GetBool("gui.osx.sysbar.show_speed"), Engine.Instance.Storage.GetBool("gui.osx.sysbar.show_server"));
                    }
                }

                if ((mode == Engine.RefreshUiMode.Full))
                {
                    if (TableServersController != null)
                    {
                        TableServersController.RefreshUI();
                    }
                    if (TableAreasController != null)
                    {
                        TableAreasController.RefreshUI();
                    }
                }
            }
            catch (Exception)
            {
                // TOFIX: OS X sometime throw an useless exception in closing phase
            }
        }
        public void RefreshUi(Engine.RefreshUiMode mode)
        {
            try
            {
                if ((mode == Engine.RefreshUiMode.MainMessage) || (mode == Engine.RefreshUiMode.Full))
                {
                    if (Engine.CurrentServer != null)
                    {
                        ImgTopFlag.Image = NSImage.ImageNamed("flag_" + Engine.CurrentServer.CountryCode.ToLowerInvariant() + ".png");
                    }
                    else
                    {
                        ImgTopFlag.Image = NSImage.ImageNamed("notconnected.png");
                    }

                    LblWaiting1.StringValue = Engine.WaitMessage;

                    if (Engine.IsWaiting())
                    {
                        ImgProgress.StartAnimation(this);
                        ImgTopPanel.Image        = NSImage.ImageNamed("topbar_osx_yellow.png");
                        MnuTrayStatus.Image      = NSImage.ImageNamed("status_yellow_16.png");
                        LblTopStatus.StringValue = Engine.WaitMessage;

                        TabOverview.SelectAt(1);

                        CmdCancel.Hidden       = (Engine.IsWaitingCancelAllowed() == false);
                        CmdCancel.Enabled      = (Engine.IsWaitingCancelPending() == false);
                        MnuTrayConnect.Enabled = CmdCancel.Enabled;
                    }
                    else if (Engine.IsConnected())
                    {
                        ImgProgress.StopAnimation(this);
                        ImgTopPanel.Image        = NSImage.ImageNamed("topbar_osx_green.png");
                        MnuTrayStatus.Image      = NSImage.ImageNamed("status_green_16.png");
                        LblTopStatus.StringValue = LanguageManager.GetText("TopBarConnected", Engine.CurrentServer.DisplayName);


                        TabOverview.SelectAt(2);

                        LblConnectedServerName.StringValue = Engine.CurrentServer.DisplayName;
                        LblConnectedLocation.StringValue   = Engine.CurrentServer.GetLocationForList();
                        TxtConnectedExitIp.StringValue     = Engine.ConnectionActive.ExitIPs.ToString();
                        ImgConnectedCountry.Image          = NSImage.ImageNamed("flag_" + Engine.CurrentServer.CountryCode.ToLowerInvariant() + ".png");
                    }
                    else
                    {
                        ImgProgress.StopAnimation(this);
                        ImgTopPanel.Image   = NSImage.ImageNamed("topbar_osx_red.png");
                        MnuTrayStatus.Image = NSImage.ImageNamed("status_red_16.png");
                        if (Engine.Instance.NetworkLockManager.IsActive())
                        {
                            LblTopStatus.StringValue = LanguageManager.GetText("TopBarNotConnectedLocked");
                        }
                        else
                        {
                            LblTopStatus.StringValue = LanguageManager.GetText("TopBarNotConnectedExposed");
                        }

                        TabOverview.SelectAt(0);
                    }
                }

                if ((mode == Engine.RefreshUiMode.Log) || (mode == Engine.RefreshUiMode.Full))
                {
                    lock (Engine.LogsPending)
                    {
                        while (Engine.LogsPending.Count > 0)
                        {
                            LogEntry l = Engine.LogsPending[0];
                            Engine.LogsPending.RemoveAt(0);

                            Log(l);
                        }
                    }
                    LblWaiting2.StringValue = Engine.Logs.GetLogDetailTitle();
                }

                if ((mode == Engine.RefreshUiMode.Stats) || (mode == Engine.RefreshUiMode.Full))
                {
                    if (Engine.IsConnected())
                    {
                        TxtConnectedSince.StringValue = Engine.Stats.GetValue("VpnStart");

                        TxtConnectedDownload.StringValue = LanguageManager.FormatBytes(Engine.ConnectionActive.BytesLastDownloadStep, true, false);
                        TxtConnectedUpload.StringValue   = LanguageManager.FormatBytes(Engine.ConnectionActive.BytesLastUploadStep, true, false);
                    }
                }

                if ((mode == Engine.RefreshUiMode.Full))
                {
                    if (TableServersController != null)
                    {
                        TableServersController.RefreshUI();
                    }
                    if (TableAreasController != null)
                    {
                        TableAreasController.RefreshUI();
                    }

                    CboKey.RemoveAllItems();
                    if ((Engine.Instance != null) && (Engine.Instance.AirVPN != null) && (Engine.Instance.AirVPN.User != null))
                    {
                        foreach (XmlElement xmlKey in Engine.Instance.AirVPN.User.SelectNodes("keys/key"))
                        {
                            string keyName = xmlKey.GetAttribute("name");
                            CboKey.AddItem(keyName);
                        }
                        string currentKey   = Engine.Instance.Storage.Get("key");
                        int    currentIndex = (int)CboKey.IndexOfItem(currentKey);
                        if (currentIndex != -1)
                        {
                            CboKey.SelectItem(currentIndex);
                        }
                    }
                }

                if ((mode == Engine.RefreshUiMode.MainMessage) || (mode == Engine.RefreshUiMode.Full))
                {
                    EnabledUI();
                }
            }
            catch (Exception)
            {
                // TOFIX: macOS sometime throw an useless exception in closing phase
            }
        }
示例#4
0
        public void RefreshUi(Engine.RefreshUiMode mode)
        {
            try
            {
                if ((mode == Engine.RefreshUiMode.MainMessage) || (mode == Engine.RefreshUiMode.Full))
                {
                    if (Engine.CurrentServer != null)
                    {
                        ImgTopFlag.Image = NSImage.ImageNamed("flag_" + Engine.CurrentServer.CountryCode.ToLowerInvariant() + ".png");
                    }
                    else
                    {
                        ImgTopFlag.Image = NSImage.ImageNamed("notconnected.png");
                    }

                    LblWaiting1.StringValue = Engine.WaitMessage;

                    if (Engine.IsWaiting())
                    {
                        ImgProgress.StartAnimation(this);
                        ImgTopPanel.Image        = NSImage.ImageNamed("topbar_osx_yellow.png");
                        MnuTrayStatus.Image      = NSImage.ImageNamed("status_yellow_16.png");
                        LblTopStatus.StringValue = Engine.WaitMessage;

                        TabOverview.SelectAt(1);

                        CmdCancel.Hidden       = (Engine.IsWaitingCancelAllowed() == false);
                        CmdCancel.Enabled      = (Engine.IsWaitingCancelPending() == false);
                        MnuTrayConnect.Enabled = CmdCancel.Enabled;
                    }
                    else if (Engine.IsConnected())
                    {
                        ImgProgress.StopAnimation(this);
                        ImgTopPanel.Image        = NSImage.ImageNamed("topbar_osx_green.png");
                        MnuTrayStatus.Image      = NSImage.ImageNamed("status_green_16.png");
                        LblTopStatus.StringValue = MessagesFormatter.Format(MessagesUi.TopBarConnected, Engine.CurrentServer.DisplayName);

                        TabOverview.SelectAt(2);

                        LblConnectedServerName.StringValue = Engine.CurrentServer.DisplayName;
                        LblConnectedLocation.StringValue   = Engine.CurrentServer.GetLocationForList();
                        TxtConnectedExitIp.StringValue     = Engine.ConnectionActive.ExitIPs.ToString();
                        ImgConnectedCountry.Image          = NSImage.ImageNamed("flag_" + Engine.CurrentServer.CountryCode.ToLowerInvariant() + ".png");
                    }
                    else
                    {
                        ImgProgress.StopAnimation(this);
                        ImgTopPanel.Image   = NSImage.ImageNamed("topbar_osx_red.png");
                        MnuTrayStatus.Image = NSImage.ImageNamed("status_red_16.png");
                        if (Engine.Instance.NetworkLockManager.IsActive())
                        {
                            LblTopStatus.StringValue = MessagesUi.TopBarNotConnectedLocked;
                        }
                        else
                        {
                            LblTopStatus.StringValue = MessagesUi.TopBarNotConnectedExposed;
                        }

                        TabOverview.SelectAt(0);
                    }

                    EnabledUI();
                }

                if ((mode == Engine.RefreshUiMode.Log) || (mode == Engine.RefreshUiMode.Full))
                {
                    lock (Engine.LogsPending)
                    {
                        while (Engine.LogsPending.Count > 0)
                        {
                            LogEntry l = Engine.LogsPending[0];
                            Engine.LogsPending.RemoveAt(0);

                            Log(l);
                        }
                    }
                    LblWaiting2.StringValue = Engine.Logs.GetLogDetailTitle();
                }

                if ((mode == Engine.RefreshUiMode.Stats) || (mode == Engine.RefreshUiMode.Full))
                {
                    if (Engine.IsConnected())
                    {
                        TxtConnectedSince.StringValue = Engine.Stats.GetValue("VpnStart");

                        TxtConnectedDownload.StringValue = UtilsString.FormatBytes(Engine.ConnectionActive.BytesLastDownloadStep, true, false);
                        TxtConnectedUpload.StringValue   = UtilsString.FormatBytes(Engine.ConnectionActive.BytesLastUploadStep, true, false);
                    }
                }

                if ((mode == Engine.RefreshUiMode.Full))
                {
                    if (TableServersController != null)
                    {
                        TableServersController.RefreshUI();
                    }
                    if (TableAreasController != null)
                    {
                        TableAreasController.RefreshUI();
                    }
                }
            }
            catch (Exception)
            {
                // TOFIX: macOS sometime throw an useless exception in closing phase
            }
        }