public DropDownBoxListWindow (IListDataProvider provider, WindowType windowType) : base (windowType)
		{
			this.DataProvider = provider;
			this.TransientFor = IdeApp.Workbench.RootWindow;
			this.TypeHint = Gdk.WindowTypeHint.Menu;
			this.Decorated = false;
			this.BorderWidth = 1;
			list = new ListWidget (this);
			list.SelectItem += delegate {
				var sel = list.Selection;
				if (sel >= 0 && sel < DataProvider.IconCount) {
					DataProvider.ActivateItem (sel);
					Destroy ();
				}
			};
			SetSizeRequest (list.WidthRequest, list.HeightRequest);
			vScrollbar = new ScrolledWindow ();
			vScrollbar.VScrollbar.SizeAllocated += (o, args) => {
				var minWidth = list.WidthRequest + args.Allocation.Width;
				if (this.Allocation.Width < minWidth)
					SetSizeRequest (minWidth, list.HeightRequest);
			};
			vScrollbar.Child = list;
			var vbox = new VBox ();
			vbox.PackStart (vScrollbar, true, true, 0);
			Add (vbox);
		}
        internal CustomShortcut(
            string shortcutName,
            string targetPath,
            string targetArguments,
            CustomShortcutType shortcutType,
            WindowType windowType,
            string shortcutRootFolder,
            string basicIconToUse = null,
            string workingFolder = null
            )
        {
            var vbsFolderPath =
                DirectoryUtils.GetUniqueDirName(CustomShortcutGetters.CustomShortcutVbsPath + shortcutName) + "\\";
            var shortcutPath = $"{shortcutRootFolder}{new DirectoryInfo(vbsFolderPath).Name}\\{shortcutName}.lnk";


            ShortcutName = shortcutName.CleanInvalidFilenameChars();
            ShortcutItem = new ShortcutItem(shortcutPath);
            TargetPath = targetPath;
            TargetArguments = targetArguments;
            ShortcutType = shortcutType;
            VbsFolderPath = vbsFolderPath;
            WorkingFolder = workingFolder;
            WindowType = windowType;

            Directory.CreateDirectory(VbsFolderPath);

            if (basicIconToUse != null && File.Exists(basicIconToUse)) BasicShortcutIcon = basicIconToUse;
        }
Beispiel #3
0
        public IceTabPageDCCFile(WindowType windowType, string sCaption)
            : base(windowType, sCaption)
        {
            InitializeComponent();

            dccFiles = new List<DccFileStruct>();
        }
        public static bool GetCurrentMediaItem(out MediaItem currentMediaItem, WindowType windowType)
        {
            currentMediaItem = new MediaItem();

            switch (windowType)
            {
                case WindowType.Movie:
                    return GetMovieMediaItem(ref currentMediaItem);

                case WindowType.Show:
                    return GetShowMediaItem(ref currentMediaItem);

                case WindowType.Season:
                    return GetSeasonMediaItem(ref currentMediaItem);

                case WindowType.Episode:
                    return GetEpisodeMediaItem(ref currentMediaItem);

                case WindowType.List:
                    return GetListMediaItem(ref currentMediaItem);

            }

            return false;
        }
Beispiel #5
0
 public Window(WindowType window_type)
     : base(window_type)
 {
     _context = SynchronizationContext.Current;
     CommunicationHandler.addReceiver(this);
     this.SetIconFromFile("masgau.ico");
 }
Beispiel #6
0
	public void SaveFile(String FilePath, String mainFolder) 
	{
		if(Directory.Exists(mainFolder))
		{
			if(File.Exists(FilePath) || Directory.Exists(FilePath))
			{
				WindowOpen = true;
				WinType = WindowType.Save;
				DragStat.Dragging = false;    // Ensure nothing is being draged.
				
				FileToSave = FilePath;
				
				MainFolder = mainFolder; // example: Application.dataPath/Saves;
				GetAllSubDirectoriesAndFiles( MainFolder );
				
				AddWidth();
				AddScrollPosition(0);
				AddPath(MainFolder, 0);
			}
			else Debug.LogError("I need a path for a temporary save file that actually exists!");
		}
		else
		{
			if(File.Exists(mainFolder)) Debug.LogError("I need a main directory, not a file!");
			else Debug.LogError("I need a path for a main directory that actually exists!");
		}
	}
        /// <summary>
        /// Displays content in a window
        /// </summary>
        /// <param name="windowTitle">Title text shown in window</param>
        /// <param name="windowContents">Contents of the window</param>        
        /// <param name="isModal">Determines wheter the window is modal or not</param>
        /// <param name="onClosingHandler">Event handler invoked when window is closing, and can be handled to cancel window closure</param>
        /// <param name="windowType">The type of the window</param>
        /// <param name="onClosedHandler">Event handler invoked when window is closed</param>
        /// <param name="top">The distance from the top of the application at which to position the window</param>
        /// <param name="left">The distance from the left of the application at which to position the window</param>
        /// <returns>The window</returns>
        public object ShowWindow(string windowTitle, FrameworkElement windowContents, bool isModal = false, 
            EventHandler<CancelEventArgs> onClosingHandler = null, EventHandler onClosedHandler = null, 
            WindowType windowType = WindowType.Floating, double? top = null, double? left = null)            
        {                        
            if (windowContents == null)
                throw new ArgumentNullException("windowContents");

            int hashCode = windowContents.GetHashCode();
            FloatingWindow floatingWindow = null;
            if (!m_FloatingWindows.TryGetValue(hashCode, out floatingWindow))
            {
                // not existing yet
                floatingWindow = new FloatingWindow()
                {
                    Title = windowTitle ?? string.Empty,
                };

                switch (windowType)
                {
                    case WindowType.Floating:
                if (FloatingWindowStyle != null)
                    floatingWindow.Style = FloatingWindowStyle;
                        break;
                    case WindowType.DesignTimeFloating:
                        if (DesignTimeWindowStyle != null)
                            floatingWindow.Style = DesignTimeWindowStyle;
                        else if (FloatingWindowStyle != null) // fallback to FloatingWindowStyle
                            floatingWindow.Style = FloatingWindowStyle;
                        break;
                }

                floatingWindow.Closed += (o, e) =>
                {
                    if (onClosedHandler != null)
                        onClosedHandler.Invoke(o, e);

                    m_FloatingWindows.Remove(hashCode);

                    if (floatingWindow != null)
                        floatingWindow.Content = null;
                };

                if (onClosingHandler != null)
                    floatingWindow.Closing += onClosingHandler;
                floatingWindow.Content = windowContents;
                m_FloatingWindows.Add(hashCode, floatingWindow);
            }


            if (top != null)
                floatingWindow.VerticalOffset = (double)top;

            if (left != null)
                floatingWindow.HorizontalOffset = (double)left;

            floatingWindow.Show(isModal);

            return floatingWindow;
        }
Beispiel #8
0
    public void OpenBugGUI()
    {
        _windowType = WindowType.BugWindow;
        _popUpError = true;

        if (GuiAllowScreenshot)
            _takeScreenshot = true;
    }
        public IceTabPageDCCFile(WindowType windowType, string sCaption, FormMain parent)
            : base(windowType, sCaption, parent)
        {
            InitializeComponent();
            this._parent = parent;

            dccFiles = new List<DccFileStruct>();
        }
Beispiel #10
0
		/**
		 * Returns window value for a given window type, size and position.
		 *
		 * Window is first looked up in cache. If it doesn't exist,
		 * it is generated. The cached value is then returned.
		 *
		 * @param type window function type
		 * @param n sample position in the window
		 * @param N window length
		 * @return window value for n-th sample
		 */
		public static double Apply(WindowType type, int n, int N)
		{
			KeyValuePair<WindowType, int> key = new KeyValuePair<WindowType, int>(type, N);
			
			if (!windowsCache.ContainsKey(key))
				CreateWindow(key);
			
			return windowsCache[key][n];
		}
Beispiel #11
0
 public static float[] MakeLowPassKernel(double sampleRate, int filterOrder, double cutoffFrequency, WindowType windowType)
 {
     filterOrder |= 1;
       float[] numArray = FilterBuilder.MakeSinc(sampleRate, cutoffFrequency, filterOrder);
       float[] window = FilterBuilder.MakeWindow(windowType, filterOrder);
       FilterBuilder.ApplyWindow(numArray, window);
       FilterBuilder.Normalize(numArray);
       return numArray;
 }
Beispiel #12
0
        public Window(Context ctx, WindowType type = WindowType.SCREEN_APPLICATION_WINDOW)
        {
            _context = ctx;

            if (type == WindowType.SCREEN_APPLICATION_WINDOW)
                this.CreateWindow();
            else
                this.CreateWindowType(type);
        }
Beispiel #13
0
        private RacerDetails(WindowType type)
        {
            InitializeComponent();
            
            _type = type;

            foreach(string rClass in DataManager.Settings.Classes)
            {
                cboClass.Items.Add(rClass);
            }
        }
Beispiel #14
0
        public Window(int width, int height, string title, WindowType type, int display, bool visible)
        {
            NativeWindow = new NativeWindow(width, height, title, GameWindowFlags.Default, GraphicsMode.Default, DisplayDevice.GetDisplay((DisplayIndex)display));
            NativeWindow.Closing += WindowClosing;
            NativeWindow.Resize += WindowResize;

            Keyboard = new Keyboard(this);
            Mouse = new Mouse(this);

            Type = type;
            Visible = visible;
        }
Beispiel #15
0
 public static float[] MakeBandPassKernel(double sampleRate, int filterOrder, double cutoff1, double cutoff2, WindowType windowType)
 {
     double cutoffFrequency = (cutoff2 - cutoff1) / 2.0;
       double num1 = 2.0 * Math.PI * (cutoff2 - cutoffFrequency) / sampleRate;
       float[] numArray = FilterBuilder.MakeLowPassKernel(sampleRate, filterOrder, cutoffFrequency, windowType);
       for (int index = 0; index < numArray.Length; ++index)
       {
     int num2 = index - filterOrder / 2;
     numArray[index] *= (float) (2.0 * Math.Cos(num1 * (double) num2));
       }
       return numArray;
 }
        public static float[] MakeLowPassKernel(double sampleRate, int filterOrder, double cutoffFrequency, WindowType windowType)
        {
            filterOrder |= 1;

            var h = MakeSinc(sampleRate, cutoffFrequency, filterOrder);
            var w = MakeWindow(windowType, filterOrder);

            ApplyWindow(h, w);

            Normalize(h);

            return h;
        }
 private void ToolWindow_DockStateChanged(object sender, EventArgs e)
 {
     if (DockState == DockState.Document)
     {
         this.TabPageContextMenuStrip = DocumentContextMenu;
         windowType = WindowType.Document;
     }
     else
     {
         this.TabPageContextMenuStrip = ToolWindowContextMenu;
         windowType = WindowType.Tool;
     }
 }
Beispiel #18
0
 public static Complex[] MakeComplexKernel(double sampleRate, int filterOrder, double bandwidth, double offset, WindowType windowType)
 {
     double num1 = 2.0 * Math.PI * offset / sampleRate;
       float[] numArray = FilterBuilder.MakeLowPassKernel(sampleRate, filterOrder, bandwidth * 0.5, windowType);
       Complex[] complexArray = new Complex[numArray.Length];
       for (int index = 0; index < complexArray.Length; ++index)
       {
     int num2 = index - filterOrder / 2;
     double num3 = num1 * (double) num2;
     complexArray[index].Real = numArray[index] * (float) Math.Cos(num3);
     complexArray[index].Imag = (float) (-(double) numArray[index] * Math.Sin(num3));
       }
       return complexArray;
 }
Beispiel #19
0
        public static void sendTo(Expr expr, Image image, WindowType windowType)
        {
            copyToClipBoard(expr, image);

            if (windowType == WindowType.WindowTypeQQ) {
                Process qqProcess = Process.GetProcessesByName("QQ").FirstOrDefault();
                if (qqProcess != null)
                {
                    IntPtr qqHandle = qqProcess.MainWindowHandle;
                    Console.Out.WriteLine(qqProcess.ProcessName);
                    SetForegroundWindow(qqHandle);
                    SendKeys.SendWait("^V");
                }
                else
                {
                    MessageBox.Show("找不到QQ窗口", "发送失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else if (windowType == WindowType.WindowTypeWeChat)
            {
                Process weChatProcess = Process.GetProcessesByName("WeChat").FirstOrDefault();
                if (weChatProcess != null)
                {
                    IntPtr weChatHandle = weChatProcess.MainWindowHandle;
                    Console.Out.WriteLine(weChatProcess.ProcessName);
                    SetForegroundWindow(weChatHandle);
                    SendKeys.SendWait("^V");
                }
                else
                {
                    MessageBox.Show("找不到微信窗口", "发送失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            // Update recently used exprs
            List<Expr> recentlyUsedExprs = SettingUtility.getRecentlyUsedExprs();
            for (int i = 0; i < recentlyUsedExprs.Count; i++)
            {
                if (recentlyUsedExprs[i].id == expr.id)
                {
                    recentlyUsedExprs.Remove(recentlyUsedExprs[i]);
                }
            }
            recentlyUsedExprs.Insert(0, expr);
            SettingUtility.setRecentlyUsedExprs(recentlyUsedExprs);
            if (SettingUtility.exprsDisplayer != null)
            {
                SettingUtility.exprsDisplayer.loadRecentlyUsedExprs();
            }
        }
Beispiel #20
0
        byte type; //This holds type information, used in deciding which kind of window we need to send.

        #endregion Fields

        #region Constructors

        public Windows(WindowType type, Point3 pos, World world, Player p)
        {
            try
            {
                id = FreeId();
                this.type = (byte)type;
                this.p = p;

                switch (Type)
                {
                    case WindowType.Chest:
                        name = "Chest"; //We change this to "Large Chest" Later if it needs it :3
                        container = world.GetBlockContainer(pos);
                        items = container.Items;
                        container.AddPlayer(p);
                        break;
                    case WindowType.Dispenser:
                        name = "Workbench";
                        //container = world.GetBlockContainer(pos); // We don't have a container for this yet.
                        items = new Item[9];
                        break;
                    case WindowType.Furnace:
                        name = "Furnace";
                        //container = world.GetBlockContainer(pos); // We don't have a container for this yet.
                        items = new Item[3];
                        break;
                    case WindowType.Workbench:
                        name = "Dispenser";
                        items = new Item[10];
                        break;
                    case WindowType.EnchantmentTable:
                        name = "Enchant";
                        items = new Item[1];
                        break;
                    case WindowType.BrewingStand:
                        name = "Brewing Stand";
                        //container = world.GetBlockContainer(pos); // We don't have a container for this yet.
                        items = new Item[4];
                        break;
                }

                if (Type == WindowType.Workbench || Type == WindowType.EnchantmentTable)
                {
                    for (int i = 0; i < InventorySize; i++)
                        items[i] = Item.Nothing;
                }
            }
            catch { Logger.Log("Error making window!"); }
        }
Beispiel #21
0
 //public Window () : this (Context.GetInstance (ContextType.Application)) {}
 //public Window (WindowType type) : this (Context.GetInstance (ContextType.Application), type) {}
 public Window(Context ctx, WindowType type = WindowType.SCREEN_APPLICATION_WINDOW)
 {
     context = ctx;
     if (screen_create_window_type (out handle, ctx.Handle, type) != 0) {
         throw new Exception ("Unable to create window");
     }
     if (type != WindowType.SCREEN_APPLICATION_WINDOW &&
         type != WindowType.SCREEN_CHILD_WINDOW) {
         return;
     }
     if (screen_create_window_group (handle, handle.ToString ()) != 0) {
         throw new Exception ("Unable to create window group");
     }
     context.RegisterWindow (this);
 }
        public static float[] MakeBandPassKernel(double sampleRate, int filterOrder, double cutoff1, double cutoff2, WindowType windowType)
        {
            var bw = (cutoff2 - cutoff1) / 2;
            var fshift = cutoff2 - bw;
            var shiftRadians = 2 * Math.PI * fshift / sampleRate;

            var h = MakeLowPassKernel(sampleRate, filterOrder, bw, windowType);

            for (var i = 0; i < h.Length; i++)
            {
                var n = i - filterOrder / 2;
                h[i] *= (float) (2 * Math.Cos(shiftRadians * n));
            }
            return h;
        }
        public void OpenConfirmWindow(
			WindowType type,
			string text,
			bool reset,
			string buttonCmd)
        {
            MainContent.Visible = false;
            confirmWindowSwitch.Visible = true;

            confirmTitle.InnerText = type.ToString();
            confirmText.InnerHtml = text;

            switch (type)
            {
                case (WindowType.Confirm):
                {
                    closeConfirmWindowButton.Text = "Cancel";
                    confirm.CommandArgument = buttonCmd;
                }
                break;

                case (WindowType.Error):
                {
                    if (buttonCmd == string.Empty)
                    {
                        confirm.Visible = false;

                        break;
                    }

                    closeConfirmWindowButton.Text = "Cancel";
                    confirm.CommandArgument = buttonCmd;
                }
                break;

                default:
                {
                    confirm.Visible = false;
                }
                break;
            }

            if (!reset) return;

            closeConfirmWindowButton.CommandArgument = true.ToString();
        }
Beispiel #24
0
		public static IFirFilter CalcLinearBPFCoefficient(FirFilterType type, double w, double w0, int taps, WindowType window)
		{
			double[] coef;

			if(taps % 2 == 1)
			{
				coef = new double[(taps + 1) / 2];
				CalcOddLinearBPFCoefficient(type, coef, w, w0, GetWindow(window, taps));
				return new OddLinearFir(coef);
			}
			else
			{
				coef = new double[taps / 2];
				CalcEvenLinearBPFCoefficient(type, coef, w, w0, GetWindow(window, taps));
				return new EvenLinearFir(coef);
			}
		}
Beispiel #25
0
 public static double[] getWindow(WindowType type, int length)
 {
     switch (type)
     {
         case WindowType.BLACKMAN:
             return getBlackmanWindow(length);
         case WindowType.COSINE:
             return getCosineWindow(length);
         case WindowType.HAMMING:
             return getHammingWindow(length);
         case WindowType.HANNING:
             return getHanningWindow(length);
         case WindowType.NONE:
         default:
             return getRectangularWindow(length);
     }
 }
Beispiel #26
0
    public static GameObject CreateWindowOfType(WindowType windowType)
    {
        GameObject windowGameObj;

        switch (windowType)
        {
            case WindowType.PauseWindow:
                windowGameObj = Resources.Load<GameObject>("PauseMenu");
                break;

            default:
                windowGameObj = null;
                Debug.Log("Error loading window resources.");
                break;
        }

        return windowGameObj;
    }
Beispiel #27
0
    public static string GetWindowTypeName(WindowType windowType)
    {
        string windowTypeName;

        switch(windowType)
        {
            case WindowType.PauseWindow:
               windowTypeName = "PauseWindow";
               break;

            default:
               Debug.Log("Error Renaming Window.");
               windowTypeName = "";
               break;
        }

        return windowTypeName;
    }
Beispiel #28
0
        private double[] CalculateFrequencyCentroid(WindowType windowType, int frameLength, double overlap)
        {
            var binWidth = sampleRate / frameLength;

            var data = ForEachFrame(windowType, frameLength, overlap, (double[] sample, int idx) => {
                sample = sample.Take(frameLength / 2).ToArray();

                double limiter = 0;
                for (int i = 0; i < sample.Length; i++)
                {
                    limiter += i * binWidth * sample[i];
                }

                var denominator = sample.Sum();
                return(limiter / denominator);
            });

            return(data);
        }
Beispiel #29
0
        public override void Execute(object parameter)
        {
            if (_mapBehaviorsList == null)
            {
                _mapBehaviorsList = new MapBehaviorsList()
                {
                    Margin = new Thickness(10, 15, 10, 5)
                };
            }
            _mapBehaviorsList.IsEdit = IsEdit;
            WindowType windowType = MapApplication.Current.IsEditMode ? WindowType.DesignTimeFloating :
                                    WindowType.Floating;

            MapApplication.Current.ShowWindow(LocalizableStrings.GetString("MapBehaviors"), _mapBehaviorsList, false, null,
                                              (sender, e) =>
            {
                _mapBehaviorsList = null;
            }, windowType);
        }
Beispiel #30
0
    /// <summary>
    /// Compute Fast Fourier Transform of (complex) data, in place.
    /// </summary>
    public static void transform(decimal[] data)
    {
          switch (Window)
          {
              case WindowType.Normal:
                  Window = WindowType.Hamming;
                  break;
              case WindowType.Hamming:
                  Window = WindowType.Hanning;
                  Hamming(data);
                  break;
              case WindowType.Hanning:
                  Window = WindowType.Normal;
                  Hann(data);
                  break;
          }

          transform_internal(data, -1);
    }
        private void PrepareWindow(int windowSize, WindowType windowType)
        {
            mWindowType = windowType;

            switch (windowType)
            {
            case WindowType.Bartlett:
                mWindow = WWWindowFunc.BartlettWindow(mProcessBlockSize + 1);
                break;

            case WindowType.Hann:
                mWindow = WWWindowFunc.HannWindow(mProcessBlockSize + 1);
                break;

            default:
                System.Diagnostics.Debug.Assert(false);
                break;
            }
        }
Beispiel #32
0
		/**
		 * Converts one of the WindowType enumeration values to its name.
		 *
		 * @param type window type as an enum
		 * @return window function name
		 */
		public static string WindowTypeToString(WindowType type)
		{
			switch (type)
			{
				case WindowType.WIN_RECT:
					return "Rectangular";
				case WindowType.WIN_HAMMING:
					return "Hamming";
				case WindowType.WIN_HANN:
					return "Hann";
				case WindowType.WIN_BLACKMAN:
					return "Blackman";
				case WindowType.WIN_BARLETT:
					return "Barlett";
				case WindowType.WIN_FLATTOP:
					return "Flat-top";
			}
			return "Unknown";
		}
Beispiel #33
0
        public void PlotSpectogram(PlotView view, WindowType windowType, int frameLength, double overlap)
        {
            var span    = (int)Math.Round(frameLength * (1.0 - overlap));
            int columns = waveList.Count / span;
            var data    = new double[columns, frameLength / 2];

            for (int i = 0, beginPoint = 0; i < columns; i++, beginPoint += span)
            {
                var sample = GetSample(frameLength, beginPoint);
                var fft    = new FFTWrapper(sample);
                var result = fft.CalculateMagnitude(windowType);
                for (int y = 0; y < frameLength / 2; y++)
                {
                    data[i, y] = 20 * Math.Log10(result[y]);
                }
            }

            FillSpectogram(view, data);
        }
Beispiel #34
0
    //切换公共窗口
    public void SwitchingPublicWindow(WindowType type)
    {
        m_curWindowType = type;
        iTalkToWorldID  = 0;
        m_buttonsDict.ApplyAllItem(p => {
            if (p.Key == type)
            {
                //更新按钮状态
                p.Value.SetBoxCollider(false);
                p.Value.SetSwith(2);
                //更新面板显示
                if (!m_windowDict.ContainsKey(type))
                {
                    //初始化
                    InitPublicWindow(type, ChatRecordManager.Instance.GetPublicChatRecordList(type));
                }
                m_windowDict[type].Show();
            }
            else
            {
                p.Value.SetBoxCollider(true);
                p.Value.SetSwith(1);

                if (m_windowDict.ContainsKey(p.Key))
                {
                    m_windowDict[p.Key].Close();
                }
            }
        });

        //界面功能
//		bool isWorldWindow = type == WindowType.World;
//		if(isWorldWindow)
//		{
//			int itemNum = ContainerInfomanager.Instance.GetItemNumber(CommonDefineManager.Instance.CommonDefine.WorldChatItem);
//			Label_SpeakerNum.text = itemNum.ToString();
//			Label_SpeakerNum.color = itemNum>0?new Color(1f,0.98f,0.435f):Color.red;
//		}
        //Speaker.SetActive(isWorldWindow);
        Button_Send.gameObject.SetActive(type != WindowType.System);
        Input_Chat.gameObject.SetActive(type != WindowType.System);
    }
        public DropDownBoxListWindow(IListDataProvider provider, WindowType windowType) : base(windowType)
        {
            Accessible.Name = "DropDownBoxListWindow";

            this.DataProvider = provider;
            this.TransientFor = IdeApp.Workbench.RootWindow;
            this.TypeHint     = Gdk.WindowTypeHint.DropdownMenu;
            this.Decorated    = false;
            this.BorderWidth  = 1;
            list = new ListWidget(this);
            list.Accessible.Name = "DropDownBoxListWindow.List";

            list.SelectItem += delegate {
                var sel = list.Selection;
                if (sel >= 0 && sel < DataProvider.IconCount)
                {
                    try {
                        DataProvider.ActivateItem(sel);
                        // This is so parent window of dropdown regains focus
                        TransientFor?.Present();
                    } catch (Exception ex) {
                        LoggingService.LogInternalError("Offset seems to be out of sync with the snapshot.", ex);
                    }

                    Destroy();
                }
            };
            SetSizeRequest(list.WidthRequest + WidthModifier, list.HeightRequest);
            vScrollbar = new ScrolledWindow();
            vScrollbar.VScrollbar.SizeAllocated += (o, args) => {
                var minWidth = list.WidthRequest + args.Allocation.Width;
                if (this.Allocation.Width < minWidth)
                {
                    SetSizeRequest(minWidth, list.HeightRequest);
                }
            };
            vScrollbar.Child = list;
            var vbox = new VBox();

            vbox.PackStart(vScrollbar, true, true, 0);
            Add(vbox);
        }
Beispiel #36
0
 public BookViewModel(WindowType type, Book book)
 {
     Locations = new ObservableCollection <string>();
     Locations.Add("Jaworzno");
     Locations.Add("Miedźno");
     AddEditCommand = new RelayCommand(AddEditCommandExecute);
     CancelCommand  = new RelayCommand(CancelCommandExecute);
     if (type == Models.WindowType.NewRecord)
     {
         Book               = new Book();
         WindowType         = "Nowa książka";
         Book.OwnershipDate = DateTime.Now;
         Book.Location      = "Jaworzno";
     }
     else
     {
         WindowType = "Edycja książki";
         Book       = book;
     }
 }
Beispiel #37
0
        public async Task OpenConfiguration(
            DataProvider dataProvider, byte selectedTabIndex = 0,
            WindowType hostIdentifier = WindowType.Root)
        {
            try
            {
                var viewModel = new ConfigViewModel(dataProvider)
                {
                    SelectedTabIndex = selectedTabIndex
                };
                var view = new ConfigDialog {
                    ViewModel = viewModel
                };

                await DialogHost.Show(view, Common.GetEnumDescription(hostIdentifier));
            }
            catch (Exception e)
            {
            }
        }
Beispiel #38
0
        public static WindowFunction GetWindow(WindowType type, int order)
        {
            switch (type)
            {
            case WindowType.Hamming:
                return(new WindowFunction(new Window.Hamming(order).Get));

            case WindowType.Hanning:
                return(new WindowFunction(new Window.Hanning(order).Get));

            case WindowType.Blackman:
                return(new WindowFunction(new Window.Blackman(order).Get));

            case WindowType.Keiser:
                return(new WindowFunction(new Window.Keiser(order, 20).Get));

            default:
                return(new WindowFunction(Constant1));
            }
        }
        public MainWindow()
        {
            InitializeComponent();

            Library.Init();

            _browser = new EyeTrackerBrowser();
            _browser.EyeTrackerFound += _browser_EyetrackerFound;
            _browser.EyeTrackerRemoved += _browser_EyetrackerRemoved;
            _browser.EyeTrackerUpdated += _browser_EyetrackerUpdated;

            MapControll.ZoneHaveChanged += MapControll_ZoneHaveChanged;

            _initialHeadPos = new Point3D(0, 0, 0);
            _headPos = new Point3D(0, 0, 0);

            windowType = WindowType.Map;


        }
    //Main Function
    public Window CreateWindow(WindowType type, string openParam, object closeParam, Window.VoidHandle openHandle)
    {
        Window wnd = WindowManager.instance.FindWindow(type);

        if (wnd != null)
        {
            wnd.show = true;
            if (openHandle != null)
            {
                openHandle();
            }
            wnd.Show();
        }
        else
        {
            wnd = UIHelper.CreateWindow(type, openParam, closeParam, openHandle);
        }

        return(wnd);
    }
Beispiel #41
0
    private bool InitWindow <T>(WindowType type, T data = default, string message = null, Action noCallBack = null,
                                Action yesCallBack      = null)
    {
        // UpdateContainer();
        var        path         = string.Format(PathUtils.windowPath, type.ToString().ToLower());
        BaseWindow windowPrefab = Resources.Load <BaseWindow>(path);
        BaseWindow window       = Instantiate(windowPrefab, uiMainCanvas);

        windowList.Add(window.type, window);
        if (window != null)
        {
            BaseWindowGeneric <T> _window = window as BaseWindowGeneric <T>;
            _window.SetupData(data, message, noCallBack, yesCallBack);
            _window.transform.SetAsLastSibling();
            _window.OnShow();
            return(true);
        }

        return(false);
    }
Beispiel #42
0
        public IEnumerator CreateWindowsAnyn(WindowType type, bool isResource = false)
        {
            if (!goPool.ContainsKey(type))
            {
                if (!isResource)
                {
                    var assetbundleReq = AssetBundleManager.Instance.LoadAssetAsynCoro <GameObject>(WindowPrefabPath, type.ToString());
                    yield return(assetbundleReq);

                    goPool.Add(type, assetbundleReq.asset as GameObject);
                }
                else
                {
                    var req = Resources.LoadAsync <GameObject>(WindowPrefabPath + "/" + type.ToString());
                    yield return(req);

                    goPool.Add(type, req.asset as GameObject);
                }
            }
        }
Beispiel #43
0
 public CompletionListWindow(WindowType type = WindowType.Popup) : base(type)
 {
     if (IdeApp.Workbench != null)
     {
         this.TransientFor = IdeApp.Workbench.RootWindow;
     }
     TypeHint       = Gdk.WindowTypeHint.Combo;
     SizeAllocated += new SizeAllocatedHandler(ListSizeChanged);
     Events         = Gdk.EventMask.PropertyChangeMask;
     WindowTransparencyDecorator.Attach(this);
     DataProvider = this;
     HideDeclarationView();
     List.ListScrolled += (object sender, EventArgs e) => {
         HideDeclarationView();
         UpdateDeclarationView();
     };
     List.WordsFiltered += delegate {
         RepositionDeclarationViewWindow();
     };
 }
        /* STFTCalculator initialization
         * + LAYOUT:
         *      - Initialize the first few parameters necessary to calculate FFT
         *      - Check for validity of frequency range for LBP calculation
         *      - Generate frequency vector
         *      - Generate taper window
         *      - Initialize LBP alarm level array
         *      - Configure saving options
         * + INPUT:
         *      - Fs:               sampling frequency
         *      - n_epoch:          number of data points to calculate FFT
         *      - n_skip:           number of data points skipped between different FFT calculated epochs
         *      - n_lvls:           number of alarm levels
         *      - BPFR:             range of frequency band to calculate power as LBP
         *      - win_type:         type of taper to use; [default]`WindowType.Rectangle` means no taper
         *      - scaling_psd:      option to scale power spectral density, [default]"true"
         *      - file_prefix:      prefix of file to save STFT calculation to, [default]"" (empty)
         *      - saving_option:    option to save the STFT calculation to, [default]"false" for performance
         *                          with the current implementation to save the file to
         */
        public STFTCalculator(double Fs, int n_epoch, int n_skip, int n_lvls, double[] BPFR,
                              WindowType win_type = WindowType.Rectangle, bool scaling_psd = true,
                              string file_prefix  = "", bool saving_option = false)
        {
            Configure_STFT_Parameters(Fs, n_epoch, n_skip);

            current_count = 0;
            ready2plt     = false;
            data_array    = new double[n_epoch];

            Configure_Frequency_Range(BPFR);
            GenerateFrequencyVector();
            GenerateWindow(win_type, scaling_psd);

            this.n_lvls = n_lvls;
            Reset_Level_Tally();

            this.saving_option = saving_option;
            Configure_Saving_Options(file_prefix);
        }
Beispiel #45
0
        public virtual Window Show(object viewModel, WindowType windowType, Window?owner = null)
        {
            if (viewModel is null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            Window window = GetWindow(viewModel, owner);

            if (windowType == WindowType.Dialog)
            {
                window.ShowDialog();
            }
            else
            {
                window.Show();
            }

            return(window);
        }
Beispiel #46
0
    public WindowUIMenu(WindowImage wimg, WindowType wtype, List <string> wbuttons, string wtitle, string werror, bool wexit, int id, ExitDefault ex)
    {
        //GameObject unityHook = GameObject.Find("WindowUI");
        uh = Resources.FindObjectsOfTypeAll <UnityHook>()[0];
        // uh = (UnityHook) unityHook.GetComponent(typeof(UnityHook));
        wum      = new WindowUIManager(uh);
        windowUI = uh.windowUI;

        uh.activeMenu = this;

        img             = wimg;
        type            = wtype;
        buttons         = wbuttons;
        title           = wtitle;
        error           = werror;
        exit            = wexit;
        this.ex         = ex;
        this.id         = id;
        this.background = false;
    }
Beispiel #47
0
    public void CloseWindow(WindowID windowID)
    {
        BaseWindow window = mAllWindows[windowID];

        if (window == null)
        {
            return;
        }
        WindowType type = window.Type;

        window.Close();
        List <BaseWindow> list = null;

        mOpenWindows.TryGetValue(type, out list);
        if (list != null)
        {
            list.Remove(window);
        }
        DealWindowStack(window, false);
    }
Beispiel #48
0
 public object ShowWindow(string windowTitle, FrameworkElement windowContents, bool isModal    = false,
                          EventHandler <System.ComponentModel.CancelEventArgs> onHidingHandler = null,
                          EventHandler onHideHandler = null, WindowType windowType = WindowType.Floating,
                          double?top = null, double?left = null)
 {
     if (WindowManager == null)
     {
         WindowManager = new ESRI.ArcGIS.Mapping.Controls.WindowManager()
         {
             FloatingWindowStyle = Application.Current.Resources["BuilderWindowStyle"] as Style
         }
     }
     ;
     else if (WindowManager.FloatingWindowStyle == null)
     {
         WindowManager.FloatingWindowStyle = Application.Current.Resources["BuilderWindowStyle"] as Style;
     }
     return(WindowManager.ShowWindow(windowTitle, windowContents, isModal, onHidingHandler, onHideHandler,
                                     windowType, top, left));
 }
Beispiel #49
0
    public WindowComponent SwitchWindow(WindowType type)
    {
        WindowComponent desiredWindow = FindWindowOfType(type);

        if (desiredWindow != null)
        {
            if (desiredWindow.gameObject.activeInHierarchy)
            {
                desiredWindow.CloseWindow();
                return(null);
            }
            else
            {
                CloseWindows();
                desiredWindow.gameObject.SetActive(true);
                return(desiredWindow);
            }
        }
        return(null);
    }
Beispiel #50
0
        public AddEditGroup(WindowType windowType, IGroupsRepository groups)
        {
            InitializeComponent();

            groupsRepository = groups;

            // Initialize and data-bind to ViewModel
            AddEditGroupViewModel = new AddEditGroupViewModel(groups);
            this.DataContext      = AddEditGroupViewModel;

            // Set UI title
            if (windowType == WindowType.AddGroup)
            {
                this.Title = "Add Group";
            }
            else if (windowType == WindowType.EditGroup)
            {
                this.Title = "Edit Group";
            }
        }
Beispiel #51
0
        public static double[] ApplyLowFilter(double[] source, double fc, int N, WindowType window)
        {
            var result = new double[source.Length];
            var w      = GenerateWeights(window, N);
            var h      = GenerateH(fc, N);

            for (int k = 0; k < source.Length; k++)
            {
                int windowN = N;
                if (k + 1 < N)
                {
                    windowN = k + 1;
                }
                for (int m = 0; m < windowN; m++)
                {
                    result[k] += w[m] * source[k - m] * h[m];
                }
            }
            return(result);
        }
Beispiel #52
0
        private IWindow GetWindowByType(WindowType type)
        {
            switch (type)
            {
            case WindowType.BarometricPressureHistory:
                return(_windowFactory.CreateBarPressureHistory());

            case WindowType.TemperatureHistory:
                return(_windowFactory.CreateTemperatureHistory());

            case WindowType.UnitSettings:
                return(_windowFactory.CreateUnitSettingsWindow());

            case WindowType.MainWindow:
                return(_windowFactory.CreateMainWindow());

            case WindowType.DateAndTimeSettings:
                return(_windowFactory.CreateDateAndTimeSettingsWindow());
            }
            throw new NotSupportedException();
        }
Beispiel #53
0
        /// <summary>
        /// <para>Computes the power spectrum of input time-domain signal.</para>
        /// <para>Chinese Simplified: 计算输入信号的功率频谱。</para>
        /// </summary>
        /// <param name="x">
        /// <para>input time-domain signal.</para>
        /// <para>Chinese Simplified: 输入的时域波形。</para>
        /// </param>
        /// <param name="samplingRate">
        /// <para>sampling rate of the input time-domain signal, in samples per second.</para>
        /// <para>Chinese Simplified: 输入信号的采样率,以S/s为单位。</para>
        /// </param>
        /// <param name="spectrum">
        /// <para>output sequence containing the power spectrum.</para>
        /// <para>Chinese Simplified: 输出功率谱。</para>
        /// </param>
        /// <param name="df">
        /// <para>the frequency resolution of the spectrum,  in hertz.</para>
        /// <para>Chinese Simplified: 功率谱的频谱间隔,以Hz为单位。</para>
        /// </param>
        /// <param name="unitSettings">
        /// <para>unit settings of the output power spectrum</para>
        /// <para>Chinese Simplified: 设置功率谱的单位。</para>
        /// </param>
        /// <param name="windowType">
        /// <para>the time-domain window to apply to the time signal.</para>
        /// <para>Chinese Simplified: 窗类型。</para>
        /// </param>
        /// <param name="windowPara">
        /// <para>parameter for a Kaiser/Gaussian/Dolph-Chebyshev window, If window is any other window, this parameter is ignored</para>
        /// <para>Chinese Simplified: 窗调整系数,仅用于Kaiser/Gaussian/Dolph-Chebyshev窗。</para>
        /// </param>
        public static void PowerSpectrum(double[] x, double samplingRate, ref double[] spectrum, out double df,
                                         UnitConvSetting unitSettings, WindowType windowType, double windowPara)
        {
            int          spectralLines = spectrum.Length; //谱线数是输出数组的大小
            SpectralInfo spectralInfo  = new SpectralInfo();

            AdvanceRealFFT(x, spectralLines, windowType, spectrum, ref spectralInfo);

            double scale = 1.0 / spectralInfo.FFTSize;

            //CBLASNative.cblas_dscal(spectralLines, scale, spectrum, 1);
            for (int i = 0; i < spectrum.Length; i++)
            {
                spectrum[i] = spectrum[i] * scale;
            }

            df = 0.5 * samplingRate / spectralInfo.spectralLines; //计算频率间隔

            //Unit Conversion
            UnitConversion(spectrum, df, SpectrumType.Amplitude, unitSettings, Window.WindowENBWFactor[(int)windowType]);
        }
Beispiel #54
0
        void MainMenuUIClick(MouseEvent mouseEvent)
        {
            CameraController cameraController = Camera.main.GetComponent <CameraController>();

            if (mouseEvent.srcElement.className.Contains("CloseMenu"))
            {
                UI.document.getElementsByClassName("menu")[0].innerHTML = "";
                selectedWindowType = WindowType.None;
            }
            else if (mouseEvent.srcElement.className.Contains("GoToMainMenu"))
            {
                UI.document.Run("CreateLoadingScreen", "Leave");
                PhotonNetwork.Disconnect();
                PhotonNetwork.LoadLevel("Levels/menu");
            }
            else if (mouseEvent.srcElement.className.Contains("CloseTheGame"))
            {
                Application.Quit();
                return;
            }
        }
Beispiel #55
0
    public void OpenWindow(WindowType windowType)
    {
        GameObject window = GetWindowByWindowType(windowType);

        if (window == null)
        {
            Debug.LogError("Открыть Window не удалось. Ресурс не найден.");
        }
        else
        {
            GameObject.Instantiate(window, canvas.transform);

            // ----------------------------------- Чтобы открывалось только одно окно
            //if (curOpenWindow != null)
            //{
            //    GameObject.Destroy(curOpenWindow);
            //    Resources.UnloadUnusedAssets();
            //}
            //curOpenWindow = GameObject.Instantiate(window, canvas.transform);
        }
    }
Beispiel #56
0
    public bool ShowWindowWithNoData(WindowType type, string _message = null, Action noCallBack = null,
                                     Action yesCallBack = null)
    {
        if (windowList.ContainsKey(type))
        {
            BaseWindow window = windowList[type];
            if (window != null)
            {
                window.SetupData(_message, noCallBack, yesCallBack);
                window.transform.SetAsLastSibling();
                window.OnShow();
                return(true);
            }

            return(false);
        }

        bool check = InitWindow(type, _message, noCallBack, yesCallBack);

        return(check);
    }
Beispiel #57
0
        /// <summary>
        /// Finds the moving median sequence from the sequence of values
        /// and the specified non-negative window width. The tail values
        /// (such that there is not enough data in the window around them
        /// get handled using <see cref="TailValuesHandling"/> flag passed).
        /// </summary>
        /// <typeparam name="T">The type of elements in the sequence.</typeparam>
        /// <typeparam name="C">The numeric calculator for the <typeparamref name="T"/> type.</typeparam>
        /// <param name="values">The sequence of values.</param>
        /// <param name="windowWidth">
        /// A non-negative window width applied to both sides of the current value.
        /// It means that, e.g. when the window width is 1, the window will consist
        /// of three values: the current value, one value to the left and one value to the right.
        /// </param>
        /// <param name="windowType">
        /// The type of the window for calculation of the median.
        /// See <see cref="WindowType"/>
        /// </param>
        /// <param name="tailValuesHandling">
        /// A flag specifying how the tail values should be handled
        /// (such that there is not enough data in the window around them).
        /// See <see cref="TailValuesHandling"/>.
        /// </param>
        /// <returns>A sequence of moving medians calculated from the source sequence.</returns>
        public static List <T> MovingMedian <T, C>(
            this IList <T> values,
            int windowWidth,
            WindowType windowType = WindowType.Symmetric,
            TailValuesHandling tailValuesHandling = TailValuesHandling.UseSymmetricAvailableWindow)
            where C : ICalc <T>, new()
        {
            Contract.Requires <ArgumentNullException>(values != null, "values");
            Contract.Requires <ArgumentOutOfRangeException>(windowWidth >= 0, "The window width should be non-negative");
            Contract.Requires <ArgumentException>(
                tailValuesHandling != TailValuesHandling.UseSymmetricAvailableWindow ||
                windowType == WindowType.Symmetric,
                "Symmetric tail values handling is only available for symmetric windows.");

            return(MovingStatistic <T, C>(
                       values,
                       windowWidth,
                       windowType,
                       tailValuesHandling,
                       StatisticExtensionMethods.SampleAverage <T, C>));
        }
Beispiel #58
0
        private void WindowTypeChanger(WindowType type)
        {
            WinType = type;
            Refresher();
            switch (type)
            {
            case WindowType.Load:
                checkBox1.Visible = true;
                this.Name         = "Загрузить";
                this.Text         = "Загрузить";
                button1.Text      = "Загрузить в файл";
                break;

            case WindowType.Save:
                checkBox1.Visible = false;
                button1.Text      = "Сохранить в файл";
                this.Name         = "Сохранить";
                this.Text         = "Сохранить";
                break;
            }
        }
        private void WindowVisibility(WindowType windowType)
        {
            switch (windowType)
            {
            case WindowType.RegisterWindow:
                LoginWindowVisibility    = Visibility.Collapsed;
                RegisterWindowVisibility = Visibility.Visible;
                break;

            case WindowType.ChangePasswordWindow:
                LoginWindowVisibility          = Visibility.Collapsed;
                ChangePasswordWindowVisibility = Visibility.Visible;
                break;

            default:
                RegisterWindowVisibility       = Visibility.Collapsed;
                ChangePasswordWindowVisibility = Visibility.Collapsed;
                LoginWindowVisibility          = Visibility.Visible;
                break;
            }
        }
Beispiel #60
0
        public static double[] getWindow(WindowType type, int length)
        {
            switch (type)
            {
            case WindowType.BLACKMAN:
                return(getBlackmanWindow(length));

            case WindowType.COSINE:
                return(getCosineWindow(length));

            case WindowType.HAMMING:
                return(getHammingWindow(length));

            case WindowType.HANNING:
                return(getHanningWindow(length));

            case WindowType.NONE:
            default:
                return(getRectangularWindow(length));
            }
        }